Jump to content
  • 0

Help to complete my script


Question

Posted (edited)

A 2 days ago i started a new script for a server i play, but, im a little "newbie" at it, so, somethings dont happen as we want...

The script r working and im get 0 mapserver errors with, but, a little part of the script (one of most important) isnt work! 

Edit: I want the script "kick" players in the listed maps when they reach the max level that i set for each one. (Currently script simple kick everyone that reach the lvl in a world-wide maps.)

Here the full code:

Spoiler

Full script content removed.

And here the part of scripting that i have no idea how to make it work:

Spoiler

//================================================================================================
//
// ==================================== NPC Padrao % Feats  ====================================
//
//================================================================================================
-	script	OnFeatures	-1,{
OnInit:
	setarray .blvl$[0],111,121,131,141,151,161;
	.blvl = getarraysize(.blvl$);
	for ( .@i = 0; .@i < .blvl; .@i++) {
		.@blvl$ = .blvl$[.@i];
	}
	end;
	setarray .maps$[0],"moc_fild04","moc_fild05","moc_fild06","moc_fild08","moc_fild09","moc_fild10","moc_fild14","moc_fild15";
	.maps = getarraysize(.maps$);
	for ( .@i = 0;	.@i < .maps; .@i++) {
		.@map$ = .maps$[.@i];
		setmapflag .@map$,mf_loadevent;
	}
	end;
	
OnPCLoadMapEvent:
	for ( .@i = 0; .@i < .maps; .@i++) {
		if(strcharinfo(3) == .maps$[.@i]) {
			mes "[^ff0000Ajudante^000000]";
			mes "Bom up!";
			close2;
			percentheal 100,100;
			sc_start SC_FOOD_STR_CASH,36000000,7;
			sc_start SC_FOOD_AGI_CASH,36000000,7;
			sc_start SC_FOOD_INT_CASH,36000000,7;
			sc_start SC_FOOD_VIT_CASH,36000000,7;
			sc_start SC_FOOD_DEX_CASH,36000000,7;
			sc_start SC_FOOD_LUK_CASH,36000000,7;
		}
	}
	end;
	
OnPCBaseLvUpEvent:
	for ( .@i = 0; .@i < .blvl; .@i++) {
		if(strcharinfo(3) == .maps$[.@i] && BaseLevel == .@blvl$[.@i]) {
		initnpctimer;
		mes "[^ff0000Alerta^000000]";
		mes "Voce alcançou o nivel maximo";
		mes "desse mapa!";
		mes " ";
		mes "Voce sera teleportado em 5 segundos!";
		OnTimer5000:
		stopnpctimer;
		mes "[^ff0000Alerta^000000]";
		mes "Ate mais!";
		detachnpctimer;
		warp "prontera",157,173;
		end;
		}
	}
}
-	script	Manager::Ajudante	-1,{
		mes "[^ff0000Ajudante^000000]";
		mes "Em que posso ajudar?";
		if(select("~ Quero me Buffar!:~ Quero voltar!")) {
			mes "[^ff0000Ajudante^000000]";
			mes "Ok... La vai!";
			close2;
			sc_start SC_FOOD_STR_CASH,18000000,7;
			sc_start SC_FOOD_AGI_CASH,18000000,7;
			sc_start SC_FOOD_INT_CASH,18000000,7;
			sc_start SC_FOOD_VIT_CASH,18000000,7;
			sc_start SC_FOOD_DEX_CASH,18000000,7;
			sc_start SC_FOOD_LUK_CASH,18000000,7;	
		} else {
			mes "[^ff0000Ajudante^000000]";
			mes "Certo, volte sempre!";
			close2;
			warp "prontera",157,173;			
		}
		end;
}

 

 

Thx for all will try to help me :D  and pls ignore the language of script(and my english lol).

Edited by Rizta
forget some details

11 answers to this question

Recommended Posts

  • 1
