Jump to content
  • 0
DR4LUC0N

How do I change this script so it shows a dispbottom if the player has a particular variable?

Question

Posted (edited)

I've tried getunits then atachrid but getting confused on how to get it to show the players who have the set variable(#mvpon <= 1) to recieve the dispbottom and if they have #mvpon <= 0 they don't get the dispbottom.

-	script	#mvp_kill	-1,{

OnInit:
	setarray .p_rwd, 607,1;	// Party reward <item>,<amount>
	setarray .s_rwd, 607,1;	// Solo reward <item>,<amount>
	.chance = 50;	// Drop rate chances %
//	.gm = 10;  // Prevents gm level and above to trigger the event
	// MVP Map list
	setarray .t_maps$[0],"moc_pryd06","lhz_dun03","gld2_prt","abbey02","ayo_dun02","lhz_dun04","ra_fild02","xmas_fild01","dic_dun02","beach_dun","iz_dun05","tur_dun04","lhz_dun02","jupe_core","moc_fild22","anthell02","odin_tem03","gon_dun03","gef_fild02","thana_boss","gef_fild10","ein_dun02","gef_fild14","moc_pryd04","dew_dun01","in_sphinx5","niflheim","moc_fild17","xmas_dun02","ice_dun03","kh_dun02","treasure02","moc_prydn2","pay_dun04","ra_san05","mosk_dun03","ama_dun03","thor_v03","gef_dun01","mjolnir_04","abyss_03","dic_dun03","prt_sewb4","pay_fild11","gef_dun02","gl_chyard","ra_fild03","ra_fild04","ve_fild01","ve_fild02","lou_dun03","prt_maze03","bra_dun02";
	end;

OnNPCKillEvent:
//if (getgmlevel() >= .gm ) end; // If gm = event wont happen
if ( getmonsterinfo( killedrid, MOB_MVPEXP )) {
	for ([email protected] = 0; [email protected] < getarraysize(.t_maps$); [email protected]++) {
	if ( strcharinfo(3) == instance_mapname("06guild_01") ) end; 
	if ( strcharinfo(3) == instance_mapname("force_1-1") ) end;
	if ( strcharinfo(3) == .t_maps$[[email protected]]) { 
			if ( getcharid(1) ) {
				getpartymember getcharid(1), 1;
				getpartymember getcharid(1), 2;
				for ( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ) {
					if ( isloggedin( [email protected][[email protected]], [email protected][[email protected]] ) ) { 
						[email protected][[email protected]] = [email protected][[email protected]];
						[email protected]++;
					}
				}
				if (rand(100) < .chance) getitem .p_rwd[0], .p_rwd[1], [email protected][ rand( [email protected] ) ];
				dispbottom "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3);
			}
			else {
				if (rand(100) < .chance) getitem .s_rwd[0], .s_rwd[1];
				dispbottom "[ System ] : Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3);
			}
		MVPKills = MVPKills+1;
		dispbottom "---------------------------------------------------";
		dispbottom "You killed a total of "+MVPKills+" MVP"+((MVPKills == 1)?"":"s")+".";
		dispbottom "---------------------------------------------------";
		end;
		}
	}
	
	if ( getcharid(1) ) {
		dispbottom "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3);
		} 
		else {
		dispbottom "[ System ] : Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3);
		}
	end;
	}
}

 

Edited by DR4LUC0N
Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0
Posted (edited)

you can try something like this.

-	script	#mvp_kill	-1,{

OnInit:
	setarray .p_rwd, 607,1;	// Party reward <item>,<amount>
	setarray .s_rwd, 607,1;	// Solo reward <item>,<amount>
	.chance = 50;	// Drop rate chances %
//	.gm = 10;  // Prevents gm level and above to trigger the event
	// MVP Map list
	setarray .t_maps$[0],"moc_pryd06","lhz_dun03","gld2_prt","abbey02","ayo_dun02","lhz_dun04","ra_fild02","xmas_fild01","dic_dun02","beach_dun","iz_dun05","tur_dun04","lhz_dun02","jupe_core","moc_fild22","anthell02","odin_tem03","gon_dun03","gef_fild02","thana_boss","gef_fild10","ein_dun02","gef_fild14","moc_pryd04","dew_dun01","in_sphinx5","niflheim","moc_fild17","xmas_dun02","ice_dun03","kh_dun02","treasure02","moc_prydn2","pay_dun04","ra_san05","mosk_dun03","ama_dun03","thor_v03","gef_dun01","mjolnir_04","abyss_03","dic_dun03","prt_sewb4","pay_fild11","gef_dun02","gl_chyard","ra_fild03","ra_fild04","ve_fild01","ve_fild02","lou_dun03","prt_maze03","bra_dun02";
	.t_maps_size = getarraysize(.t_maps$);
	end;

