Jump to content
  • 0

Variable problem with my 2 scripts


leertaste

Question


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  137
  • Reputation:   1
  • Joined:  02/02/13
  • Last Seen:  

I'm kinda confused xD

i wrote this 2 scripts and could need some help with it:

 

prontera,146,76,5	script	Event Warper	909,{

	set .@name$,"[Warper]";

if(@FTPChance>=3){
	mes .@name$;
	mes "You have left your 3 chances! Good luck next time!";
	close;
}

if(@characcessFTP == 1){
	mes .@name$;
	mes "You got warped once! Try again next time!";
	close;
}

	if ($accessFTP == 0) goto L_PraceOff;

	mes .@name$;
	mes "Would you like to be warped onto the find the poring map?";
	menu "Yes, please!",-,"No, thanks.",L_Cancel;
	close2;
	warp "pvp_y_1-5",0,0;
	set @characcessFTP,1;
	end;

L_Cancel:
	mes .@name$;
	mes "Ok, bye.";
	close;

L_PraceOff:
	set @Hour, gettime(3);
	set @Minute, gettime(2);
	set @FTPTime, gettime(3) + 4;
	if (gettime(3) == 1) set @FTPTime, @FTPTime-1;
	if (gettime(3) == 2) set @FTPTime, @FTPTime-2;
	if (gettime(3) == 3) set @FTPTime, @FTPTime-3;
	if (gettime(3) == 5) set @FTPTime, @FTPTime-1;
	if (gettime(3) == 6) set @FTPTime, @FTPTime-2;
	if (gettime(3) == 7) set @FTPTime, @FTPTime-3;
	if (gettime(3) == 9) set @FTPTime, @FTPTime-1;
	if (gettime(3) == 10) set @FTPTime, @FTPTime-2;
	if (gettime(3) == 11) set @FTPTime, @FTPTime-3;
	if (gettime(3) == 13) set @FTPTime, @FTPTime-1;
	if (gettime(3) == 14) set @FTPTime, @FTPTime-2;
	if (gettime(3) == 15) set @FTPTime, @FTPTime-3;
	if (gettime(3) == 17) set @FTPTime, @FTPTime-1;
	if (gettime(3) == 18) set @FTPTime, @FTPTime-2;
	if (gettime(3) == 19) set @FTPTime, @FTPTime-3;
	if (gettime(3) == 21) set @FTPTime, @FTPTime-1;
	if (gettime(3) == 22) set @FTPTime, @FTPTime-2;
	if (gettime(3) == 23) set @FTPTime, @FTPTime-3;
	mes .@name$;
	mes "Find the Poring is closed right now..";
	mes "The next Event starts on "+@FTPTime+".";
	mes "And right now it is "+@Hour+":"+@Minute+".";
	close;
}
prontera.gat,0,0,0	script	FTPoring	-1,{

OnClock0000:
OnClock0400:
OnClock0800:
OnClock1200:
OnClock1653:
OnClock2000:
	announce "Find the Poring is now started!",0;
	monster "pvp_y_1-5",0,0,"Drops",1113,1000,"FTP_Sys::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Marin",1242,1000,"FTP_Sys::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Santa Poring",1062,1000,"FTP_Sys::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Metaling",1613,1000,"FTP_Sys::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Stapo",1784,1000,"FTP_Sys::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Poring",1002,1,"FTP_Sys::OnWinMobDeath";
	enablenpc "FTP_Sys";
	set $accessFTP,1;
	end;
}

pvp_y_1-5,0,0,5	script	FTP_Sys	-1,{
end;
OnMobDeath:
	set @FTPChance,@FTPChance+1;
	if(@FTPChance>=3){ warp "prontera",156,98; dispbottom "You've run out of chances!"; end; }
	dispbottom "Wrong Monster! You have "+(3-@FTPChance)+" chance's left";
	end;
	
OnWinMobDeath:
	mapannounce "pvp_y_1-5","["+strcharinfo(0)+"] has found the poring! The Event is over!",0;
	GetItem( 20002, 3 );
	mapwarp "pvp_y_1-5","prontera",156,98;
	killmonsterall "pvp_y_1-5";
	set $accessFTP,0;
	set @FTPChance,0;
	disablenpc "FTP_Sys";
}

What i want:

I want the chances (@FTPChance) to be resetted FOR EVERY CHAR (not only for the winner) after the event is over

also another problem i've got
those variables are temp. variables.. so when i relog, im able to warp back to the event again

Help please!

Edited by leertaste
Link to comment
Share on other sites

11 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

But when i add more events where the one eventwarper should warp me at, it's easier to configure... or am i wrong?

If you want to add more than the poring event you're right, like an all-in-one event manager

 

