Jump to content
  • 0

OnTimer not working~


Tofee

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  04/07/17
  • Last Seen:  

-	script	Invasion	-1,{

OnHour00:
OnHour06:
OnHour12:
OnHour18:
set .t, rand(getarraysize(.@map$));
set .cnt, 1;
set .killed, .quan;
announce "Siege Guardian : The Time Voids are invading "+.map$[.t],0;
monster .map$[.t],0,0,"Time Void",.mob,.quan,strnpcinfo(0)+"::OnKilled";
end;

OnKilled:
set .item_size,getarraysize( .item );
set .@prize, rand(1,100);
if ( .@prize > 50 ) {
getitem .item[ rand( .item_size ) ],1;
}
if (mobcount (.map$,.mob) <= .quan) {
monster .map$[.t],0,0,"Time Void",.mob,.add,strnpcinfo(0)+"::OnPrize";
}
end;

OnTimer15000:
killmonster .map$[.t],"All";
announce "Siege Guardian : Thank you for defending "+.map$[.t],0;
stopnpctimer;
end;

OnInit:
set .add, 1; // Number of Additional Spawn
set .quan, 100; // Number of mobs spawned for each non-MVP wave and mobcount
set .mob, "3074"; // Mob id
setarray .item, 7528,14565,14556,14553,14559,14562,14568; // Rewards
setarray .map$[0],"prontera","morocc","aldebaran"; // Add all the map warps you want your invasion to take place at random
}

I can't get what's wrong, my script is not stoping 15sec after it starts. Help guys.
script should run: onhour: spawn 100 mob > onkill: get item > spawn mob until mobcount is 100 > and all this should run for about 15seconds. I need suggestions and advice for improving.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  249
  • Reputation:   72
  • Joined:  10/20/12
  • Last Seen:  

*mobcount("<map name>","<event label>")
if (mobcount (.map$,.mob) <= .quan) {
monster .map$[.t],0,0,"Time Void",.mob,.add,strnpcinfo(0)+"::OnPrize";
}

Mobcount needs an event label as second paramter and you're missing the array index of the map. Also your if clause seems to be always true?

Anyways your OnTimer will never trigger, because the npctimer hasn't been started. Just try to add an initnpctimer at the end of your event initialisation.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  04/07/17
  • Last Seen:  

10 hours ago, Jey said:

*mobcount("<map name>","<event label>")

if (mobcount (.map$,.mob) <= .quan) {
monster .map$[.t],0,0,"Time Void",.mob,.add,strnpcinfo(0)+"::OnPrize";
}

Mobcount needs an event label as second paramter and you're missing the array index of the map. Also your if clause seems to be always true?

Anyways your OnTimer will never trigger, because the npctimer hasn't been started. Just try to add an initnpctimer at the end of your event initialisation.

 

sorry, where exactly should I add initnpctimer?

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...