OnNPCKillEvent:
	//if (getgmlevel() >= .gm) end; // If gm = event wont happen
	if (strcharinfo(3) == instance_mapname("06guild_01") || strcharinfo(3) == instance_mapname("force_1-1")) end;
	if (getmonsterinfo(killedrid, MOB_MVPEXP)) {
		for ([email protected] = 0; [email protected] < .t_maps_size; [email protected]++) {
			if (strcharinfo(3) == .t_maps$[[email protected]]) { 
				if (getcharid(1)) {
					getpartymember getcharid(1), 1;
					getpartymember getcharid(1), 2;
					for ([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
						if (isloggedin([email protected][[email protected]], [email protected][[email protected]])) { 
							[email protected][[email protected]] = [email protected][[email protected]];
							[email protected]++;
						}
					}
					if (rand(100) < .chance) getitem .p_rwd[0], .p_rwd[1], [email protected][ rand([email protected]) ];
					[email protected]_message$ = "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo(killedrid, MOB_NAME) +" at "+ strcharinfo(3);
				}
				else {
					if (rand(100) < .chance) getitem .s_rwd[0], .s_rwd[1];
					[email protected]_message$ = "[ System ] : Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo(killedrid, MOB_NAME) +" alone at "+ strcharinfo(3);
				}
				MVPKills = MVPKills+1;
				dispbottom "---------------------------------------------------";
				dispbottom "You killed a total of "+MVPKills+" MVP"+((MVPKills == 1)?"":"s")+".";
				dispbottom "---------------------------------------------------";
			}
		}
		
		addrid(0);
		if (#mvpon) {
			dispbottom [email protected]_message$;
		}
	}
	end;
}

or

-	script	#mvp_kill	-1,{

OnInit:
	setarray .p_rwd, 607,1;	// Party reward <item>,<amount>
	setarray .s_rwd, 607,1;	// Solo reward <item>,<amount>
	.chance = 50;	// Drop rate chances %
	//	.gm = 10;  // Prevents gm level and above to trigger the event
	// MVP Map list
	setarray .t_maps$[0],"moc_pryd06","lhz_dun03","gld2_prt","abbey02","ayo_dun02","lhz_dun04","ra_fild02","xmas_fild01","dic_dun02","beach_dun","iz_dun05","tur_dun04","lhz_dun02","jupe_core","moc_fild22","anthell02","odin_tem03","gon_dun03","gef_fild02","thana_boss","gef_fild10","ein_dun02","gef_fild14","moc_pryd04","dew_dun01","in_sphinx5","niflheim","moc_fild17","xmas_dun02","ice_dun03","kh_dun02","treasure02","moc_prydn2","pay_dun04","ra_san05","mosk_dun03","ama_dun03","thor_v03","gef_dun01","mjolnir_04","abyss_03","dic_dun03","prt_sewb4","pay_fild11","gef_dun02","gl_chyard","ra_fild03","ra_fild04","ve_fild01","ve_fild02","lou_dun03","prt_maze03","bra_dun02";
	end;

OnNPCKillEvent:
	//if (getgmlevel() >= .gm) end; // If gm = event wont happen
	if (strcharinfo(3) == instance_mapname("06guild_01") || strcharinfo(3) == instance_mapname("force_1-1")) end;
	if (getmonsterinfo(killedrid, MOB_MVPEXP)) {
		if (inarray(.t_maps$, strcharinfo(3)) != -1) {
			[email protected]_id = getcharid(1);
			if ([email protected]_id) {
				getpartymember [email protected]_id, 1;
				getpartymember [email protected]_id, 2;
				for ([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
					if (isloggedin([email protected][[email protected]], [email protected][[email protected]])) { 
						[email protected][[email protected]] = [email protected][[email protected]];
						[email protected]++;
					}
				}
				if (rand(100) < .chance) getitem .p_rwd[0], .p_rwd[1], [email protected][ rand([email protected]) ];
				[email protected]_message$ = "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo(killedrid, MOB_NAME) +" at "+ strcharinfo(3);
			}
			else {
				if (rand(100) < .chance) getitem .s_rwd[0], .s_rwd[1];
				[email protected]_message$ = "[ System ] : Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo(killedrid, MOB_NAME) +" alone at "+ strcharinfo(3);
			}
			MVPKills = MVPKills+1;
			dispbottom "---------------------------------------------------";
			dispbottom "You killed a total of "+MVPKills+" MVP"+((MVPKills == 1)?"":"s")+".";
			dispbottom "---------------------------------------------------";
				
			addrid(2, 0, [email protected]_id);
			if (#mvpon) {
				dispbottom [email protected]_message$;
			}
		}
	}
	end;
}

 

Edited by Emistry
update addrid
Link to comment
Share on other sites

  • 0
