putnpc;


#1

hi,
putnpc; doesn’t work for me online, just offline. Can someone help me?
Anyways is there a other way of putting a NPC (triggeractions)

Weapon:

if (playerdir == 0 && keypressed && keydown2(keycode(s),true)) { message #v(int(random(0,2))); putnpc lightarc0.png,Script1.txt,playerx-0.5,playery-random(1,3); }

Script1.txt:

[CODE]dontblock;
message Worked!;
sleep 1;
message Awesome!;
sleep 1;
destroy;

timeout = 0.05;
timereverywhere;[/CODE]


#2

A few things:

  • the script1.txt should be in your world folder and your folder config should point to that folder for text files if doesn’t already
  • you need to call timereverywhere prior to actually calling a timer or sleep for all players to be able to run the timer
  • it’s probably a good idea to surround your code with an event such as playerenters i.e.
if ( playerenters) {
   //bla...
}

#3

Well since it is a npc that will be created if(created) would make more sense here. Instead of if(playerenters).


#4

A valid point but you’re failing to consider what happens when the controlling player(i.e. the client on which the script is executing) leaves the level. The npc would become stuck and no longer be destroyed.


#5

Still not working. Hmm