I know we have some awesome coders in this community, and I was wondering can someone give me a heads up at my struggle?
I'm trying to make a re-spawn functions for the monsters in Half-Life. The basic idea is simple and it has being implemented in some mods, unfortunately none of them are open sourced, and with no reference... I'm sort of in the dark.
I have a code for giving players points for killing monsters, different amount based on the monster killed, and I wanted to have the monsters re-spawn after some time after being killed.
Do you know of any good example I could use? Or maybe you know of a tutorial I probably missed?
Your comments and feedback will be greatly appreciated.
This will immediately respawn the monster at the original position, and fade out the corpse to eventually free up an edict (otherwise, you'll run out of them).
You can also add a check for multiplayer or gamerules (g_pGamerules->IsMultiplayer() or custom), and make a respawn delay by moving this code to a separate exported think function and using SetThink() with pev->nextthink with the respawn delay.
HtH.
Napoleon321 писал: The basic idea is simple and it has being implemented in some mods
What mods are you referring to? Maybe they just use monstermaker with infinite monster count and max living monsters set to 1?
XaeroX, I think this method will work only for non-gibbed monsters, since gibbing deletes the entity. Also this does not preserve special monsters settings (like weapons, spawnflags, etc.).
FreeSlave, I'm referring to Scientist Hunt, I'm sure for this one it's not the monster make thing... since the barney re-spawns on crossfire... and he\s not made with monster-maker there.
Back on the topic or the code: I presume a similar thing is done for the re-spawning of the weapons and the ammo items... still I was not able to completely grasp the concept.