But you must to delete the array on the 1st NPC, I suggest donpcevent and getvariableofnpc

 

prontera,146,76,5	script	Event Warper	909,{

	set .@name$,"[Warper]";

	if( select( "Enter", "Cancel " ) -1 ) {
		mes .@name$;
		mes "See ya";
		close;
	}
	else if( .accessFTP == 0 ) {
		set .@Hour, gettime(3);
		set .@Minute, gettime(2);
		set .@FTPTime, gettime(3) + 4;
		if( gettime(3)%4 == 1 ) set .@FTPTime, .@FTPTime-1;
		if(gettime(3)%4 == 2) set .@FTPTime, .@FTPTime-2;
		if(gettime(3)%4 == 3) set .@FTPTime, .@FTPTime-3;

		mes .@name$;
		mes "Find the Poring is closed right now..";
		mes "The next Event starts on "+ .@FTPTime +".";
		mes "And right now it is "+ .@Hour +":"+ .@Minute +".";
		close;
	}
	else if( .register_num >= 128 ) { // room FULL
		mes .@name$;
		mes "I'm sorry but this Event is FULL.";
		mes "Maximum users to enter is 128 players.";
		close;
	}

	for( set .@i, 0; .@i < .register_num; set .@i, .@i + 1 ) {
		if( .register_aid[.@i] == getcharid(3) ) {
			mes .@name$;
			mes "You got warped once! Try again next time!";
			close;
		}
	}
	warp "pvp_y_1-5",0,0;
	set @FTPChance, 0;
	set .register_aid[ .register_num ], getcharid(3);
	set .register_num, .register_num + 1;
	end;

OnReset:
	deletearray .register_aid;
	set .register_num, 0;
	end;
}

-	script	FTPoring	-1,{

OnClock0000:
OnClock0400:
OnClock0800:
OnClock1200:
OnClock1653:
OnClock2000:
	announce "Find the Poring is now started!",0;
	killmonsterall "pvp_y_1-5";
	monster "pvp_y_1-5",0,0,"Drops",1113,1000,"FTPoring::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Marin",1242,1000,"FTPoring::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Santa Poring",1062,1000,"FTPoring::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Metaling",1613,1000,"FTPoring::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Stapo",1784,1000,"FTPoring::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Poring",1002,1,"FTPoring::OnWinMobDeath";
	mapwarp "pvp_y_1-5","prontera",156,98;
	set getvariableofnpc( .accessFTP, "Event Warper" ),1;
	donpcevent "Event Warper::OnReset";
	end;

OnMobDeath:
	set @FTPChance,@FTPChance+1;
	if(@FTPChance>=3){ warp "prontera",156,98; dispbottom "You've run out of chances!"; end; }
	dispbottom "Wrong Monster! You have "+(3-@FTPChance)+" chance's left";
	end;
	
OnWinMobDeath:
	mapannounce "pvp_y_1-5","["+strcharinfo(0)+"] has found the poring! The Event is over!",0;
	GetItem( 20002, 3 );
	mapwarp "pvp_y_1-5","prontera",156,98;
	killmonsterall "pvp_y_1-5";
	set @FTPChance,0;
	set getvariableofnpc( .accessFTP, "Event Warper" ), 0;
        donpcevent "Event Warper::OnReset";
	end;
}

 

set getvariableofnpc( .accessFTP, "Event Warper" ), 0;

will put variable .accessFTP in the "Event Warper" to 0

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


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Like this ?
 

 

