Help with loops

Lord Ganja

New member
Messages
161
Points
0
Age
34
Location
Ganja World
Im currently modifying my enchantment system.

I want to it work like, no the same orb on the same items. 1 orb ID per item only

But im having troubles with loops.

Here's my script.

Code:
setarray .@cardid[0], getequipcardid(.@part,1),getequipcardid(.@part,2),getequipcardid(.@part,3);	for( .@i = 0; .@i < getarraysize(.@cardid); .@i++ ){		if( getequipcardid(.@part,.@i) == .@cardid[.@i] ) {			mes .npc$;			mes "Sorry, I cannot enchant the same orb on the same item.";			close;		}	}
 
for( .@i = 0; .@i < 4; .@i++ ){ if( getequipcardid(.@part,.@i) == .@orbid ) { mes .npc$; mes "Sorry, I cannot enchant the same orb on the same item."; close; } }
Replace .@orbid with the variable that contains the orb id.

Note: this (above) check should be done after a player has selected orb to enchant.

 
Uhh. Basically you're putting things in array, and then compare them to themselves. I'd say you're always getting that stop, right?

So can you elaborate what exactly do you want? Any amount of orbs, but so they won't repeat within item? Also, mind me asking why you're checking only last 3 slots, and not all 4? How many slots are available? What's the variable you use to store which orb players wants to slot in?

I think the following script should work, if you'll fill in the needed parts.

Code:
input .@orbID; //orb that player wants to slot// .@part, I guess, contains which equip we're enchantingsetarray .@cardid[0],getequipcardid(.@part,0),getequipcardid(.@part,1),getequipcardid(.@part,2),getequipcardid(.@part,3);.@string = "," + implode(.@cardid,",") + ",";if( compare(.@string,","+.@orbID+",") ) {	mes .npc$;	mes "Sorry, I cannot enchant the same orb on the same item.";	close;}
 
@@Dastgir I need it to check for multiple enchantments.

@@Garr I triend your script but it gives me error when it runs.

[Debug]: Data: variable name='.@cardid' index=0[Error]: script:implode: not string array

Btw, thanks to both of  you. I'll explain this further.

My custom enchantment system can only add enchantment orb to 2nd,3rd and last slot of an item.

For example:

I have 5 orbs with id numbers 4700, 4701, 4702, 4703, 4704.

And let's say my 'Alice Doll' helm has already an echantment

2nd card slot: 4700

3rd card slot: <emtpy / not yet enchanted>

4th card slot: 4703

Now, when I will try to enchant the 3rd slot which is emtpy, I have again to select which orb I have to enchant into it..

After selecting an orb, it will compare the selected orb from the orb which are already enchanted into the item.

If it match any orbs which is already in the item, it will now say this 'mes "Sorry, I cannot enchant the same orb on the same item.";'

So in that case, the 'Alice Doll' helm cannot be enchanted with orbs with item id 4700 or 4703 since it is only one orb ID per item.

 
@@Dastgir I need it to check for multiple enchantments.

@@Garr I triend your script but it gives me error when it runs.

[Debug]: Data: variable name='.@cardid' index=0[Error]: script:implode: not string array Btw, thanks to both of  you. I'll explain this further.

My custom enchantment system can only add enchantment orb to 2nd,3rd and last slot of an item.

For example:

I have 5 orbs with id numbers 4700, 4701, 4702, 4703, 4704.

And let's say my 'Alice Doll' helm has already an echantment

2nd card slot: 4700

3rd card slot: <emtpy / not yet enchanted>

4th card slot: 4703

Now, when I will try to enchant the 3rd slot which is emtpy, I have again to select which orb I have to enchant into it..

After selecting an orb, it will compare the selected orb from the orb which are already enchanted into the item.

If it match any orbs which is already in the item, it will now say this 'mes "Sorry, I cannot enchant the same orb on the same item.";'

So in that case, the 'Alice Doll' helm cannot be enchanted with orbs with item id 4700 or 4703 since it is only one orb ID per item.
My one exactly does that.Thats why I told place it in the place after you select orb Id, and change .@orbid with variable containing the Id of orb you selected.

 
@@Dastgir F*CK! Yeah. Hahaha it was that simple. I haven't think of that. Thanks anyways
default_smile.png


 
Last edited by a moderator:
Back
Top