I'm trying to write an inventory system, but the problem is when a person walks over an item, it is either automatically used (health, armor) or automatically equipped (weapons).
I would like to overwrite this function so that it is only used on certain conditions.
Already there's a condition set so that if a player is at full health, they wont pick up the health.. but I don't know if I can access it.
If I can't write a script to replace the current system, is there at least a function that will allow me to detect if a player had picked up an item? I'll have to.. take it from them.. and put it in the inventory... or something...
But before I make a messy function like that, is it possible to overwrite them?
Edit:
Kind of answering my own question a little, found this [B][URL="http://[URL=%22http://wiki.garrysmod.com/?title=Gamemode.HUDItemPickedUp%22"]wiki.garrysmod.com/?title=Gamemode.HUDItemPickedUp[/URL][/B]
...
These are very simple entities, if I were you I would just remake them in lua with your own conditions.
Ok, so just make my own entities. Yeah, that makes sense. Now I gotta figure out how to do that :)
Thanks
For reference, everything in lua is overwritable in some way. If an entity has a function Think, you can overwrite that by saying ent.Think = MyEntThink. As for overriding hooks, simply name it the same unique name as the original unique name of the hook. The system will overwrite the old.
[QUOTE=Gbps;22574024]If an entity has a function Think, you can overwrite that by saying ent.Think = MyEntThink.[/QUOTE]
True, but note that this is only valid for scripted entities. You can't overwrite a npc_zombie's TakeDamage function.
Yes, I forgot to mention that.
Sorry, you need to Log In to post a reply to this thread.