Jump to content
  • 0

error for automated events


Mootie

Question


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

//===== rAthena Script =======================================
//= Poring Summoner
//===== By: ==================================================
//= Bahmut (Made it automated)
//= MoonlightRO (Original)
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: =====================================
//= TXT & SQL
//===== Link to orginal: =====================================
//= http://www.eathena.ws/board/index.php?showtopic=236779
//============================================================
- script Poring Summoner -1,{
OnInit:
 //---- NPC Config -----
 set .ItemID,1000;
 set .SpecialPorings,2;
 set .NormalPorings,2;
 //---------------------
 initnpctimer;
 end;

OnSpecialKill:
 set .SpecialPorings[1],.SpecialPorings[1]-1;
 announce strcharinfo(0) + " got a " + getitemname(.ItemID) + "!",bc_map;
 getitem .ItemID,1;
 goto PoringCount;

OnNormalKill:
 set .NormalPorings[1],.NormalPorings[1]-1;
 goto PoringCount;

PoringCount:
 announce "Special Poring: " + .SpecialPorings[1] + " || Normal Poring: " + .NormalPorings[1],bc_map;
 if(!.SpecialPorings[1]) goto EndEvent;
 end;

OnTimer216000000:
RestartEvent:
 killmonster .Map$,"All";
 set .Event,0;
 set .SpecialPorings[1],0;
 set .NormalPorings[1],0;

 removemapflag .Map$,mf_noskill;
 set $@ran, rand(1,10);
 if ($@ran == 10) set .Map$,"lighthalzen";
 if ($@ran == 9) set .Map$,"louyang";
 if ($@ran == 8) set .Map$,"comodo";
 if ($@ran == 7) set .Map$,"xmas";
 if ($@ran == 6) set .Map$,"aldebaran";
 if ($@ran == 5) set .Map$,"izlude";
 if ($@ran == 4) set .Map$,"payon";
 if ($@ran == 3) set .Map$,"geffen";
 if ($@ran == 2) set .Map$,"morocc";
 if ($@ran == 1) set .Map$,"prontera";
 setmapflag .Map$,mf_noskill;
 monster .Map$,0,0,"Poring",1002,.SpecialPorings,"Poring Summoner::OnSpecialKill";
 monster .Map$,0,0,"Poring",1002,.NormalPorings,"Poring Summoner::OnNormalKill";
 set .SpecialPorings[1],.SpecialPorings;
 set .NormalPorings[1],.NormalPorings;
 announce "The Poring Event has begun!",bc_all;
 announce "Location: " + .Map$,bc_all;
 announce "Special Poring: " + .SpecialPorings,bc_all;
 announce "Normal Poring: " + .NormalPorings,bc_all;

 setnpctimer 0;
 end;
}

if not can you guys help me to make this RA

Edited by Emistry
Please use [CODEBOX] or Attachments for long contents.
Link to comment
Share on other sites

Recommended Posts


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  331
  • Reputation:   63
  • Joined:  11/29/11
  • Last Seen:  

It seems fine. Is there any error, if yes then post the error.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

no there is no error at all and i already put ontimer to 0 so once i restart the server the automated event will start nothing happen and no error

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

Untested.

-	script	Poring Summoner	-1,{
OnInit:

 //---- NPC Config -----
 set .ItemID, 1000;
 set .SpecialPorings, 2;
 set .NormalPorings, 2;
 setarray .Map$[0], "lighthalzen","louyang","comodo","xmas","aldebaran","izlude","payon","geffen","morocc","prontera";
 //---------------------

 setnpctimer 0;
 initnpctimer;
 end;



OnTimer360000: //1 hour delay

  stopnpctimer;
  killmonsterall .Map$;
  set .loc, rand(getarraysize(.Map$));

  setmapflag .Map$[.loc], mf_noskill;

  monster .Map$[.loc], 0, 0, "Poring", 1002, .SpecialPorings, "Poring Summoner::OnSpecialKill";
  monster .Map$[.loc], 0, 0, "Poring", 1002, .NormalPorings, "Poring Summoner::OnNormalKill";

  announce "The Poring Event has begun!", 0;
  sleep 1000;
  announce "Location: " + .Map$[.loc], 0;
  sleep 1000;
  announce "Special Poring: " + .SpecialPorings, 0;
  sleep 1000;
  announce "Normal Poring: " + .NormalPorings, 0;
  end;

OnSpecialKill:
  set .SpecialPorings, .SpecialPorings - 1;
  mapannounce strcharinfo(0) + " got a " + getitemname(.ItemID) + "!", bc_map, bc_blue;
  getitem .ItemID,1;
  goto PoringCount;

OnNormalKill:
  set .NormalPorings, .NormalPorings - 1;
  goto PoringCount;

PoringCount:

  if( .SpecialPorings || .NormalPorings )
  announce "Special Poring: " + .SpecialPorings + " || Normal Poring: " + .NormalPorings, bc_map, bc_blue;

  else {
  announce "The Poring Event has ended.", 0;
  deletearray .Map$[0], getarraysize(.Map$);
  removemapflag .Map$[.loc], mf_noskill;
  goto OnInit;
  }
 end;

}

