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


Checking for spell casting - dunnetott - 02-16-2016 10:11 AM

im trying to check for a spell during casting so i can allow the spell depending on what spell is cast

did something like this

ON=@SPELLCAST
if (<src.cast> == S_BLESS)
return 0
else
return 1
endif


RE: Checking for spell casting - Kanibal - 02-16-2016 10:31 AM

Code:
on=@spellcast
if (<argn1>==17) // Spell Bless
  return 0 // Continue
else
  return 1 // Stop
endif



RE: Checking for spell casting - dunnetott - 02-16-2016 10:34 AM

oh nice that works Thanks alot ^^

you dont happen to know how to disable a [skillclass x] to not be able to use say like a platemail?


RE: Checking for spell casting - Kanibal - 02-16-2016 10:44 AM

(02-16-2016 10:34 AM)dunnetott Wrote:  you dont happen to know how to disable a [skillclass x] to not be able to use say like a platemail?
Doubt

Code:
[skillclass x]
...
events=e_class_x

[events e_class_x]
on=@itemequiptest
if ...

UPD


RE: Checking for spell casting - Llirik - 02-16-2016 04:16 PM

on=@itemequiptest
if <src.findid.i_ring_gold>
say My precious!
src.str += 1
endif

Smile

Use this:

ON=@Login
if <src.skillclass>==x
src.events e_class_x
endif


RE: Checking for spell casting - dunnetott - 02-16-2016 07:06 PM

there is no way i could do something like

on=@itemequiptest
if (<src.findtype.t_armor_plate>)
say you cannot wear that.
endif

or do i have to add items invidual ?


RE: Checking for spell casting - karma - 02-16-2016 08:57 PM

In my server i added a TDATA3 property to each armor piece (you can also use a TAG if you wish):
0: cloth
1: leather
2: studded
3: ringmail
4: chainmail
5: plate
6: bone
7: dragon
etc..

Then you can check for the TDATA3 inside the SKILLCLASS block:
Code:
ON=@ItemEquipTest
IF (<SRC.TDATA3>==5)
SRC.SYSMESSAGE You can't equip this armor.
RETURN 1
ENDIF
You can also put the trigger directly inside the SKILLCLASS block without having to attach an event to it.


For the spell, you can dynamically get the number from the defname this way:
Code:
[FUNCTION spellNo] //ARGS=defname of the spell
RETURN <HVAL <ARGS>&(~0ca000000)>



RE: Checking for spell casting - dunnetott - 02-16-2016 09:04 PM

how do i define tdata3? sorry just started to relearn sphere scripting been 12 years since i last used it.


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

In the definition of the item

[ITEMDEF 0xxxx]
DEFNAME=i_bone_chest //Example
NAME=bone chest
..
TDATA3=6

You have to put it before any trigger


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

Code:
[ITEMDEF 013bb]
DEFNAME=i_chainmail_coif
TYPE=T_ARMOR
RESOURCES=10 i_ingot_iron
SKILLMAKE=BLACKSMITHING 14.5
TDATA3=4
WEIGHT=7
FLIP=1
ARMOR=23
REQSTR=20
CATEGORY=Provisions - Armor
SUBSECTION=Chainmail Armor
DESCRIPTION=Chainmail Coif
DUPELIST=013c0

and i put this under the skillclass

Code:
ON=@ItemEquipTest
IF (<SRC.TDATA3>==4)
SRC.SYSMESSAGE You can't equip this armor.
RETURN 1
ENDIF

and i get a console output
Can't resolve <SRC.TDATA3>
Undefined symbol