prontera,146,76,5 script Event Warper 909,{

set .@name$,"[Warper]";

if( select( "Enter", "Cancel " ) -1 ) {
mes .@name$;
mes "See ya.";
close;
}
else if( .accessFTP == 0 ) {
set .@Hour, gettime(3);
set .@Minute, gettime(2);
set .@FTPTime, gettime(3) + 4;
set .@FTPTime, .@FTPTime- gettime(3)%4;


mes .@name$;
mes "Find the Poring is closed right now..";
mes "The next Event starts on "+ .@FTPTime +".";
mes "And right now it is "+ .@Hour +":"+ .@Minute +".";
close;
}
else if( .register_num >= 128 ) { // room FULL
mes .@name$;
mes "I'm sorry but this Event is FULL.";
mes "Maximum users to enter is 128 players.";
close;
}

for( .@i = 0; .@i < .register_num; .@i++ ) {
if( .register_aid[.@i] == getcharid(3) ) {
mes .@name$;
mes "You got warped once! Try again next time!";
close;
}
}
warp "pvp_y_1-5",0,0;
@FTPChance = 0;
.register_aid[ .register_num ] = getcharid(3);
.register_num++;
end;

// debug
// OnInit:
OnClock0000:
OnClock0400:
OnClock0800:
OnClock1200:
OnClock1653:
OnClock2000:
announce "Find the Poring is now started!",0;
monster "pvp_y_1-5",0,0,"Drops",1113,1000,"Event Warper::OnMobDeath";
monster "pvp_y_1-5",0,0,"Marin",1242,1000,"Event Warper::OnMobDeath";
monster "pvp_y_1-5",0,0,"Santa Poring",1062,1000,"Event Warper::OnMobDeath";
monster "pvp_y_1-5",0,0,"Metaling",1613,1000,"Event Warper::OnMobDeath";
monster "pvp_y_1-5",0,0,"Stapo",1784,1000,"Event Warper::OnMobDeath";
monster "pvp_y_1-5",0,0,"Poring",1002,1,"Event Warper::OnWinMobDeath";
set .accessFTP,1;

deletearray .register_aid;
.register_num = 0;
mapwarp "pvp_y_1-5","prontera",156,98;
killmonsterall "pvp_y_1-5";
end;

OnMobDeath:
set @FTPChance,@FTPChance+1;
if(@FTPChance>=3){ warp "prontera",156,98; dispbottom "You've run out of chances!"; end; }
dispbottom "Wrong Monster! You have "+(3-@FTPChance)+" chance's left";
end;

OnWinMobDeath:
mapannounce "pvp_y_1-5","["+strcharinfo(0)+"] has found the poring! The Event is over!",0;
GetItem( 20002, 3 );
mapwarp "pvp_y_1-5","prontera",156,98;
killmonsterall "pvp_y_1-5";
set @FTPChance,0;
deletearray .register_aid;
.register_num = .accessFTP = 0;
end;
}
 

 




@FTPChance is reset when another event start and if the player can enter
His account id is save in an array and he can't re-enter for the same event
.register_aid[ .register_num ] = getcharid(3);

For the set .@FTPTime, .@FTPTime- gettime(3)%4; instead of
 

 

if (gettime(3) == 1) set @FTPTime, @FTPTime-1;
if (gettime(3) == 2) set @FTPTime, @FTPTime-2;
if (gettime(3) == 3) set @FTPTime, @FTPTime-3;
if (gettime(3) == 5) set @FTPTime, @FTPTime-1;
if (gettime(3) == 6) set @FTPTime, @FTPTime-2;
if (gettime(3) == 7) set @FTPTime, @FTPTime-3;
 

 



etc.. gettime(3)%4 is the remainder of gettime(3)/4 for example if gettime(3) == 1 then gettime(3)/4 == 0 and the remainder gettime(3)%4 is 1

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


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  137
  • Reputation:   1
  • Joined:  02/02/13
  • Last Seen:  

This is what i got:

 

[Error]:  Loading NPC file: npc/own/findtheporing.txt
script error on npc/own/findtheporing.txt line 30
    parse_line: expect command, missing function name or calling undeclared func
tion
    25 : mes "I'm sorry but this Event is FULL.";
    26 : mes "Maximum users to enter is 128 players.";
    27 : close;
    28 : }
    29 :