Posted (edited)
OnNPCKillEvent:
//if (getgmlevel() >= .gm ) end; // If gm = event wont happen
if(#mvpon >= 1)
	dispbottom "It triggers cause you got the " + #mvpon + " variable.";

 

Edited by Radian
Link to comment
Share on other sites

  • 0
Posted (edited)
3 hours ago, Radian said:
OnNPCKillEvent:
//if (getgmlevel() >= .gm ) end; // If gm = event wont happen
if(#mvpon >= 1)
	dispbottom "It triggers cause you got the " + #mvpon + " variable.";

 

Wouldn't this make the rest of the script not happen? I mean like the player won't get the rewards, the player won't get the message with how many mvp kills they got? I'd like for those things to still happen regardless of the variable. I guess I should've been more clear haha. 

 

The original script was an announcement, it's annoying to always have when an mvp dies get displayed in a high rate server(especially if your goal is pvp and not pve) , so basically my goal is to allow the player the choice on if they get the announcement in the form of a variable and dispbottom. The reason I'm choosing dispbottom in particular is because when a player has a chat box up announce goes into and fills the chatbox, so if the player is trying to buy or sell something or have a conversation it's not spamming on the players screens. 

Edited by DR4LUC0N
Link to comment
Share on other sites

  • 0
13 minutes ago, DR4LUC0N said:

Wouldn't this make the rest of the script not happen? I mean like the player won't get the rewards, the player won't get the message with how many mvp kills they got? I'd like for those things to still happen regardless of the variable. I guess I should've been more clear haha.

That will only trigger if a player with #mvpon variable. the rest will work as what it should be.

Link to comment
Share on other sites

  • 0
2 hours ago, Radian said:

That will only trigger if a player with #mvpon variable. the rest will work as what it should be.

I appreciate the help, hmm my wording can be bad sometimes, I'm sorry, but what I meant was so all players who have the variable see the dispbottom "player killed mvp blah" stuff.

Like player A kills Maya in anthell02,  Now as long as Player A has #mvpon >= 1, and Player B also has #mvpon >= 1 they will both get the dispbottom of  

dispbottom "[ System ] : Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3);

but if player A has #mvpon >= 1 and player B has #mvpon <= 0, Player A will see that message but player B will not.

Link to comment
Share on other sites

  • 0
5 hours ago, DR4LUC0N said:

I appreciate the help, hmm my wording can be bad sometimes, I'm sorry, but what I meant was so all players who have the variable see the dispbottom "player killed mvp blah" stuff.

Like player A kills Maya in anthell02,  Now as long as Player A has #mvpon >= 1, and Player B also has #mvpon >= 1 they will both get the dispbottom of  

dispbottom "[ System ] : Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3);

but if player A has #mvpon >= 1 and player B has #mvpon <= 0, Player A will see that message but player B will not.

				if (rand(100) < .chance) getitem .p_rwd[0], .p_rwd[1], .@partymemberaid[ rand( .@c ) ];
					dispbottom "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3);
			}
			else {
				if (rand(100) < .chance) getitem .s_rwd[0], .s_rwd[1];
					if(#mvpon >= 1)
						dispbottom "[ System ] : Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3);
			}

 

Link to comment
Share on other sites

  • 0
6 hours ago, Radian said:
				if (rand(100) < .chance) getitem .p_rwd[0], .p_rwd[1], .@partymemberaid[ rand( .@c ) ];
					dispbottom "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3);
			}
			else {
				if (rand(100) < .chance) getitem .s_rwd[0], .s_rwd[1];
					if(#mvpon >= 1)
						dispbottom "[ System ] : Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3);
			}

 

This doesn't hook all players on server to see if they have a variable or not, it's just the killer, so I was trying to use getunits and attachrid to read their variable and send them the dispbottom or not depending on the variable. Having a hard time getting the output for the script to push the dispbottom on them.

Link to comment
Share on other sites

  • 0
Posted (edited)
14 minutes ago, DR4LUC0N said:

This doesn't hook all players on server to see if they have a variable or not, it's just the killer, so I was trying to use getunits and attachrid to read their variable and send them the dispbottom or not depending on the variable. Having a hard time getting the output for the script to push the dispbottom on them.

I dont understand, what you're trying to do here, you said that you want to show a dispbottom message.

Maybe others can help you with this one, im sorry.

Edited by Radian
Link to comment
Share on other sites

  • 0
Just now, Radian said:

I dont understand, what you're trying to do here, you said that you want to show a dispbottom message.

Maybe others can help you with this one, im sorry.

It's okay, thanks for the help!

Link to comment
Share on other sites

  • 0
22 hours ago, Emistry said:

you can try something like this.

imho addrid and so on, should be inside check map bracket, if outside it will trigger any mvp in or not in the map set.

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

Important Information

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