Jump to content
  • 0

Request Fix from this script


manabeast

Question


  • Group:  Members
  • Topic Count:  138
  • Topics Per Day:  0.03
  • Content Count:  835
  • Reputation:   25
  • Joined:  11/22/11
  • Last Seen:  


prontera,157,190,4[TAB]script[TAB]GardenEntrance[TAB]793,{

OnInit:
set .@garden$,maze // <Customizable>
set .@x,50; // <Customizable>
set .@y,55; // <Customizable>
set .playersmax,15; // <Customizable>
set .playersin,0;
disablenpc "Garden Entrance";
end;

if(gettime(4)==6) && (gettime(3)==12) {
enablenpc "Garden Entrance";
Announce "The Mystical Gate of the Secret Garden has opened! Fifteen players may enter.",bc_all || bc_blue;
mes "Rumor has it that there was once an ancient secret garden located near prontera!";
if(countitem(7559) < 1) close;
next;
mes "I see that you have the key... Very well, since you have the key, I can warp you to the gate.";
next;
mes "Do you want me to? Only [" + .playersmax - .playersin + "] can enter.";
next;
if(select("Yes:No") == 2) close;
if(.playersin == .playersmax)
{ mes "Sorry the max players has been reached.";
} else {
warp ".@garden$",.@x,.@y;
set .playersin,.playersin + 1;
close;
}
} else {
disablenpc "Garden Entrance";
}

maze,60,60,4 script Ancient Hero of the Garden 793,{

OnInit:
set .@spawn,1902; // <Customizable>
set .@garden$,maze // <Customizable>
disablenpc "Ancient Hero of the Garden";
end;

if(getmapusers(maze) == 15) {
monster "maze",0,0,"Treasure of the Secret Garden",.@spawn,10,"Ancient Hero of the Garden::L_MDeath";
} else { end; }
if(getmapmobs(.@spawn) == 0) {
mes "I see you have found the treasure ...";
next;
if(.@first == 1 ) { goto L_First; }
else if(.@second == 1 ) { goto L_Second; }
else if(.@third == 1 ) { goto L_Third; }
else if(.@rand > 3) { mes "I see that you did not get the sacred mark of the treasure..."; }
end;

L_First:
mes "Wow... You got the ultimate mark of the treasure ...";
next;
mes "I believe this is yours then...";
getitem 2862;
set zeny, zeny + 100000;
close;

L_Second:
mes "Wow... You got the legendary mark of the treasure ...";
next;
mes "I believe this is yours then...";
getitem 5682;
set zeny, zeny + 50000;
close;

L_Third:
mes "Wow... You got the holy mark of the treasure ...";
next;
mes "I believe this is yours then...";
set zeny, zeny + 20000;
close;

L_MDeath:
set .@rand, rand(1,15);
if(.@rand == 1) { set .@first,1; }
else if(.@rand == 2) { set .@second,1; }
else if(.@rand == 3) { set .@third,1; }
else if(.@rand > 3) { end; }

Reply to Arcencial.

Sorry, will avoid next time. and thank you.

post-472-0-58455200-1328770739_thumb.png

Edited by manabeast
Codeboxed
Link to comment
Share on other sites

12 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  1315
  • Reputation:   372
  • Joined:  12/10/11
  • Last Seen:  

Please avoid using colors when you're pasting your script and use a codebox.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  43
  • Reputation:   1
  • Joined:  01/20/12
  • Last Seen:  



prontera,157,190,4[TAB]script[TAB]Garden[TAB]Entrance 793,{

OnInit:
set .@garden$,maze // <Customizable>
set .@x,50; // <Customizable>
set .@y,55; // <Customizable>
set .playersmax,15; // <Customizable>
set .playersin,0;
disablenpc "Garden Entrance";
end;

if(gettime(4)==6) && (gettime(3)==12) {
enablenpc "Garden Entrance";
Announce "The Mystical Gate of the Secret Garden has opened! Fifteen players may enter.",bc_all || bc_blue;
mes "Rumor has it that there was once an ancient secret garden located near prontera!";
if(countitem(7559) < 1) close;
next;
mes "I see that you have the key... Very well, since you have the key, I can warp you to the gate.";
next;
mes "Do you want me to? Only [" + .playersmax - .playersin + "] can enter.";
next;
if(select("Yes:No") == 2) close;
if(.playersin == .playersmax) {
mes "Sorry the max players has been reached.";
} else {
warp ".@garden$",.@x,.@y;
set .playersin,.playersin + 1;
close;
}
} else {
disablenpc "Garden Entrance";
}
}

maze,60,60,4 script Ancient Hero of the Garden 793,{

OnInit:
set .@spawn,1902; // <Customizable>
set .@garden$,maze // <Customizable>
disablenpc "Ancient Hero of the Garden";
end;

if(getmapusers(maze) == 15) {
monster "maze",0,0,"Treasure of the Secret Garden",.@spawn,10,"Ancient Hero of the Garden::L_MDeath";
} else {
end;
}


if(getmapmobs(.@spawn) == 0) {
mes "I see you have found the treasure ...";
next;
if(.@first == 1 ) {
goto L_First;
end;
} else if(.@second == 1 ) {
goto L_Second;
end;
} else if(.@third == 1 ) {
goto L_Third;
end;
} else if(.@rand > 3) {
mes "I see that you did not get the sacred mark of the treasure...";
end;
}
}

L_First:
mes "Wow... You got the ultimate mark of the treasure ...";
next;
mes "I believe this is yours then...";
getitem 2862;
set zeny, zeny + 100000;
close;

L_Second:
mes "Wow... You got the legendary mark of the treasure ...";
next;
mes "I believe this is yours then...";
getitem 5682;
set zeny, zeny + 50000;
close;

L_Third:
mes "Wow... You got the holy mark of the treasure ...";
next;
mes "I believe this is yours then...";
set zeny, zeny + 20000;
close;

L_MDeath:
set .@rand, rand(1,15);
if(.@rand == 1) {
set .@first,1;
end;
} else if(.@rand == 2) {
set .@second,1;
end;
} else if(.@rand == 3) {
set .@third,1;
end;
} else if(.@rand > 3) {
end;
}
}
[/codeBOX]

Haven't tested it yet though.

Edited by nelsontyh
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  138
  • Topics Per Day:  0.03
  • Content Count:  835
  • Reputation:   25
  • Joined:  11/22/11
  • Last Seen:  

the npc are unclickable.

post-472-0-57291800-1328887556_thumb.png

Link to comment
Share on other sites


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

set .@garden$,maze

it should be

set .@garden$,"maze";


beside.....

since you have already set the mapname into a variable...

this line is incorrect already...

monster "maze"....blablbala

it should be

monster .@garden$,........blablabla

like i said above...

warp ".@garden$",.@x,.@y;

when you are using the variable... ( try to get the value of the variable )

you dont need to use any double quote ( " ) for the argument

should be....this..

warp .@garden$,.@x,.@y;

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  138
  • Topics Per Day:  0.03
  • Content Count:  835
  • Reputation:   25
  • Joined:  11/22/11
  • Last Seen:  

first one ok.

if(getmapusers(maze) == 15) {
monster "maze",0,0,"Treasure of the Secret Garden",.@spawn,10,"Ancient Hero of the Garden::L_MDeath";
} else {
end;
}

change to this?

if(getmapusers(maze) == 15) {
monster  .@garden$,.@0,.@0,"Treasure of the Secret Garden",.@spawn,10,"Ancient Hero of the Garden::L_MDeath";
} else {
end;
}

?

Edited by manabeast
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

Na, he meant if you already had setup variable you might use it instead hardcoding name. (so if you want to change map for exemple you just need to change this variable and not the rest of the script).

About the line it should be :

monster .@garden$,0,0,"Treasure of the Secret Garden",.@spawn,10,"Ancient Hero of the Garden::L_MDeath";

.@0 mean you want mob to be spawn at location x and y contained in variable .@0 (even if I don't know if you can store a variable with number for reference). Anyway if it's the case .@0 may also since since because you didn't do a set .@0 before it will return 0 so we're good.

To continue on variable correct me if i'm wrong here but .@var scope stop at the end of function, wich mean after end; value contained will be erased (0), so here you setup temp variable in OnInit: end; -> you did nothing. I'd consider change them for .var

Last I don't see how you npc will work, how will we trigger "if(getmapusers(maze) == 15) { ", or "if(gettime(4)==6) && (gettime(3)==12) {", since you have no label before those only way I see to trigger those condition will be to click on npc. Unfortunatly if you do so you'll only trigger OnInit and end. Thus you won't reach here neither.

Conider moving OnInit function on npc end, so you can click on them or juging by context you could add :

OnMinute00: //checking each hours
if(gettime(4)==6) && (gettime(3)==12)

Or directly

OnSat1200

wich trigger it each saturday at noon

And for the other one :

OnPCLoadMapEvent://trigger at each map entrance
if(getmapusers("maze") == 15)

Hope you'll understand and that I'm wrong for mistakes I pointed but I would be surprised.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  138
  • Topics Per Day:  0.03
  • Content Count:  835
  • Reputation:   25
  • Joined:  11/22/11
  • Last Seen:  

thanks lighta for explaination but i'm not really good at scripting...:P little dun get it's too but it's ok i continue read 3~4 time understand little about it.

for timing OnSat1200 . i really want this for sunday. how to change for sunday? like this? remove onlnit?

OnSat1200

set .@garden$,maze // <Customizable>

set .@x,50; // <Customizable>

set .@y,55; // <Customizable>

set .playersmax,15; // <Customizable>

set .playersin,0;

disablenpc "Garden Entrance";

end;

about monster .@garden$,0,0, < is treasure box i want it's random spawn at prontera @@". ppl who find the box = got the key = talk to npc can enter this npc maze map.

for OnPCLoadMapEvent: add in where? :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

Ok wait I'll do a pastebin with the changes so you'll see what I mean.

I didn't try the script myself and it may contains other errors I didn't saw but here you are :

http://pastebin.com/MC9mZpr2

I try to comment as much as possible, and rewrite it a bit.

(ps, I put it public on pastebin so ask me if you want to remove it)

Edited by Lighta
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  138
  • Topics Per Day:  0.03
  • Content Count:  835
  • Reputation:   25
  • Joined:  11/22/11
  • Last Seen:  

prontera,157,190,4[TAB]script[TAB]GardenEntrance[TAB]793,{

i forgot correct back. yes u may public because this script is i request then ifoxkun first made this script :P. i try it out tonight. now i'm working. ^^ thank you for so much help. hope this event running smooth, about the map if u want can get from early post.http://rathena.org/board/topic/57681-solve-event-script/#entry72490. we should put cradit for ifoxkun. u can add your in if you want to for fixing it up.

i have found some confusing there.

L_MDeath: //called at each mob dead
    if(getmapmobs(.spawn) == 0) { //if there no more mob on map
		    set .spawn[1],0; //mark monster are all dead
		    mes "I see you have found the treasure ...";
		    next;
		    switch(rand(1,15)){
				    case 1 : goto L_First; //I dun like much goto but well
				    case 2 : goto L_Second;
				    case 3 : goto L_Third;
				    default :
						    mes "I see that you did not get the sacred mark of the treasure...";
						    close;
		    }
    }
    end;

o O? maze map have monster?

the event is run like this. when read the time u set will spawn 15 treasure box in prontera. after that player just have to find them in the town to get the key to enter this Ancient Garden. after get the key and talk to npc will warp to maze.gat map. after that is a really big maze xD! look very fun, just walk from start point to end point to receive prize and exit the maze.

well.. it's not a bad ideas to put monster on the map to make it's more challenge and increase popular rate.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

Oh it's not exactly how it is/was configured; but just to anwser simply yes you did spwan monster in maze with this :

"monster .garden$,0,0,"Treasure of the Secret Garden",.spawn,10,"Ancient Hero of the Garden::L_MDeath";"

For what I get reading you script :

Garden Entrance :

anonce that the maze is open and warp you there if you have the key. Actually seing your announce you may not want it like that exactly (since every player will spawn announce...)

If you have the item 7759 (I guess the key) then you warped in maze if there enough place.

Ancient Hero of the Garden:

Once warped we waiting there 15 player in then spawn 10 monster. automatic spawn here. (I prevent respawn but you may change it)

Finally once all those 10 monster are dead the player who killed the last one get a reward.

This is what more or less was coded, I least what I understand, anyway I think you understand what I meant now, good luck =)

  • Upvote 1
Link to comment
Share on other sites


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

if(getmapmobs(.spawn) == 0) { //if there no more mob on map

it is better if you are using

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

so that it only count for the monster that has been spawn by this NPC script with certain Label with it..

because..

if you use the getmapmobs....

if the map have 1 or more of permamnet instant respawn mob...

your event wont be end...it will last forever...since there is alway be monster in that map

and i dont think it is a good idea to put in

if(gettime(4)==6) && (gettime(3)==12) {

at the begin of NPC script

which will be triggered upon the player click on the NPC

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  138
  • Topics Per Day:  0.03
  • Content Count:  835
  • Reputation:   25
  • Joined:  11/22/11
  • Last Seen:  

= =" so high level knowledge ;) . anyway i finally redo the treasure box gravity error problem.

this is the treasure box id inside have key ID 3639. -.-" may you can post me the fix one? tq for lighta and emistry so kind.

Edited by manabeast
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...