*   30 : for( '.'@i = 0; .@i < .register_num; .@i++ ) {
    31 : if( .register_aid[.@i] == getcharid(3) ) {
    32 : mes .@name$;
    33 : mes "You got warped once! Try again next time!";
    34 : close;
    35 : }
Edited by leertaste
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

You are an eAthena user, try this

prontera,146,76,5	script	Event Warper	909,{

	set .@name$,"[Warper]";

	if( select( "Enter", "Cancel " ) -1 ) {
		mes .@name$;
		mes "See ya";
		close;
	}
	else if( .accessFTP == 1 ) {
		set .@Hour, gettime(3);
		set .@Minute, gettime(2);
		set .@FTPTime, gettime(3) + 4;
		if( gettime(3)%4 == 1 ) set .@FTPTime, .@FTPTime-1;
		if(gettime(3)%4 == 2) set .@FTPTime, .@FTPTime-2;
		if(gettime(3)%4 == 3) set .@FTPTime, .@FTPTime-3;

		mes .@name$;
		mes "Find the Poring is closed right now..";
		mes "The next Event starts on "+ .@FTPTime +".";
		mes "And right now it is "+ .@Hour +":"+ .@Minute +".";
		close;
	}
	else if( .register_num >= 128 ) { // room FULL
		mes .@name$;
		mes "I'm sorry but this Event is FULL.";
		mes "Maximum users to enter is 128 players.";
		close;
	}

	for( set .@i, 0; .@i < .register_num; set .@i, .@i + 1 ) {
		if( .register_aid[.@i] == getcharid(3) ) {
			mes .@name$;
			mes "You got warped once! Try again next time!";
			close;
		}
	}
	warp "pvp_y_1-5",0,0;
	set @FTPChance, 0;
	set .register_aid[ .register_num ], getcharid(3);
	set .register_num, .register_num + 1;
	end;


OnClock0000:
OnClock0400:
OnClock0800:
OnClock1200:
OnClock1653:
OnClock2000:
	announce "Find the Poring is now started!",0;
	monster "pvp_y_1-5",0,0,"Drops",1113,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Marin",1242,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Santa Poring",1062,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Metaling",1613,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Stapo",1784,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Poring",1002,1,"Event Warper::OnWinMobDeath";
	set .accessFTP,1;
	mapwarp "pvp_y_1-5","prontera",156,98;
	killmonsterall "pvp_y_1-5";
	deletearray .register_aid;
	set .register_num, 0;
	end;

OnMobDeath:
	set @FTPChance,@FTPChance+1;
	if(@FTPChance>=3){ warp "prontera",156,98; dispbottom "You've run out of chances!"; end; }
	dispbottom "Wrong Monster! You have "+(3-@FTPChance)+" chance's left";
	end;
	
OnWinMobDeath:
	mapannounce "pvp_y_1-5","["+strcharinfo(0)+"] has found the poring! The Event is over!",0;
	GetItem( 20002, 3 );
	mapwarp "pvp_y_1-5","prontera",156,98;
	killmonsterall "pvp_y_1-5";
	set @FTPChance,0;
	deletearray .register_aid;
	set .register_num, 0;
	set .accessFTP, 0;
	end;
}
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  137
  • Reputation:   1
  • Joined:  02/02/13
  • Last Seen:  

I forgot to tell you.. :x haha

im gonna try this!
thanks alot, ill edit this post

EDIT:

You did something wrong^^

you can enter the arena, when the event is NOT started, but u cant enter, if it is :P

Edited by leertaste
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Lol my bad change

 

else if( .accessFTP == 1 ) {
 

 

to

 

else if( .accessFTP == 0 ) {
 

Promise me you don't see anything

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  137
  • Reputation:   1
  • Joined:  02/02/13
  • Last Seen:  

Yep i knew this.. but i dont recognize anymore, what u'v done there. xD

as u know,

i want to use the eventwarper as a warper, where a variable activates that im able to join the currently running event.
so i need 2 seperate scripts (thats not the problem, i can cut it off from your double part :P)

but: i cant still use the warper and the monster wouldnt spawn hmm..
if you gonna correct this, it would be awesome!

additionaly i will try this with the information you gave me too
post if you'v finished, i also do!

thanks alot by the way for your helP :*
 

i hope u understand me^^

Edited by leertaste
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

i want to use the eventwarper as a warper, where i variable activates that im able to join the currently running event.

so i need 2 seperate scripts (thats not the problem, i can cut it off from your double part :P)

I think you don't need to split the script. The NPC can warp player and hold an event. And you do more work Lol

 

I test on ea then edit wait

 

EDIT:

	announce "Find the Poring is now started!",0;
	monster "pvp_y_1-5",0,0,"Drops",1113,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Marin",1242,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Santa Poring",1062,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Metaling",1613,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Stapo",1784,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Poring",1002,1,"Event Warper::OnWinMobDeath";
	set .accessFTP,1;
	mapwarp "pvp_y_1-5","prontera",156,98;
	killmonsterall "pvp_y_1-5";

should be

	announce "Find the Poring is now started!",0;
	killmonsterall "pvp_y_1-5";
	monster "pvp_y_1-5",0,0,"Drops",1113,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Marin",1242,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Santa Poring",1062,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Metaling",1613,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Stapo",1784,1000,"Event Warper::OnMobDeath";
	monster "pvp_y_1-5",0,0,"Poring",1002,1,"Event Warper::OnWinMobDeath";
	set .accessFTP,1;
	mapwarp "pvp_y_1-5","prontera",156,98;

Seriously I feel so noob today Lol

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


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  137
  • Reputation:   1
  • Joined:  02/02/13
  • Last Seen:  

I think you don't need to split the script. The NPC can warp player and hold an event. And you do more work Lol

 

But when i add more events where the one eventwarper should warp me at, it's easier to configure... or am i wrong?

 

EDIT

Haha! you killed the monsters directly after spawning xDDDD

 

EDIT2

Everything works fine now! thank you so much! :))))

Edited by leertaste
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  137
  • Reputation:   1
  • Joined:  02/02/13
  • Last Seen:  

It's raining reputation xD
Thanks man! :)

 

 

SOLVED

Edited by leertaste
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

You're welcome ;)

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