SphereCommunity
Checking for spell casting - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Checking for spell casting (/Thread-Checking-for-spell-casting)

Pages: 1 2


RE: Checking for spell casting - Kanibal - 02-16-2016 10:29 PM

Code:
on=@itemequiptest
if (<act.tdata3> == 4)
  src.sysmessage You can't equip this armor.
return 1
endif



RE: Checking for spell casting - dunnetott - 02-16-2016 10:33 PM

Nice that worked thanks alot guys ^^


RE: Checking for spell casting - karma - 02-16-2016 11:55 PM

My fault, the item under @ItemEquipTest is ACT, not SRC. Also, SRC.SYSMESSAGE can be simply SYSMESSAGE.


RE: Checking for spell casting - Llirik - 02-17-2016 09:33 AM

Not use @ItemEquipTest use @Equip because @ItemEquipTest already equipped on you!

on=@equip
if (<i.tdata3> == 4)
src.sysmessage You can't equip this armor.
return 1
endif


RE: Checking for spell casting - Khaos - 02-17-2016 04:31 PM

sysmessage can also be smsg. Tongue

And no, you are wrong Llirik, you use @ItemEquipTest/@EquipTest. @Equip doesn't work the way you think it does. @ItemEquipTest/@EquipTest are fired inside sphere and their whole purpose is to see if character can equip the item. @Equip is just fired when something IS equipped.

http://wiki.sphere.torfo.org/index.php/@Equip

Wiki covers all of this. There is a sequence triggers follow and each normally has its own purpose. I think there is only one trigger missing from the Wiki at the moment. Well, it is there, but not accessible unless you search for it. Trying to remember which one it is. hehe. But yeah. Everything you need is generally outlined in good detail.


RE: Checking for spell casting - Llirik - 02-17-2016 05:49 PM

I'm sorry!


RE: Checking for spell casting - Llirik - 02-18-2016 12:01 AM

On item:

on=@equip
if (<src.skillclass> == x)
src.sysmessage You can't equip this armor.
return 1
endif

But this long...!


RE: Checking for spell casting - Khaos - 02-18-2016 09:00 AM

Again,

Code:
on=@EquipTest
if (<src.skillclass> == <whatever_class>) && (<src.npc> == 0)
src.smsg You can't equip this armor.
return 1
endif

You missed my point. @Equip is fired AFTER @EquipTest, which @EquipTest is used to see if an item can be equipped or not. @Equip says it is already equipped and now we are processing what we are going to do now it is equipped.

No point in saying sorry if you didn't understand the point I was trying to make. Triggers parse in a specified order. Each trigger has its own functionality. Which I outlined what @EquipTest and @Equip do and the order they go in.

This could be handled on the skillclass itself:
Code:
[skillclass 42]
....

on=@ItemEquipTest
if (<act.type> == t_armor||t_leather_armor) && (<act.tdata3> == 3) // Just using the example above of the person who set the armor type in the tdata3.
src.smsg You can't equip this armor.
return 1
endif

Anyone who has this skillclass won't be able to use said item that way.

Edited this a few times. The original code I redid now checks for brain_player and skillclass. The second one is fired from the player on their skillclass.

The first is fired on every item using that trigger if it is equipped (player and npc). The second only fires on players equipping items (though it will check every armor they equip). The first is OPTIMAL if you don't have your Mobiles equipping a lot of armor. If you have mobiles equipping armor on your server, you might just want to parse it on the player instead.