Jump to content
  • 0

Brancher


Belkan

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

Hi, please help me to fix this script; this is a npc who spawn a random monster

The problem who i find are:

On: StartEvent i can't insert the "close"

if on the map there are 30 mob the event is turned off until at least one monster is killed

If is possible automatizate the event: "StartEvent and StopEvent" if there is at least one player

thx a lot

pvp_n_3-5,99,99,5	script	Brancher	757,{


menu "Start",StartEvent,"Stop",StopEvent,"Cancel",cancel;


StartEvent: // To turn the event on...
set .active,1;
dispbottom "Started";
goto OnInit;


StopEvent: // To turn it off...
set .active,0;
dispbottom "Stopped";
close2;
goto OnInit;

cancel:
close;




OnInit:
while (.active == 1) { // Loop until event is turned off.
	monster "pvp_n_3-5",0,0,"--ja--",-1,1; // Summon a random monster at random coordinates.
	sleep 5000; // Wait 5 seconds.
}

}

Link to comment
Share on other sites

10 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

Use these labels:

OnClock<hour><minute>:
OnMinute<minute>:
OnHour<hour>:
On<weekday><hour><minute>:
OnDay<month><day>:

use end Instead of close if there is no conversation.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

automatizate the event when a player enter in a map

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

how about like this?

OnInit:
while( 1){
 if( getmapusers("pvp_n_3-5") ) monster "pvp_n_3-5",0,0,"--ja--",-1,1;
 sleep 5000; // Wait 5 seconds.
}
end;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

how about like this?

OnInit:
while( 1){
 if( getmapusers("pvp_n_3-5") ) monster "pvp_n_3-5",0,0,"--ja--",-1,1;
 sleep 5000; // Wait 5 seconds.
}
end;
}

i have used this:

while (getmapusers("pvp_n_3-5") >= 1) { // Loop until event is turned off.
	monster "pvp_n_3-5",0,0,"--ja--",-1,1;
	sleep 5000; // Wait 5 seconds.
}

how can i start automatically the npc when a player join the map? :/

Edited by Belkan
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Emistry's code works, yours doesn't. Another instance of the "don't copy code if you don't know what it means" rule: your while() loop ends immediately if a player is not found after a 5 second interval.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

Emistry's code works, yours doesn't. Another instance of the "don't copy code if you don't know what it means" rule: your while() loop ends immediately if a player is not found after a 5 second interval.

but i wanna to active the npc only if there is at least one player on the map so it isn't wrong in my opinion O.o

Edited by Belkan
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

try this ?

pvp_n_3-5,99,99,5 script Brancher 757,{
if( select( (( .Event )?"STOP":"START" ),"Cancel" ) == 1 ){
set .Event,!.Event;
mes ""+( ( .Event )?"STARTED":"STOPPED" );
}
close;

OnInit:
while( 1 ){
if( .Event && getmapusers("pvp_n_3-5") && mobcount("pvp_n_3-5","All") < 30 )
 monster "pvp_n_3-5",0,0,"--ja--",-1,1; // Summon a random monster at random coordinates.
sleep 5000; // Wait 5 seconds.
}
end;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

the mobcount doesn't work :/

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Are you using rAthena?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  33
  • Reputation:   0
  • Joined:  03/09/12
  • Last Seen:  

Are you using rAthena?

certainly, but there are spawned more than 30 monsters

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...