SphereCommunity
@UnEquip - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: General Help (/Forum-General-Help)
+--- Thread: @UnEquip (/Thread-UnEquip)



@UnEquip - Art - 04-30-2013 09:19 AM

Hello. I have function on UnEquip trigger which checking character's layers, but problem is that trigger works when item still on layer. I should check layers instantly after item was unequipped.


RE: @UnEquip - Mordaunt - 04-30-2013 10:56 AM

It has to fire right before the unequip because return 1 will prevent the unequip

so do this instead

Code:
on=@UNEQUIP
timerf 2, f_myfunction



RE: @UnEquip - Art - 04-30-2013 04:02 PM

Yes i understand, but i thought there maybe exist trigger which works after item was unequipped Smile
But is there another way without timerf? It have delay, and also if player will equip and unequip item many times per second (specially on macros or script), will be stack for those functions overflowed? Or some load on server?


RE: @UnEquip - RanXerox - 04-30-2013 04:08 PM

What are you trying to do?


RE: @UnEquip - Art - 04-30-2013 07:42 PM

I have tags on armors, and when player equip those armors, function recalculates extra bonus for character in dependence of tags on equipped items. Function checks items through character's layers, so, when player unequip item, at function process item still on layer, heh.


RE: @UnEquip - Gil Amarth - 04-30-2013 07:54 PM

Try:

on=@UNEQUIP
timerf 0, f_myfunction


I´m not 100% sure, but from my experience with timerf 0, the script launches just when the trigger has finished what was doing.
I also use a system of armors and clothing with this, and I haven´t problems with macros.


RE: @UnEquip - RanXerox - 05-01-2013 01:25 AM

I don't see what the problem is.. I do the same thing using normal functions in @equip and @unequip ... for example:

Here are the items:

Code:
[ITEMDEF i_cap_work]
ID=i_skull_cap
NAME=work cap
DYE=1
RESOURCES=2 i_cloth,1 i_thread,i_wire_iron,i_potion_clever,i_scroll_strength
SKILLMAKE=Tailoring 30.1,t_sewing_kit,Magery 20.0
CATEGORY=Magic
SUBSECTION=Clothing
DESCRIPTION=Magic Work Cap
TAG.NotGargoyle=1
TAG.REQSTR=25
TEVENTS=e_equipitem //handle all the special tags
ON=@Create
   HITPOINTS={36 48}
   ATTR=attr_magic|attr_identified
   TAG.ResFire=3
   TAG.ResCold=5
   TAG.ResPoison=8
   TAG.ResPhysical=1
   TAG.ResEnergy=8
ON=@UnEquip
   WorkClothesUnequip
ON=@Equip
   WorkClothesEquip

And here are the functions:

Code:
[FUNCTION WorkClothesEquip]
If (<SRC.FINDLAYER(6).baseid>==i_cap_work) && (<SRC.FINDLAYER(17).Baseid>==i_apron_work) && (<SRC.FINDLAYER(7).BaseID>==i_gloves_work) && (<SRC.FINDLAYER(3).Bas
eID>==i_boots_work)
   SRC.MINING += 100
   SRC.LUMBERJACKING += 100
   SRC.MESSAGE You feel like working!
   SRC.SOUND=snd_SPELL_BLESS
   SRC.EFFECT=3,i_fx_bless_effect,6,16,0
Else
   SRC.MINING += 20
   SRC.LUMBERJACKING += 20
EndIf

[FUNCTION WorkClothesUnequip]
If (<SRC.FINDLAYER(6).baseid>==i_cap_work) && (<SRC.FINDLAYER(17).Baseid>==i_apron_work) && (<SRC.FINDLAYER(7).BaseID>==i_gloves_work) && (<SRC.FINDLAYER(3).Bas
eID>==i_boots_work)
   SRC.MINING -= 100
   SRC.LUMBERJACKING -= 100
   SRC.MESSAGE You feel like resting...
   SRC.SOUND=snd_SPELL_BLESS
   SRC.EFFECT=3,i_fx_bless_effect,6,16,0
Else
   SRC.MINING -= 20
   SRC.LUMBERJACKING -= 20
EndIf