ID:274043
Jan 4 2012, 12:06 pm
|
|
i want someone to help me with a monster respawn code... want the monsters to individual remember there location and have there own individual spawn timer. ex: player kills monster(1) & Monster(1) move to Loc=0,0,0 and 100 sec after he dies he respawn.
|
In response to Kaigne
|
|
Kaigne wrote:
The ComEdiAn wrote: > world He clearly said "want the monsters to individual remember there location and have there own individual spawn timer" |
In response to A.T.H.K
|
|
Then show him your example...
I'm basically showing him a simpler way to respawn stuff. Without necessarily having to keep track of information. If he didn't like or want the method i have shown, he isn't obligated to use it. Now that I have read it over again it sound like he is leaning towards mob recycling, or creating mobs during runtime. |
In response to Kaigne
|
|
thanks Kaigne but i already know about world repop i wasnt looking for that
|
In response to The ComEdiAn
|
|
You could do it like this, instead of creating a new mob over and over ..
Once mob is dead density, icon are nulled and obviously stop it from moving also kill off the attack nearest player and any other procs it has (have an isdead check on each proc for the mob\s) ... in the death proc of the mob\s have sleep(mob.timer amount) (set timer amount for each mob ie boss = 100000 minion = 1009 etc) easily done.. Once sleep is finished give it some movement, icon and density run the rand walk/attack procs or how ever you have it set up and Mr mob is off killing people once again. This should eliminate lag as you aren't deleting each mob and re-creating with saved variable's .. |
Pseudo-code:
Monster |
In response to Kaiochao
|
|
Hiding the monster would be more efficient IMO, saves on deleting and re-creating over and over and over.
"Set Current Position to null" he wants to save this, so just set initial position to current upon dying. |
In response to A.T.H.K
|
|
"ex: player kills monster(1) & Monster(1) move to Loc=0,0,0 and 100 sec after he dies he respawn."
100 seconds after the monster dies, a new monster appears at the monster's initial position. I'm assuming he doesn't want a dead monster to re-appear at the monster's initial position, so I provide two ways of accomplishing this: -creating a new monster at the initial position, or -repositioning the same monster at its initial position with its essential variables reset. In both cases, the monster is moved to "Loc=0,0,0" 100 seconds before it is respawned. |
In response to Kaiochao
|
|
I see what you did the wording caught me off guard - "creating a new monster"
|
In response to A.T.H.K
|
|
I've never encountered lag from my basic NPC respawning proc...
mob/npc |
You can just do a world.Repop() which would just "repopulate the world to its initial state". Meaning that every mob or object in the world that was deleted during runtime, would be recreated.