Your script didn't start 'cause ou set a 60 hours wait time, actually almost 3 days.

Also, you converted simple integer variables into array elements, don't know why.

Edited by Ryokem
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

//===== rAthena Script =======================================
//= Poring Summoner
//===== By: ==================================================
//= Bahmut (Made it automated)
//= MoonlightRO (Original)
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: =====================================
//= TXT & SQL
//===== Link to orginal: =====================================
//= [url="http://www.eathena.ws/board/index.php?showtopic=236779"]http://www.eathena.w...howtopic=236779[/url]
//============================================================

-	script	Poring Summoner	-1,{

OnInit:
	//---- NPC Config -----
	set .ItemID,7960;
	set .SpecialPorings,50;
	set .NormalPorings,100;
	//---------------------
	initnpctimer;
	end;

OnSpecialKill:
	set .SpecialPorings[1],.SpecialPorings[1]-1;
	announce strcharinfo(0) + " got a " + getitemname(.ItemID) + "!",bc_map;
	getitem .ItemID,1;
	goto PoringCount;

OnNormalKill:
	set .NormalPorings[1],.NormalPorings[1]-1;
	goto PoringCount;

PoringCount:
	announce "Special Poring: " + .SpecialPorings[1] + " || Normal Poring: " + .NormalPorings[1],bc_map;
	if(!.SpecialPorings[1]) goto EndEvent;
	end;

OnTimer17:
RestartEvent:
	killmonster .Map$,"All";
	set .Event,0;
	set .SpecialPorings[1],0;
	set .NormalPorings[1],0;

	removemapflag .Map$,mf_noskill;
	set $@ran, rand(1,10);
	if ($@ran == 10) set .Map$,"lighthalzen";
	if ($@ran == 9) set .Map$,"louyang";
	if ($@ran == 8) set .Map$,"comodo";
	if ($@ran == 7) set .Map$,"xmas";
	if ($@ran == 6) set .Map$,"aldebaran";
	if ($@ran == 5) set .Map$,"izlude";
	if ($@ran == 4) set .Map$,"payon";
	if ($@ran == 3) set .Map$,"geffen";
	if ($@ran == 2) set .Map$,"morocc";
	if ($@ran == 1) set .Map$,"prontera";
	setmapflag .Map$,mf_noskill;
	monster .Map$,0,0,"Poring",1002,.SpecialPorings,"Poring Summoner::OnSpecialKill";
	monster .Map$,0,0,"Poring",1002,.NormalPorings,"Poring Summoner::OnNormalKill";
	set .SpecialPorings[1],.SpecialPorings;
	set .NormalPorings[1[attachment=4361:Untitled.png]],.NormalPorings;
	announce "The Poring Event has begun!",bc_all;
	announce "Location: " + .Map$,bc_all;
	announce "Special Poring: " + .SpecialPorings,bc_all;
	announce "Normal Poring: " + .NormalPorings,bc_all;

	setnpctimer 0;
	end;
}

post-9398-0-76516100-1352468307_thumb.png

Edited by AnnieRuru
TOPIC MERGE
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:  

change .Map$ into global permanent variable....

or....

in the OnInit part...just simply add this..

set .Map$,"anymapname";

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

change .Map$ into global permanent variable....

or....

in the OnInit part...just simply add this..

set .Map$,"anymapname";

i already add the

   OnInit:
       //---- NPC Config -----
       set .ItemID,7960;
       set .SpecialPorings,50;
       set .NormalPorings,100;
       set .Map$,"anymapname";

its still the same problem mapindex_name2id: map "anymapname" not found in index list

Edited by Mootie
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

Real.

No need to open 2 topics with the same code and request.

