Jump to content
  • 0

Check: Card on Equipment Location


alkhaleej

Question


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   5
  • Joined:  09/21/12
  • Last Seen:  

Hi guys,

I have this script which I made:

function script ShoesDeny {
setarray .CardListTk[0],4009,4038,4050,4070,4097,4100,4107,4123,4131,4151,4160,4164,4168,4186,4199,4200,4204,4208,4221,4235,4236,4239,4244,4245,4249,4257,4267,4275,4290,4319,4352,4376,4378,4381,4396,4417,4435,4441,4467,4478,4482,4488,4490,4495,4498,4504,4532,4539;
for( set .@i, 0; .@i < GetArraySize(.CardListTk); set .@i, .@i + 1 ) {
if( getequipcardid (EQI_SHOES,0) == .CardListTk[.@i] || getequipcardid (EQI_SHOES,1) == .CardListTk[.@i] || getequipcardid (EQI_SHOES,2) == .CardListTk[.@i] || getequipcardid (EQI_SHOES,3) == .CardListTk[.@i] ) {
callfunc "ShoesErrorMsg";
} else {
end; }
}
I am really new in this stuff.

Initially, I've made all the cards with:

equip_locations = 2 (Right hand) to equip_locations = 66 (Right hand + Shoes)
and made a special foot gear item with [4] slots.

This is a part of my check on all players if they will wear any footgear with weapon cards.

The script does not do its intended purpose. Anyone who can help me with this?

Link to comment
Share on other sites

6 answers to this question

Recommended Posts


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

function 	script	ShoesDeny {
	setarray .@card_list,4009,4038,4050,4070,4097,4100,4107,4123,4131,4151,4160,4164,4168,4186,4199,4200,4204,4208,4221,4235,4236,4239,4244,4245,4249,4257,4267,4275,4290,4319,4352,4376,4378,4381,4396,4417,4435,4441,4467,4478,4482,4488,4490,4495,4498,4504,4532,4539;
	set .@size,getarraysize( .@card_list );
	while( .@i < .@size ){
		if( isequipped( .@card_list[.@i] ) ){
			unequip EQI_SHOES;
			break;
		}
		set .@i,.@i + 1;
	}
	return;
}

 

call the function using

callfunc( "ShoesDeny" );
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   5
  • Joined:  09/21/12
  • Last Seen:  

Hi Sir Emistry,

Thank you for this. I tried this already and I've incorporated what I want and changed to this:

function	script	ShoesCheck	{
	setarray .@card_list,4009,4038,4050,4070,4097,4100,4107,4123,4131,4151,4160,4164,4168,4186,4199,4200,4204,4208,4221,4235,4236,4239,4244,4245,4249,4257,4267,4275,4290,4319,4352,4376,4378,4381,4396,4417,4435,4441,4467,4478,4482,4488,4490,4495,4498,4504,4532,4539;
		set .@size,getarraysize( .@card_list );
		while( .@i < .@size ){
			if( getequipcardid (EQI_SHOES,0) == .@card_list[.@i] || getequipcardid (EQI_SHOES,1) == .@card_list[.@i] || getequipcardid (EQI_SHOES,2) == .@card_list[.@i] || getequipcardid (EQI_SHOES,3) == .@card_list[.@i] ) {
				callfunc "ShoesErrorMsg";
			}
				set .@i,.@i + 1;
			}
				return;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   5
  • Joined:  09/21/12
  • Last Seen:  

Hi all,

I have made a custom shoes [4]. This shoe is only available to Taekwon.

Also, I have changed all weapon and footgear cards' equip_locations to 66 and executed 2 SQL queries for this purpose:

UPDATE item_db_re
SET equip_locations='66', equip_script='callfunc( "ShoesCheck" ); /*weapon*/'
WHERE type='6' AND equip_locations='2';
UPDATE item_db_re
SET equip_locations='66', equip_script='callfunc( "ShoesCheck" ); /*shoes*/'
WHERE type='6' AND equip_locations='64';
I have modified my script for the following purpose:

----> ShoesErrorMsg will trigger when the following conditions are met:

1. If a Taekwon wears a shoe with a footgear card in any of its slot.

2. If any class other than Taekwon wears a shoe with a weapon card in any of its slot.

And here is my script:

function	script	ShoesCheck	{
	if( class == Job_Taekwon ) {
		callfunc "ShoesTaekwon"; }
	else {
		callfunc "ShoesOthers"; }
}

function	script	ShoesErrorMsg	{
	message strcharinfo(0),"The card(s)/combination of cards compounded with this footgear is/are forbidden.";
	unequip EQI_SHOES;
	end;
}

function	script	ShoesTaekwon	{
	query_sql("SELECT id FROM `item_db_re` WHERE type='6' AND equip_script LIKE '%shoes%'", .@card_list);
		set .@size,getarraysize( .@card_list );
		while( .@i < .@size ){
			if( getequipcardid (EQI_SHOES,0) == .@card_list[.@i] || getequipcardid (EQI_SHOES,1) == .@card_list[.@i] || getequipcardid (EQI_SHOES,2) == .@card_list[.@i] || getequipcardid (EQI_SHOES,3) == .@card_list[.@i] ) {
				callfunc "ShoesErrorMsg";
			}
				set .@i,.@i + 1;
			}
				return;
}

function	script	ShoesOthers	{
	query_sql("SELECT id FROM `item_db_re` WHERE type='6' AND equip_script LIKE '%weapon%'", .@card_list);
		set .@size,getarraysize( .@card_list );
		while( .@i < .@size ){
			if( getequipcardid (EQI_SHOES,0) == .@card_list[.@i] || getequipcardid (EQI_SHOES,1) == .@card_list[.@i] || getequipcardid (EQI_SHOES,2) == .@card_list[.@i] || getequipcardid (EQI_SHOES,3) == .@card_list[.@i] ) {
				callfunc "ShoesErrorMsg";
			}
				set .@i,.@i + 1;
			}
				return;
}
----> While on other jobs other than Taekwon:

Script works fine.

but

----> While on Taekwon class:

When I tested a shoe with a weapon card compounded in it, the script fails to achieve its purpose.

Edited by alkhaleej
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

Why not just put weapon cards into that special shoe through an npc, and make shoe wearable only by tk? No need for all the db changes or functions

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   5
  • Joined:  09/21/12
  • Last Seen:  

Why not just put weapon cards into that special shoe through an npc, and make shoe wearable only by tk? No need for all the db changes or functions

Hmm, I was only thinking of three things:

1. Taekwons can put weapon cards only for footgear equipment.

2. Taekwons are not allowed anymore to use footgear cards for footgear.

3. All other jobs cannot use weapon cards for footgear equipment.

Btw, I revised the script to this and it is working:

function	script	ShoesCheck	{
	if( class == Job_Taekwon ) {
		callfunc "ShoesTaekwon"; }
	else {
		callfunc "ShoesOthers"; }
}

function	script	ShoesErrorMsg	{
	message strcharinfo(0),"The card(s)/combination of cards compounded with this footgear is/are forbidden.";
	unequip EQI_SHOES;
	end;
}

function	script	ShoesTaekwon	{
	query_sql("SELECT id FROM `item_db_re` WHERE type='6' AND equip_script LIKE '%shoes%'", .@card_list);
		for (set .@i,0; .@i < 200; set .@i,.@i+1) {
			if( getequipcardid (EQI_SHOES,0) == .@card_list[.@i] || getequipcardid (EQI_SHOES,1) == .@card_list[.@i] || getequipcardid (EQI_SHOES,2) == .@card_list[.@i] || getequipcardid (EQI_SHOES,3) == .@card_list[.@i] ) {
				callfunc "ShoesErrorMsg";
		}
	}
	end;
}

function	script	ShoesOthers	{
	query_sql("SELECT id FROM `item_db_re` WHERE type='6' AND equip_script LIKE '%weapon%'", .@card_list);
		for (set .@i,0; .@i < 200; set .@i,.@i+1) {
			if( getequipcardid (EQI_SHOES,0) == .@card_list[.@i] || getequipcardid (EQI_SHOES,1) == .@card_list[.@i] || getequipcardid (EQI_SHOES,2) == .@card_list[.@i] || getequipcardid (EQI_SHOES,3) == .@card_list[.@i] ) {
				callfunc "ShoesErrorMsg";
		}
	}
	end;
}
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:  

function	script	ShoesCheck	{
	setarray .@card_list,4009,4038,4050,4070,4097,4100,4107,4123,4131,4151,4160,4164,4168,4186,4199,4200,4204,4208,4221,4235,4236,4239,4244,4245,4249,4257,4267,4275,4290,4319,4352,4376,4378,4381,4396,4417,4435,4441,4467,4478,4482,4488,4490,4495,4498,4504,4532,4539;
		set .@size,getarraysize( .@card_list );
		while( .@i < .@size ){
			if( getequipcardid (EQI_SHOES,0) == .@card_list[.@i] || getequipcardid (EQI_SHOES,1) == .@card_list[.@i] || getequipcardid (EQI_SHOES,2) == .@card_list[.@i] || getequipcardid (EQI_SHOES,3) == .@card_list[.@i] ) {
				callfunc "ShoesErrorMsg";
			}
				set .@i,.@i + 1;
			}
				return;
}

about this script you could use

function	script	ShoesCheck	{
	if ( isequippedcnt( 4009,4038,4050,4070,4097,4100,4107,4123,4131,4151,4160,4164,4168,4186,4199,4200,4204,4208,4221,4235,4236,4239,4244,4245,4249,4257,4267,4275,4290,4319,4352,4376,4378,4381,4396,4417,4435,4441,4467,4478,4482,4488,4490,4495,4498,4504,4532,4539 ) > 1 )
		callfunc "ShoesErrorMsg";
}

whatever since you changed your mind

 

 

 

1. Taekwons can put weapon cards only for footgear equipment.

2. Taekwons are not allowed anymore to use footgear cards for footgear.

3. All other jobs cannot use weapon cards for footgear equipment.

for ( .@i = 0; .@i < 4; .@i++ )
	if ( getiteminfo( getequipcardid( EQI_SHOES,.@i ),5 ) == 2 ) {// card 'equip' weapon
		callfunc "ShoesErrorMsg";
		break;
	}
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...