• Healing Grenade
    5 replies, posted
Hey so I'm in the process of creating a healing grenade SWEP and using the base grenade code but have no idea how to make the grenade do constant damage over a period of 5 seconds or how to get the damage dealt to one player and transfer it as health to owner of the grenade. Cheers, Josh
First, you check all the players within the range of thrown grenade. You can do that by looping through all players and checking if they are close enough with the grenade and adding all these people in range in a table, then create a timer that triggers each second 5 times. The trigger function will get all players in grenade proximity table and deal them damage and give health to the swep owner.
Ahh okay that makes sense, I'm pretty new to lua coding so which functions would I use to get that kind of result? and which part of the code would I place it in, I'm using the base grenade entity from this source just for reference; Google Code Archive
It's in the entities/sent_grenade_frag/init.lua there is a ENT:Explode function, you can modify it. It's probably going to be very confusing if you are new to the lua as it is not an ordinary looking SWEP.
Yea, I've decided that it's a bit advanced for me at this stage haha I might look into it in the future tho, cheers for your help!
No problem! You might want to consider scripted entities, they are easier to create and fun.
Sorry, you need to Log In to post a reply to this thread.