EDIT:

Newer fixed version at Post #14

http://rathena.org/board/topic/73840-error-for-automated-events/#entry154225

Edited by Ryokem
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

so yeah how bout the its still the same problem mapindex_name2id: map "anymapname" not found in index list

as emistry said just put OnInit set .Map$,"anymapname"; still having error

i also try to put another item on itemID it seems i can only get 1 item per special poring

OnInit:
	//---- NPC Config -----
	set .ItemID,7960;
			set .ItemID,7539;
	set .SpecialPorings,50;
	set .NormalPorings,100;
	set .Map$,"anymapname";

another error shows when the event ends post-9398-0-67887900-1352471022_thumb.png

after the event ends the nxt event didnt start as well after that error shows

Edited by Mootie
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

as emistry said just put OnInit set .Map$,"anymapname"; still having error

"anymapname" is not a map name, he meant to put there a random map location.. such as "prontera", "morocc", "moc_fild02"... whatever!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

as emistry said just put OnInit set .Map$,"anymapname"; still having error

"anymapname" is not a map name, he meant to put there a random map location.. such as "prontera", "morocc", "moc_fild02"... whatever!

so instead doing this

   	 if ($@ran == 10) set .Map$,"lighthalzen";
       if ($@ran == 9) set .Map$,"louyang";
       if ($@ran == 8) set .Map$,"comodo";
       if ($@ran == 7) set .Map$,"xmas";
       if ($@ran == 6) set .Map$,"aldebaran";
       if ($@ran == 5) set .Map$,"izlude";
       if ($@ran == 4) set .Map$,"payon";
       if ($@ran == 3) set .Map$,"geffen";
       if ($@ran == 2) set .Map$,"morocc";
       if ($@ran == 1) set .Map$,"prontera";

ill set it to

set .Map$,""prontera", "morocc", "moc_fild02";

Real.

http://rathena.org/b...mpatible-in-ra/

No need to open 2 topics with the same code and request.

Untested.

-	script	Poring Summoner	-1,{
OnInit:

 //---- NPC Config -----
 set .ItemID, 1000;
 set .SpecialPorings, 2;
 set .NormalPorings, 2;
 setarray .Map$[0], "lighthalzen","louyang","comodo","xmas","aldebaran","izlude","payon","geffen","morocc","prontera";
 //---------------------

 setnpctimer 0;
 initnpctimer;
 end;



OnTimer360000: //1 hour delay

  stopnpctimer;
  killmonsterall .Map$;
  set .loc, rand(getarraysize(.Map$));

  setmapflag .Map$[.loc], mf_noskill;

  monster .Map$[.loc], 0, 0, "Poring", 1002, .SpecialPorings, "Poring Summoner::OnSpecialKill";
  monster .Map$[.loc], 0, 0, "Poring", 1002, .NormalPorings, "Poring Summoner::OnNormalKill";

  announce "The Poring Event has begun!", 0;
  sleep 1000;
  announce "Location: " + .Map$[.loc], 0;
  sleep 1000;
  announce "Special Poring: " + .SpecialPorings, 0;
  sleep 1000;
  announce "Normal Poring: " + .NormalPorings, 0;
  end;

OnSpecialKill:
  set .SpecialPorings, .SpecialPorings - 1;
  mapannounce strcharinfo(0) + " got a " + getitemname(.ItemID) + "!", bc_map, bc_blue;
  getitem .ItemID,1;
  goto PoringCount;

OnNormalKill:
  set .NormalPorings, .NormalPorings - 1;
  goto PoringCount;

PoringCount:

  if( .SpecialPorings || .NormalPorings )
  announce "Special Poring: " + .SpecialPorings + " || Normal Poring: " + .NormalPorings, bc_map, bc_blue;

  else {
  announce "The Poring Event has ended.", 0;
  deletearray .Map$[0], getarraysize(.Map$);
  removemapflag .Map$[.loc], mf_noskill;
  goto OnInit;
  }
 end;

}

Your script didn't start 'cause ou set a 60 hours wait time, actually almost 3 days.

Also, you converted simple integer variables into array elements, don't know why.

i tryed ur script ryokem still has a error post-9398-0-91044100-1352472057_thumb.png

bump

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

"morroc" and "moroc" are not avaible maps.

"morocc" is the current correct map name.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

"morroc" and "moroc" are not avaible maps.

"morocc" is the current correct map name.

morroc and moroc is mistaken @warp what i did the real error says