Posted (edited)
OnInit:
	setarray .blvl$[0],111,121,131,141,151,161;
	.blvl = getarraysize(.blvl$);
	for ( .@i = 0; .@i < .blvl; .@i++) {
		.@blvl$ = .blvl$[.@i];
	}
	end;
	setarray .maps$[0],"moc_fild04","moc_fild05","moc_fild06","moc_fild08","moc_fild09","moc_fild10","moc_fild14","moc_fild15";
	.maps = getarraysize(.maps$);
	for ( .@i = 0;	.@i < .maps; .@i++) {
		.@map$ = .maps$[.@i];
		setmapflag .@map$,mf_loadevent;
	}
	end;

here you are ending before you setting the maps array

 

OnPCBaseLvUpEvent:
	for ( .@i = 0; .@i < .blvl; .@i++) {
		if(strcharinfo(3) == .maps$[.@i] && BaseLevel == .@blvl$[.@i]) {

.@blvl$ must be .blvl$ ?

this will kick the players only if they are at level (element .@i) where the map is also .@i so it's the first element of the array level and map || 2nd element from level and map etc i think it's intended ?'

and use close; why you use close2; ?

 

for ( .@i = 0;	.@i < .maps; .@i++) {
		.@map$ = .maps$[.@i];
		setmapflag .@map$,mf_loadevent;
	}

and not sure about this 

i would suggest you remove it and set the mapflag outside the script

like that

moc_fild04	mapflag	loadevent
moc_fild05	mapflag	loadevent
moc_fild06	mapflag	loadevent
moc_fild08	mapflag	loadevent
moc_fild09	mapflag	loadevent
moc_fild10	mapflag	loadevent
moc_fild14	mapflag	loadevent
moc_fild15	mapflag	loadevent

 

Edited by sader1992
  • 0
Posted (edited)
16 minutes ago, sader1992 said:

OnInit:
	setarray .blvl$[0],111,121,131,141,151,161;
	.blvl = getarraysize(.blvl$);
	for ( .@i = 0; .@i < .blvl; .@i++) {
		.@blvl$ = .blvl$[.@i];
	}
	end;
	setarray .maps$[0],"moc_fild04","moc_fild05","moc_fild06","moc_fild08","moc_fild09","moc_fild10","moc_fild14","moc_fild15";
	.maps = getarraysize(.maps$);
	for ( .@i = 0;	.@i < .maps; .@i++) {
		.@map$ = .maps$[.@i];
		setmapflag .@map$,mf_loadevent;
	}
	end;

here you are ending before you setting the maps array

lol... its my only mistake? 

 

Edit: Ok, it isnt my only mistake.

 

Now i got this when i level up to 111 in map 1(moc_fild04)

[Error]: script:op_2: invalid data for operator C_EQ
[Debug]: Data: number value=111
[Debug]: Data: string value=""
[Debug]: Source (NPC): OnFeatures (invisible/not on a map)

My currently labels:

 

Spoiler

-	script	OnFeatures	-1,{
OnInit:
	setarray .blvl$[0],111,121,131,141,151,161;
	.blvl = getarraysize(.blvl$);
	for ( .@j = 0; .@j < .blvl; .@j++) {
		.@blvl$ = .blvl$[.@j];
	}
	setarray .maps$[0],"moc_fild04","moc_fild05","moc_fild06","moc_fild08","moc_fild09","moc_fild10","moc_fild14","moc_fild15";
	.maps = getarraysize(.maps$);
	for ( .@i = 0; .@i < .maps; .@i++) {
		.@map$ = .maps$[.@i];
		setmapflag .@map$,mf_loadevent;
	}
	end;
	
OnPCLoadMapEvent:
		if(strcharinfo(3) == .maps$[.@i]) {
			mes "[^ff0000Ajudante^000000]";
			mes "Bom up!";
			close2;
			percentheal 100,100;
			sc_start SC_FOOD_STR_CASH,36000000,7;
			sc_start SC_FOOD_AGI_CASH,36000000,7;
			sc_start SC_FOOD_INT_CASH,36000000,7;
			sc_start SC_FOOD_VIT_CASH,36000000,7;
			sc_start SC_FOOD_DEX_CASH,36000000,7;
			sc_start SC_FOOD_LUK_CASH,36000000,7;
		}
		end;
	
OnPCBaseLvUpEvent:
		if(strcharinfo(3) == .maps$[.@i] && BaseLevel == .@blvl$[.@j]) {
		mes "[^ff0000Alerta^000000]";
		mes "Voce alcançou o nivel maximo";
		mes "desse mapa!";
		mes " ";
		mes "Voce sera teleportado em 5 segundos!";
		warp "prontera",157,173;
		end;
		}
}
-	script	Manager::Ajudante	-1,{
		mes "[^ff0000Ajudante^000000]";
		mes "Em que posso ajudar?";
		if(select("~ Quero me Buffar!:~ Quero voltar!")) {
			mes "[^ff0000Ajudante^000000]";
			mes "Ok... La vai!";
			close2;
			sc_start SC_FOOD_STR_CASH,18000000,7;
			sc_start SC_FOOD_AGI_CASH,18000000,7;
			sc_start SC_FOOD_INT_CASH,18000000,7;
			sc_start SC_FOOD_VIT_CASH,18000000,7;
			sc_start SC_FOOD_DEX_CASH,18000000,7;
			sc_start SC_FOOD_LUK_CASH,18000000,7;	
		} else {
			mes "[^ff0000Ajudante^000000]";
			mes "Certo, volte sempre!";
			close2;
			warp "prontera",157,173;			
		}
		end;
}

 

And now warp from NPC isnt working :( 

Edited by Rizta
more information
  • 0
Posted
4 minutes ago, Rizta said:

lol... its my only mistake? 

i just seen the second part so i don't know if the full script have some warning (and i update my reply sorry i normally type something then edit it ) x.x

 

  • 0
Posted (edited)

try this

//================================================================================================
//
// ==================================== NPC Padrao % Feats  ====================================
//
//================================================================================================
-	script	OnFeatures	-1,{
OnInit:
	setarray .blvl,111,121,131,141,151,161;
	setarray .maps$,"moc_fild04","moc_fild05","moc_fild06","moc_fild08","moc_fild09","moc_fild10","moc_fild14","moc_fild15";
end;
OnPCLoadMapEvent:
	for ( .@i = 0; .@i < getarraysize(.maps$); .@i++) {
		if(strcharinfo(3) == .maps$[.@i]) {
			percentheal 100,100;
			sc_start SC_FOOD_STR_CASH,36000000,7;
			sc_start SC_FOOD_AGI_CASH,36000000,7;
			sc_start SC_FOOD_INT_CASH,36000000,7;
			sc_start SC_FOOD_VIT_CASH,36000000,7;
			sc_start SC_FOOD_DEX_CASH,36000000,7;
			sc_start SC_FOOD_LUK_CASH,36000000,7;
			mes "[^ff0000Ajudante^000000]";
			mes "Bom up!";
			close;
		}
	}
end;
	
OnPCBaseLvUpEvent:
	for ( .@i = 0; .@i < getarraysize(.blvl); .@i++) {
		if(strcharinfo(3) == .maps$[.@i] && BaseLevel == .blvl[.@i]) {
		mes "[^ff0000Alerta^000000]";
		mes "Voce alcançou o nivel maximo";
		mes "desse mapa!";
		mes " ";
		mes "Voce sera teleportado em 5 segundos!";
		close2;
		warp "prontera",157,173;
		}
	}
end;
}
-	script	Manager::Ajudante	-1,{
		mes "[^ff0000Ajudante^000000]";
		mes "Em que posso ajudar?";
		if(select("~ Quero me Buffar!:~ Quero voltar!") == 1) {
			mes "[^ff0000Ajudante^000000]";
			mes "Ok... La vai!";
			sc_start SC_FOOD_STR_CASH,18000000,7;
			sc_start SC_FOOD_AGI_CASH,18000000,7;
			sc_start SC_FOOD_INT_CASH,18000000,7;
			sc_start SC_FOOD_VIT_CASH,18000000,7;
			sc_start SC_FOOD_DEX_CASH,18000000,7;
			sc_start SC_FOOD_LUK_CASH,18000000,7;	
			close;
		} else {
			mes "[^ff0000Ajudante^000000]";
			mes "Certo, volte sempre!";
			close2;
			warp "prontera",157,173;			
		}
		end;
}
moc_fild04	mapflag	loadevent
moc_fild05	mapflag	loadevent
moc_fild06	mapflag	loadevent
moc_fild08	mapflag	loadevent
moc_fild09	mapflag	loadevent
moc_fild10	mapflag	loadevent
moc_fild14	mapflag	loadevent
moc_fild15	mapflag	loadevent

 

Edited by sader1992
  • Upvote 1
  • 0
Posted
18 minutes ago, sader1992 said:

i just seen the second part so i don't know if the full script have some warning (and i update my reply sorry i normally type something then edit it ) x.x

 

Ok, i dont know if i understand you, so i try somethings based on what u said and nothing work.

Currently Script:

-	script	OnFeatures	-1,{
OnInit:
	setarray .blvl$[0],111,121,131,141,151,161;
	.blvl = getarraysize(.blvl$);
	for ( .@j = 0; .@j < .blvl; .@j++) {
		.@blvl$ = .blvl$[.@j];
	}
	setarray .maps$[0],"moc_fild04","moc_fild05","moc_fild06","moc_fild08","moc_fild09","moc_fild10","moc_fild14","moc_fild15";
	.maps = getarraysize(.maps$);
	for ( .@i = 0; .@i < .maps; .@i++) {
		.@map$ = .maps$[.@i];
	}
	end;
	
OnPCLoadMapEvent:
		if(strcharinfo(3) == .maps$[.@i]) {
			mes "[^ff0000Ajudante^000000]";
			mes "Bom up!";
			close;
			percentheal 100,100;
			sc_start SC_FOOD_STR_CASH,36000000,7;
			sc_start SC_FOOD_AGI_CASH,36000000,7;
			sc_start SC_FOOD_INT_CASH,36000000,7;
			sc_start SC_FOOD_VIT_CASH,36000000,7;
			sc_start SC_FOOD_DEX_CASH,36000000,7;
			sc_start SC_FOOD_LUK_CASH,36000000,7;
		}
		end;
	
OnPCBaseLvUpEvent:
		if(BaseLevel == .@blvl$[.@j] || strcharinfo(3) == .@map$[.@i]) {
		mes "[^ff0000Alerta^000000]";
		mes "Voce alcançou o nivel maximo";
		mes "desse mapa!";
		mes " ";
		mes "Voce sera teleportado em 5 segundos!";
		warp "prontera",157,173;
		end;
		}
	}

-	script	Manager::Ajudante	-1,{
		mes "[^ff0000Ajudante^000000]";
		mes "Em que posso ajudar?";
		if(select("~ Quero me Buffar!:~ Quero voltar!")) {
			mes "[^ff0000Ajudante^000000]";
			mes "Ok... La vai!";
			close;
			sc_start SC_FOOD_STR_CASH,18000000,7;
			sc_start SC_FOOD_AGI_CASH,18000000,7;
			sc_start SC_FOOD_INT_CASH,18000000,7;
			sc_start SC_FOOD_VIT_CASH,18000000,7;
			sc_start SC_FOOD_DEX_CASH,18000000,7;
			sc_start SC_FOOD_LUK_CASH,18000000,7;	
		} else {
			mes "[^ff0000Ajudante^000000]";
			mes "Certo, volte sempre!";
			close;
			warp "prontera",157,173;			
		}
		end;
	}

Still not kicking player when reach level 111, 121, 131, 141, 151 or 161 and NPC still not warping too.

  • 1
Posted

try the script above and for the npc i did edit it above too 

if(select("~ Quero me Buffar!:~ Quero voltar!")) {

to 

if(select("~ Quero me Buffar!:~ Quero voltar!")==1) {

  • 0
Posted
4 minutes ago, sader1992 said:

try this


//================================================================================================
//
// ==================================== NPC Padrao % Feats  ====================================
//
//================================================================================================
-	script	OnFeatures	-1,{
OnInit:
	setarray .blvl,111,121,131,141,151,161;
	setarray .maps$,"moc_fild04","moc_fild05","moc_fild06","moc_fild08","moc_fild09","moc_fild10","moc_fild14","moc_fild15";
end;
OnPCLoadMapEvent:
	for ( .@i = 0; .@i < getarraysize(.maps$); .@i++) {
		if(strcharinfo(3) == .maps$[.@i]) {
			percentheal 100,100;
			sc_start SC_FOOD_STR_CASH,36000000,7;
			sc_start SC_FOOD_AGI_CASH,36000000,7;
			sc_start SC_FOOD_INT_CASH,36000000,7;
			sc_start SC_FOOD_VIT_CASH,36000000,7;
			sc_start SC_FOOD_DEX_CASH,36000000,7;
			sc_start SC_FOOD_LUK_CASH,36000000,7;
			mes "[^ff0000Ajudante^000000]";
			mes "Bom up!";
			close;
		}
	}
end;
	
OnPCBaseLvUpEvent:
	for ( .@i = 0; .@i < getarraysize(.blvl); .@i++) {
		if(strcharinfo(3) == .maps$[.@i] && BaseLevel == .blvl[.@i]) {
		mes "[^ff0000Alerta^000000]";
		mes "Voce alcançou o nivel maximo";
		mes "desse mapa!";
		mes " ";
		mes "Voce sera teleportado em 5 segundos!";
		close2;
		warp "prontera",157,173;
		}
	}
end;
}
-	script	Manager::Ajudante	-1,{
		mes "[^ff0000Ajudante^000000]";
		mes "Em que posso ajudar?";
		if(select("~ Quero me Buffar!:~ Quero voltar!")) {
			mes "[^ff0000Ajudante^000000]";
			mes "Ok... La vai!";
			sc_start SC_FOOD_STR_CASH,18000000,7;
			sc_start SC_FOOD_AGI_CASH,18000000,7;
			sc_start SC_FOOD_INT_CASH,18000000,7;
			sc_start SC_FOOD_VIT_CASH,18000000,7;
			sc_start SC_FOOD_DEX_CASH,18000000,7;
			sc_start SC_FOOD_LUK_CASH,18000000,7;	
			close;
		} else {
			mes "[^ff0000Ajudante^000000]";
			mes "Certo, volte sempre!";
			close2;
			warp "prontera",157,173;			
		}
		end;
}
moc_fild04	mapflag	loadevent
moc_fild05	mapflag	loadevent
moc_fild06	mapflag	loadevent
moc_fild08	mapflag	loadevent
moc_fild09	mapflag	loadevent
moc_fild10	mapflag	loadevent
moc_fild14	mapflag	loadevent
moc_fild15	mapflag	loadevent

 

Ok, it worked o-O   ill try to learn with ur corrections XDD

So one problem still happening:

The second NPC (Manager) still not warping :(

  • 0
Posted (edited)
5 minutes ago, sader1992 said:

try the script above and for the npc i did edit it above too 

if(select("~ Quero me Buffar!:~ Quero voltar!")) {

to 

if(select("~ Quero me Buffar!:~ Quero voltar!")==1) {

Ok, lemme try D

Edit: All things r "magically" working now! 

Thx alot sader, you r always helping me :D 

 

Some mod/staff can close the topic :)

Edited by Rizta
Results from testing
  • 0
Posted

you welcome but to make sure did you intend to kick the players level 111 only in moc_fild04 and 121 only in moc_fild05 and 131 only in moc_fild06 etc ?

  • Love 1
  • 0
Posted (edited)
1 hour ago, sader1992 said:

you welcome but to make sure did you intend to kick the players level 111 only in moc_fild04 and 121 only in moc_fild05 and 131 only in moc_fild06 etc ?

Thanks! And yes... consider it as an "instance" and when player reach lvl 111 they need to be kicked once the "instances" is separed to levels. 

Lv 100-110 = moc_fild04

Lv 110-120 = moc_fild05 and etc..

And now i got this from nothing in map server O_o: Detected unsupported UTF-8 BOM in file <- wtf is this?

Edited by Rizta
  • 0
Posted
27 minutes ago, Rizta said:

And now i got this from nothing in map server O_o: Detected unsupported UTF-8 BOM in file <- wtf is this?

i think this from the language in mes 

the Enicoding

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...