Jump to content
  • 0
Sign in to follow this  
glemor123

Zombie Event Problem

Question

Why is it sometimes, the prize giver already appears while the players are still joining the zombie event, kindly help me fix it.

 

-    script    announce_nvz    -1,{// beginning TimeOnClock0130:OnClock0830:OnClock1330:OnClock1730:OnClock1930:OnClock2230:announce "Zombie Vs. Novice event Will begin in 3 minutes Please Make A Level 1 Novice Inorder To Join The Event",0;killmonsterall "quiz_01";sleep 5000;announce "At the south of Prontera(Main Town) has appeared npc ' Novice vs. Zombie '!",0;enablenpc "Novice vs. Zombie";sleep 55000;announce "Event Zombie Vs. Novice will begin in 2 minutes Please Make A Level 1 Novice Inorder To Join The Event",0;sleep 60000;announce "Event Zombie Vs. Novice will begin in 1 minute Please Make A Level 1 Novice Inorder To Join The Event",0;sleep 30000;mapannounce "quiz_01","In 30 seconds the monster will be started!",0;sleep 25000;announce "Event Zombie Vs. Novice will begin through ~5~",0;sleep 1000;announce "Event Zombie Vs. Novice will begin through ~4~",0;sleep 1000;announce "Event Zombie Vs. Novice will begin through ~3~",0;sleep 1000;announce "Event Zombie Vs. Novice will begin through ~2~",0;sleep 1000;announce "Event Zombie Vs. Novice will begin through ~1~",0;sleep 1000;announce "Event 'Zombie Vs. Novice' has begun!!",0,0x00FF00;monster "quiz_01",42,369,"Zombie",1036,1;disablenpc "Novice vs. Zombie";sleep 10000;monster "quiz_01",42,369,"Zombie-2",1036,1;sleep 10000;monster "quiz_01",42,369,"Zombie-3",1036,1;sleep 10000;monster "quiz_01",42,369,"Zombie-4",1036,1;initnpctimer;end;OnTimer5000:if ( getmapusers("quiz_01") == 0 ){killmonsterall "quiz_01";announce "'Zombie Vs. Novice' has ended with Event, as all have died",0;disablenpc "Prize";stopnpctimer;end;}else if ( getmapusers("quiz_01") > 1 ){mapannounce "quiz_01",getmapusers("quiz_01") +"the player still survive on Event.",0,0x00FF00;;initnpctimer;end;}initnpctimer;end;OnPCDieEvent:getmapxy .@mapnvz$,.@xnvz,.@ynvz,0;if ( .@mapnvz$ == "quiz_01") {sleep2 1;warp "prontera",154,95;atcommand "@alive "+ strcharinfo(0);dispbottom "you have lost...";}sleep2 1000;if(getmapusers("quiz_01") == 1){killmonsterall "quiz_01";mapannounce "quiz_01","You have won, approach please to npc Prize.",0;killmonsterall "quiz_01";killmonsterall "quiz_01";killmonsterall "quiz_01";killmonsterall "quiz_01";enablenpc "Prize";killmonsterall "quiz_01";stopnpctimer;end;}if(getmapusers("quiz_01") == 0){killmonsterall "quiz_01";killmonsterall "quiz_01";killmonsterall "quiz_01";killmonsterall "quiz_01";stopnpctimer;end;}end;}quiz_01,42,369,3    script    Prize    72,{if (sex == 1) {announce "In ' Zombie Vs. Novice ' has won" + strcharinfo (0) + "! We congratulate him!",0;}else {announce "In ' Zombie Vs. Novice ' has won" + strcharinfo (0) + "! We congratulate her!",0;};getitem 7539,2;warp "prontera",154,95;sleep2 250;disablenpc "Prize";end;}prontera,156,73,3    script    Novice vs. Zombie    1015,{if (BaseLevel > 1) goto NO;if (class == 0) goto event;if (class > 0) goto NO;event:mes "[^0000FFZombie Vs. Novice^000000]";mes "You wish to get on Event Zombie Vs. Novice?";next;switch(select("Yes","No")) {case 1:sc_end SC_ALL;sc_start SC_DECREASEAGI,300000,10;percentheal 100,100;nude;atcommand "@storeall";warp "quiz_01",42,369;end;break;case 2:mes "[^0000FFZombie Vs. Novice^000000]";mes "It is good, come, when want.";close;break;NO:mes "[^0000FFZombie Vs. Novice^000000]";mes "You not novice 1 level";close;}OnInit:disablenpc "Novice vs. Zombie";disablenpc "Prize";disablenpc "Prize";end;}

 

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I recommend to make it more readable and fix some quirks first.

 

Some things i see:

1. Prize is disabled twice in OnInit.

2. Call killmonsterall is called several times in succession even though one time is enough per condition.

3. atcommand("@alive"); doesn't need the username, since it's called like the player typed it by himself with gm level 99 and @alive by default revives the user that typed the command if no name is provided.

4. You can change:

if (BaseLevel > 1) goto NO;if (class == 0) goto event;if (class > 0) goto NO;event:

to

if (BaseLevel > 1) goto NO;

that actually means: IF baselevel > 1 > 0 GOTO NO. You dont need another label for your event since if either conditions are true the interpreter jumps to NO and never runs the stuff after the if. Also a base level > 1 char doesn't posses a class you need to check for.

5. You can change:

if (sex == 1) {announce "In ' Zombie Vs. Novice ' has won" + strcharinfo (0) + "! We congratulate him!",0;}else {announce "In ' Zombie Vs. Novice ' has won" + strcharinfo (0) + "! We congratulate her!",0;};

to

announce "In ' Zombie Vs. Novice ' has won" + strcharinfo (0) + "! We congratulate " + ((Sex) ? "him" : "her") + "!",0;

.6. Since you have a npctimer anyway, you could use it for your announcement timing instead of sleep.

7. You can change:

OnTimer5000:if ( getmapusers("quiz_01") == 0 ){killmonsterall "quiz_01";announce "'Zombie Vs. Novice' has ended with Event, as all have died",0;disablenpc "Prize";stopnpctimer;end;}else if ( getmapusers("quiz_01") > 1 ){mapannounce "quiz_01",getmapusers("quiz_01") +"the player still survive on Event.",0,0x00FF00;;initnpctimer;end;}initnpctimer;end;

to

OnTimer5000:	if ( getmapusers("quiz_01") == 0 ) {		killmonsterall "quiz_01";		announce "'Zombie Vs. Novice' has ended with Event, as all have died",0;		disablenpc "Prize";		stopnpctimer;		end;	} 		if ( getmapusers("quiz_01") > 1 )		mapannounce "quiz_01",getmapusers("quiz_01") +"the player still survive on Event.",0,0x00FF00;	initnpctimer;end;

8. The killmonsterall at the event start is redudant since either they get killed by your checks anyway.

9. You can change

OnPCDieEvent:getmapxy .@mapnvz$,.@xnvz,.@ynvz,0;if ( .@mapnvz$ == "quiz_01") {sleep2 1;warp "prontera",154,95;atcommand "@alive "+ strcharinfo(0);dispbottom "you have lost...";}sleep2 1000;if(getmapusers("quiz_01") == 1){killmonsterall "quiz_01";mapannounce "quiz_01","You have won, approach please to npc Prize.",0;killmonsterall "quiz_01";killmonsterall "quiz_01";killmonsterall "quiz_01";killmonsterall "quiz_01";enablenpc "Prize";killmonsterall "quiz_01";stopnpctimer;end;}if(getmapusers("quiz_01") == 0){killmonsterall "quiz_01";killmonsterall "quiz_01";killmonsterall "quiz_01";killmonsterall "quiz_01";stopnpctimer;end;}end;}

to:

OnPCDieEvent:	if ( strcharinfo(PC_MAP) == "quiz_01") {		warp("prontera",154,95);		atcommand("@alive");		dispbottom("you have lost...");	}	if(getmapusers("quiz_01") == 1){		killmonsterall("quiz_01");		announce("You have won, approach please to npc Prize.", bc_map);		enablenpc("Prize");		stopnpctimer;	}end;

10. The var sex has to be named Sex, it won't break your script but drop a error message on the server.

I gave it a shot and tried to clean it, let me know how it works out: http://pastebin.com/HNnpL42L

Edited by Winterfox

Share this post


Link to post
Share on other sites
  • 0

@@Winterfox Hi there, Thanks for cleaning my script. I will still try your script. but I added this

if( getmapusers("quiz_01") == 0 ){                        killmonsterall("quiz_01");                        .nvzEventRunning = 0;                }

is it correct?

I'll reply again to this topic if It's working perfect. thank you

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.