post-9398-0-40883800-1352477509_thumb.png

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

oh, my bad, I noticed the error I did...

I just forgot to specify the map in the mapannounce and mapflag command.

Also, I optimized the script when deleting the mapflag.

-	script	Poring Summoner	-1,{
OnInit:

 //---- NPC Config -----
 set .ItemID, 1000;
 set .SpecialPorings, 2;
 set .NormalPorings, 2;
 setarray .Map$[0], "lighthalzen","louyang","comodo","xmas","aldebaran","izlude","payon","geffen","morocc","prontera";
 //---------------------

 setnpctimer 0;
 initnpctimer;
 end;



OnTimer360000: //1 hour delay

  stopnpctimer;
  killmonsterall .Map$[.loc];
  set .loc, rand(getarraysize(.Map$));

  setmapflag .Map$[.loc], mf_noskill;

  monster .Map$[.loc], 0, 0, "Poring", 1002, .SpecialPorings, "Poring Summoner::OnSpecialKill";
  monster .Map$[.loc], 0, 0, "Poring", 1002, .NormalPorings, "Poring Summoner::OnNormalKill";

  announce "The Poring Event has begun!", 0;
  sleep 1000;
  announce "Location: " + .Map$[.loc], 0;
  sleep 1000;
  announce "Special Poring: " + .SpecialPorings, 0;
  sleep 1000;
  announce "Normal Poring: " + .NormalPorings, 0;
  end;

OnSpecialKill:
  set .SpecialPorings, .SpecialPorings - 1;
  mapannounce .Map$[.loc], strcharinfo(0) + " got a " + getitemname(.ItemID) + "!", bc_blue;
  getitem .ItemID,1;
  goto PoringCount;

OnNormalKill:
  set .NormalPorings, .NormalPorings - 1;
  goto PoringCount;

PoringCount:

  if( .SpecialPorings || .NormalPorings )
  mapannounce .Map$[.loc], "Special Poring: " + .SpecialPorings + " || Normal Poring: " + .NormalPorings, bc_blue;

  else {
  announce "The Poring Event has ended.", 0;
  removemapflag .Map$[.loc], mf_noskill;
  deletearray .Map$[0], getarraysize(.Map$);
  goto OnInit;
  }
 end;

}

This should fix my typo.

Edited by Ryokem
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

In your original script, it will cause an error because you're removing the mapflag before even set the .map$ variable. So the .map$ is still empty, that's why the console says it can't find the "" map.

Actually Ryokem script works, but it still need a minor fix, in Ryokem's he clears the array then removing the mapflag, it will cause an error too.

So, to make it work, the script will looked like this:

//Based on Ryokem's script
- script Poring Summoner -1,{
OnInit:

//---- NPC Config -----
set .ItemID, 1000;
set .SpecialPorings, 1;
set .NormalPorings, 1;
setarray .Map$[0], "prontera";
//---------------------
setnpctimer 0;
initnpctimer;
end;

OnTimer5000:
stopnpctimer;
killmonsterall .Map$;
set .loc, rand(getarraysize(.Map$));
setmapflag .Map$[.loc], mf_noskill;
monster .Map$[.loc], 156, 179, "Poring", 1002, .SpecialPorings, "Poring Summoner::OnSpecialKill";
monster .Map$[.loc], 156, 177, "Poring", 1002, .NormalPorings, "Poring Summoner::OnNormalKill";

announce "The Poring Event has begun!", 0;
sleep 1000;
announce "Location: " + .Map$[.loc], 0;
sleep 1000;
announce "Special Poring: " + .SpecialPorings, 0;
sleep 1000;
announce "Normal Poring: " + .NormalPorings, 0;
end;

OnSpecialKill:
set .SpecialPorings, .SpecialPorings - 1;
//mapannounce strcharinfo(0) + " got a " + getitemname(.ItemID) + "!", bc_map, bc_blue;
getitem .ItemID,1;
goto PoringCount;

OnNormalKill:
set .NormalPorings, .NormalPorings - 1;
goto PoringCount;

PoringCount:
if( .SpecialPorings || .NormalPorings )
announce "Special Poring: " + .SpecialPorings + " || Normal Poring: " + .NormalPorings, bc_map, bc_blue;
else {
announce "The Poring Event has ended.", 0;
removemapflag .Map$[.loc], mf_noskill;
deletearray .Map$[0], getarraysize(.Map$);
goto OnInit;
}
end;
}

