The code I wrote below is for respawning a npc:
--- --- ---
function respawn_the_npc(npc)
npc_respawn_after_death(npc,true)
end
--- --- ---
In-game,when killed,the npc respawns with no problems but only for one time.How can I make this function loop forever and make it stop whenever I want?I can already respawn the npc for an infinite amount of time,so I just use this:
--- --- ---
function respawn_the_npc(npc)
npc_respawn_after_death(npc,true)
on_respawn("respawn_the_npc_loop",npc)
end
function respawn_the_npc_loop(npc)
npc_respawn_after_death(npc,true)
end
--- --- ---
I can do an infinite respawn loop using what I typed above but it doesn't seem too polished and I want to make the first function I wrote from above to loop.I heard about thread_yield or something like that,but I have no clue,could someone help me with this please?It's for my SR2 missions project,I'm like 70% done.
Knowing how to use threads will tremendously help me to make the SR2 missions for my mod much better.
--- --- ---
function respawn_the_npc(npc)
npc_respawn_after_death(npc,true)
end
--- --- ---
In-game,when killed,the npc respawns with no problems but only for one time.How can I make this function loop forever and make it stop whenever I want?I can already respawn the npc for an infinite amount of time,so I just use this:
--- --- ---
function respawn_the_npc(npc)
npc_respawn_after_death(npc,true)
on_respawn("respawn_the_npc_loop",npc)
end
function respawn_the_npc_loop(npc)
npc_respawn_after_death(npc,true)
end
--- --- ---
I can do an infinite respawn loop using what I typed above but it doesn't seem too polished and I want to make the first function I wrote from above to loop.I heard about thread_yield or something like that,but I have no clue,could someone help me with this please?It's for my SR2 missions project,I'm like 70% done.
Knowing how to use threads will tremendously help me to make the SR2 missions for my mod much better.