Terms of Condicional

Need help with your JScripts? Got questions concerning the DFNs? Come forward, step inside :)
Post Reply
Blue Dragon
UOX3 Apprentice
Posts: 159
Joined: Mon Jan 09, 2012 1:43 am
Has thanked: 0
Been thanked: 0

Terms of Condicional

Post 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...
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post 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.
-= Ho Eyo He Hum =-
Blue Dragon
UOX3 Apprentice
Posts: 159
Joined: Mon Jan 09, 2012 1:43 am
Has thanked: 0
Been thanked: 0

Post 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
Post Reply