Page 1 of 1

Terms of Condicional

Posted: Fri Aug 17, 2012 6:24 pm
by Blue Dragon
Hello Xuri.

If in a script I want to put a conditional that a target can not be any summon / invocation of my character, what exactly do I put?

if( !socket.GetWord( 1 ) && myTarget.isChar && myTarget.vulnerable && myTarget.serial != myPlayer.serial && myTarget.owner == myPlayer && ????? )


What if I want to also put if such a item must in the backpack of my character?

if( myTarget.id == 0x2121 && myTarget.colour == 0 && ????? )

I just need to know this...

Re: Terms of Condicional

Posted: Mon Aug 20, 2012 3:16 am
by Xuri
Hey Blue,

Could you explain the context of the situation with the targeting stuff? What exactly are you trying to do?

To check for specific items in a backpack, you could possibly check against the name of the item (if it's unique), or against a custom-tag saved on the item. If the custom-tag exists, and has the correct value - that's the item you want. If the custom-tag doesn't exist (but you set it specifically on the item to begin with), then it's not the item you want.

Re: Terms of Condicional

Posted: Mon Aug 20, 2012 4:45 pm
by Blue Dragon
Context ... The first case I wanted if the target was an invocation/summon of my character, when I send my npc attack him, he would not attack him... All this because if I send the NPC attack himself (a daemon summon, for exemple), he began to kill itself (attacking itself, LOL). But now this corrgi with ( myTarget.serial != MyNPC.serial )...

The second would be a conditional where the player used the item (which would be selected through for a target) only if he was in his backpack. I wanted to know how to do it, what to put ... but I currently put if (myTarget.container == true) and it worked, if the item is in of the backpack he carries the script, but now, if is totally right or not, I do not know o.o