Author Topic: Finding if material is used on Garry's Mod map  (Read 4160 times)

0 Members and 1 Guest are viewing this topic.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Finding if material is used on Garry's Mod map
« on: September 03, 2016, 03:13:32 AM »
I have a new idea for Garry's Mod, that I don't think has been done in a long time now. Though for it to work, I need to be able to search a map to check if it uses a certain material, in this case the grass material.

I really want to try avoid going to facepunch, but if no one is entirely sure, I'd have to. So please stop me from going there :/
« Last Edit: September 03, 2016, 07:02:28 PM by Bite That Apple »
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Finding if material is used on Garry's Mod map
« Reply #1 on: September 03, 2016, 11:50:25 AM »
Do you mean material as in a "looks like"/texture/wireframe/shiny application?
Or surface friction type as in "feels/acts/grips like" ice/water/grass/dirt application?
Though I don't know the Gmod lua terms at this point of both , I'm not fully clear what you're asking and would help us (any reader seeing this discussion) determine what you're looking for and maybe find it at wiki or elsewhere.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Finding if material is used on Garry's Mod map
« Reply #2 on: September 03, 2016, 04:55:42 PM »
Do you mean material as in a "looks like"/texture/wireframe/shiny application?
Or surface friction type as in "feels/acts/grips like" ice/water/grass/dirt application?
Though I don't know the Gmod lua terms at this point of both , I'm not fully clear what you're asking and would help us (any reader seeing this discussion) determine what you're looking for and maybe find it at wiki or elsewhere.

Well, either would work. I'll explain what I'm doing a little more, so you imagine if there is such a function that already exists for this. I want to make an entity that will automatically grow on grass or dirt. So if I have to use the exact material of "grass.vmt", then fine, or if I could do the possibility of a "acts/feels like grass/dirt".
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: Finding if material is used on Garry's Mod map
« Reply #3 on: September 03, 2016, 06:29:35 PM »
I know you can get materials from traces, so maybe just do a bunch of traces in a grid configuration across the map? It wouldn't be perfect, but it's better than nothing.
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Finding if material is used on Garry's Mod map
« Reply #4 on: September 03, 2016, 06:36:59 PM »
I know you can get materials from traces, so maybe just do a bunch of traces in a grid configuration across the map? It wouldn't be perfect, but it's better than nothing.

I've never used that function before. Though, from my understanding of this, it looks like it can only be used on entities. If I'm correct, I'm also sure world is not an entity.
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Finding if material is used on Garry's Mod map
« Reply #5 on: September 03, 2016, 10:10:01 PM »
The world should be an entity:
https://wiki.garrysmod.com/page/game/GetWorld

Also found this after a quick search, might be helpful? This is an area of Gmod I'm not familiar with. :P
https://wiki.garrysmod.com/page/Entity/GetMaterials
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Finding if material is used on Garry's Mod map
« Reply #6 on: September 03, 2016, 11:17:38 PM »
The world should be an entity:
https://wiki.garrysmod.com/page/game/GetWorld

Also found this after a quick search, might be helpful? This is an area of Gmod I'm not familiar with. :P
https://wiki.garrysmod.com/page/Entity/GetMaterials

Thanks for suggestions. I'll try something out, but I'm getting the idea that I'll have to use hammer to do this correctly, or make it like my last gamemode.
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.