:D

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

In your original script, it will cause an error because you're removing the mapflag before even set the .map$ variable. So the .map$ is still empty, that's why the console says it can't find the "" map.

Actually Ryokem script works, but it still need a minor fix, in Ryokem's he clears the array then removing the mapflag, it will cause an error too.

So, to make it work, the script will looked like this:

Yeah, I actually already corrected them all :P

Had no time when I posted it, now that I came back from work I fixed them in a second :P

Anyway, you still forget to correct an error I did:

killmonsterall .Map$; //.Map$ as array needs an index

:P

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Ahh you're right Ryokem I missed that part too, you have a keen eye!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

Heh, I do have it only when I'm not in a hurry, such as when I posted that script xD

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

It looks like that you're experienced enough with rA scripting language, were you an eA user?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

[OT]

Yeah, I was on eA and worked as ssd in some pretty cool associations such as Blizzard, but honestly this is not the place to speak about, just PM me if you want to ask me personal info, this thread is meant to help not to chat :P

[/OT]

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

In your original script, it will cause an error because you're removing the mapflag before even set the .map$ variable. So the .map$ is still empty, that's why the console says it can't find the "" map.

Actually Ryokem script works, but it still need a minor fix, in Ryokem's he clears the array then removing the mapflag, it will cause an error too.

So, to make it work, the script will looked like this:

//Based on Ryokem's script
- script Poring Summoner -1,{
OnInit:

//---- NPC Config -----
set .ItemID, 1000;
set .SpecialPorings, 1;
set .NormalPorings, 1;
setarray .Map$[0], "prontera";
//---------------------
setnpctimer 0;
initnpctimer;
end;

OnTimer5000:
stopnpctimer;
killmonsterall .Map$;
set .loc, rand(getarraysize(.Map$));
setmapflag .Map$[.loc], mf_noskill;
monster .Map$[.loc], 156, 179, "Poring", 1002, .SpecialPorings, "Poring Summoner::OnSpecialKill";
monster .Map$[.loc], 156, 177, "Poring", 1002, .NormalPorings, "Poring Summoner::OnNormalKill";

announce "The Poring Event has begun!", 0;
sleep 1000;
announce "Location: " + .Map$[.loc], 0;
sleep 1000;
announce "Special Poring: " + .SpecialPorings, 0;
sleep 1000;
announce "Normal Poring: " + .NormalPorings, 0;
end;

OnSpecialKill:
set .SpecialPorings, .SpecialPorings - 1;
//mapannounce strcharinfo(0) + " got a " + getitemname(.ItemID) + "!", bc_map, bc_blue;
getitem .ItemID,1;
goto PoringCount;

OnNormalKill:
set .NormalPorings, .NormalPorings - 1;
goto PoringCount;

PoringCount:
if( .SpecialPorings || .NormalPorings )
announce "Special Poring: " + .SpecialPorings + " || Normal Poring: " + .NormalPorings, bc_map, bc_blue;
else {
announce "The Poring Event has ended.", 0;
removemapflag .Map$[.loc], mf_noskill;
deletearray .Map$[0], getarraysize(.Map$);
goto OnInit;
}
end;
}

:D

Heh, I do have it only when I'm not in a hurry, such as when I posted that script xD

really thanks for this btw how i can make it every 1hrs? if random it should be

OnTimer1 setnpctimer 0

im correct?

and for the result is like this

