• Repeat hook
    3 replies, posted
Im trying to ignite something multiple times. For example, destroying it then repairing it and then ignite it again. But I can't since im using... if ent.wasAlreadyIgnited then return end But if I don't use it it will just constantly ignite it and etc . Thanks for any type of answers!
Gonna need more information as there's plenty of ways to do it. You can use a timer, a referential timer ( ENT.NextIgnite = CurTime() + XXXX ), or conditionally apply the ignition for a set amount of time with the https://wiki.garrysmod.com/page/Entity/Ignite Is this a custom entity? Are you trying to do this to an existing entity you aren't allowed to edit? Is this in reaction to an event in game like getting shot?
So what is happening is that when a prop gets to a certain amount of health i want it to ignite.     if ent.wasAlreadyIgnited then return end              if ent.VC_Health <= 0 then -- The entity's health is below 0, the car probably exploded         --ignite the car         ent:Ignite()         ent.wasAlreadyIgnited = true     end But because the prop is staying at that health it will just constantly ignite, there for i put if ent.wasAlreadyIgnited then return end Hope you understood what I meant, quite new to lua scripting as you probably can tell, haha:P
It sounds like you want to stop the whole ignition process from happening multiple times while also being able to run the rest of the code. Assuming that is the case, remove the return and it’s if statement and use: if ent.VC_Health <= 0 and not ent.wasAlreadyIgnited then end
Sorry, you need to Log In to post a reply to this thread.