A question of Multiplayer Bush

I’ve created my own desert bush. Simple enough, right?
I’m even foregoing letting players pick them up, to ensure the NPC is not broken by being moved off its origin level.

Here’s the code.

[php]if (washit) {
hide;
putleaps 0, x, y;
timeout = 10;
}
if (timeout){
show;
}[/php]

As I said, really simple. However I wish to learn if there are any rules I need to follow.

If a timeout is set and the last player leaves the level - would the timeout break? How would the script behave for the next player that enters? I need to make sure I’m avoiding a potential multiplayer “hazzard” of the NPC hiding and never showing again. I hope there is some insight into how reliable timeout is and if I’m doing the right thing by avoiding (created) and (playerenters).

Alternatively… I could do this:

[php]if (playerenters && isleader && !this.ini == 1){
this.ini = 1;
show;
}[/php]

Think that’s a necessary addition?

Yer but no. How I busted this problem was storing timevar in a npc attribute and then the leader loops until the bush is respawned.

if (playerenters){
  timereverywhere;//we'll loop for all players(I guess)
  if (save[1] == 1){//bush is hidden
    timeout = 0.05;
  }
}

if (washit && save[1] == 0){
  setcharprop #P1,#v(timevar+2);//timevar increments by 1 every 5 seconds
  //insert gani here
  hide;
  save[1] = 1;


  timeout = 10;
}

if (timeout && save[1] == 1){
  if (save[1] == 1 && timevar >= strtofloat(#P1(-1))){
    save[1] = 0;//let the npc we're not hiding
    show;
  }
  timeout = 1;
}

Also you’ll want to use a character ani instead of putleaps, as putleaps is clientside.