//Based on Ryokem's script
-    script    Poring Summoner    -1,{
OnInit:

   //---- NPC Config -----
   set .ItemID, 677;
   set .SpecialPorings, 50;
   set .NormalPorings, 100;
   killmonsterall .Map$; //.Map$ as array needs an index
   setarray .Map$[0], "lighthalzen","louyang","comodo","xmas","aldebaran","izlude","payon","geffen","morocc","prontera";
   //---------------------
   setnpctimer 0;
   initnpctimer;
   end;

   OnTimer5000:
   stopnpctimer;
   killmonsterall .Map$;
   set .loc, rand(getarraysize(.Map$));
   setmapflag .Map$[.loc], mf_noskill;
   monster .Map$[.loc], 156, 179, "Poring", 1002, .SpecialPorings, "Poring Summoner::OnSpecialKill";
   monster .Map$[.loc], 156, 177, "Poring", 1002, .NormalPorings, "Poring Summoner::OnNormalKill";

   announce "The Poring Event has begun!", 0;
   sleep 1000;
   announce "Location: " + .Map$[.loc], 0;
   sleep 1000;
   announce "Special Poring: " + .SpecialPorings, 0;
   sleep 1000;
   announce "Normal Poring: " + .NormalPorings, 0;
   end;

   OnSpecialKill:
   set .SpecialPorings, .SpecialPorings - 1;
   //mapannounce strcharinfo(0) + " got a " + getitemname(.ItemID) + "!", bc_map, bc_blue;
   getitem .ItemID,1;
   goto PoringCount;

   OnNormalKill:
   set .NormalPorings, .NormalPorings - 1;
   goto PoringCount;

   PoringCount:
   if( .SpecialPorings || .NormalPorings )
   announce "Special Poring: " + .SpecialPorings + " || Normal Poring: " + .NormalPorings, bc_map, bc_blue;
   else {
   announce "The Poring Event has ended.", 0;
   removemapflag .Map$[.loc], mf_noskill;
   deletearray .Map$[0], getarraysize(.Map$);
   goto OnInit;
   }
   end;
}

i guess i figure it out why i got "" on mapindex missing error due on the random map

monster .Map$[.loc], 156, 179,

instead with coordinate i put 0 0 to be random so thats the error?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Change the 'OnTimer' label, you see that 5000? It means 5000 miliseconds = 5 seconds, and if you want to change it to an hour you'll need how many miliseconds? :)

Yes, change it back to 0,0 to make it to become random monster spawn location.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

Change the 'OnTimer' label, you see that 5000? It means 5000 miliseconds = 5 seconds, and if you want to change it to an hour you'll need how many miliseconds? :)

Yes, change it back to 0,0 to make it to become random monster spawn location.

so it wont cause the error " " again if i change it back to random? and 360000 = per 1 hour is that correct? and it will automatically kill the porings if the didnt participate right? via killmonsterall .Map$;

Edited by Mootie
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

1 hour is 60*60*1000

In order to force the script to restart again every hour, why don't you use OnMinute00 label? So you don't have to use the timer again.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

1 hour is 60*60*1000

In order to force the script to restart again every hour, why don't you use OnMinute00 label? So you don't have to use the timer again.

for the random time? uhm,good idea

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

Added the feature asked for.

1. Activate every hour at minute :00

-	script	Poring Summoner	-1,{
OnInit:

 //---- NPC Config -----
 set .ItemID, 1000;
 set .SpecialPorings, 2;
 set .NormalPorings, 2;
 setarray .Map$[0], "lighthalzen","louyang","comodo","xmas","aldebaran","izlude","payon","geffen","morocc","prontera";
 //---------------------
 end;

OnMinute00: //means the event starts every hour

  killmonsterall .Map$[.loc]; //Kills monsters in case the even doesn't end in time for the next one.

  set .loc, rand(getarraysize(.Map$)); //Getting a random location (index of map array listed above)

  setmapflag .Map$[.loc], mf_noskill;

  monster .Map$[.loc], 0, 0, "Poring", 1002, .SpecialPorings, "Poring Summoner::OnSpecialKill";
  monster .Map$[.loc], 0, 0, "Poring", 1002, .NormalPorings, "Poring Summoner::OnNormalKill";

  announce "The Poring Event has begun!", 0;
  sleep 1000;
  announce "Location: " + .Map$[.loc], 0;
  sleep 1000;
  announce "Special Poring: " + .SpecialPorings, 0;
  sleep 1000;
  announce "Normal Poring: " + .NormalPorings, 0;
  end;

OnSpecialKill:
  set .SpecialPorings, .SpecialPorings - 1;
  mapannounce .Map$[.loc], strcharinfo(0) + " got a " + getitemname(.ItemID) + "!", bc_blue;
  getitem .ItemID,1;
  goto PoringCount;

OnNormalKill:
  set .NormalPorings, .NormalPorings - 1;
  goto PoringCount;

PoringCount:

  if( .SpecialPorings || .NormalPorings )
  mapannounce .Map$[.loc], "Special Poring: " + .SpecialPorings + " || Normal Poring: " + .NormalPorings, bc_blue;

  else {
  announce "The Poring Event has ended.", 0;
  removemapflag .Map$[.loc], mf_noskill;

  deletearray .Map$[0], getarraysize(.Map$); //Reset the map array before creating it back, just to avoid bugs.
  goto OnInit;
  }
 end;

}

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