SphereCommunity
ON=@DAMAGE issue [SOLVED] - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: ON=@DAMAGE issue [SOLVED] (/Thread-ON-DAMAGE-issue-SOLVED)



ON=@DAMAGE issue [SOLVED] - TigerBlitz - 01-09-2017 03:04 AM

Hi community
First i am using 56d Nightly. I have a problem with ON=@DAMAGE trigger.
the effect is not working every hit, it is only active in 2nd or 3rd hits.

Here is the script.
PHP Code:
[ITEMDEF I_SWORD_VIKING_JUSTICE]
ID=I_SWORD_VIKING
NAME
=Sword of Justice
//RESOURCES=14 I_INGOT_IRON, I_SWORD_VIKING
//INCREASEDAM=35

CATEGORY=!Magic Weapons
SUBSECTION
=Swords
DESCRIPTION
=Sword of Justice

ON
=@CLICK
NAME 
@000c6 Sword of Justice

ON
=@CREATE
    MOREY
=250.0
    ATTR
=ATTR_MAGIC
    HITPOINTS
=100
    
//COLOR=COLOR_MAGIC_WEAP

ON=@EQUIPTEST
IF (<SRC.swordsmanship> < 90.0)
SRC.SYSMESSAGE @0079a You lack the skill requires to equip this weapon (90 Swordsmanship)
RETURN 
1
ELSE
SRC.EFFECT=3,03709,6,15,
SRC
.EFFECT=3,036b0,6,15,
SRC
.SOUND=snd_SPELL_FLAMESTRIKE 
SRC
.SOUND=snd_SPELL_LIGHTNING 

ON
=@UNEQUIP 
SRC
.EFFECT=3,03709,6,15,
SRC
.EFFECT=3,036b0,6,15,
SRC
.SOUND=snd_SPELL_FLAMESTRIKE 
SRC
.SOUND=snd_SPELL_LIGHTNING
SRC
.SYSMESSAGE @0079a You feel much weaker

ON
=@DAMAGE
    SRC
.EFFECT=3,03715,6,15,1
    SRC
.SOUND=SND_ELEMENTL_FIRELEM1 



RE: ON=@DAMAGE issue - Ben - 01-09-2017 03:10 AM

As far as I know, @Damage is triggered when the weapon itself is damaged, not when it causes damage. you need to use @Hit


RE: ON=@DAMAGE issue - TigerBlitz - 01-09-2017 03:28 AM

Thx Ben.

But when i use @Hit, effect is not working, its just hit no more.
But when i use @Damage, effect is working but not every hit..

PHP Code:
ON=@HIT ==> the effects never work with @Hit trigger
    SRC
.NEWITEM=03715
    src
.act.p=<src.p>
    
SRC.ACT.ATTR=attr_decay|attr_move_never
    SRC
.ACT.TIMER=2
    SRC
.SOUND=SND_ELEMENTL_FIRELEM1

ON
=@DAMAGE ==> same problem
    
SRC.NEWITEM=03715
    src
.act.p=<src.p>
    
SRC.ACT.ATTR=attr_decay|attr_move_never
    SRC
.ACT.TIMER=2
    SRC
.SOUND=SND_ELEMENTL_FIRELEM1 

@Hit its not working with effects
@Damage its not works well every hits, its working sometimes


RE: ON=@DAMAGE issue - Ben - 01-09-2017 04:30 AM

I was wrong... @hit fires on Chars not items.
There are no triggers on items for hitting.

Best solution would be to install an event on your char when equipped with an @hit trigger in it and remove it when unequiped


RE: ON=@DAMAGE issue - Coruja - 01-09-2017 04:40 AM

yea unfortunately @Damage on item is only fired when the item get damaged, not when it cause damage (weapons). There's no trigger fired when weapons cause damage

so you must call the trigger from the char instead the item, where you can use @Hit when the char cause an physical damage. Something like this:
Code:
[ITEMDEF i_sword_viking_justice]
...

ON=@Equip
SRC.EVENTS +e_event_sword_viking_justice

ON=@Unequip
SRC.EVENTS -e_event_sword_viking_justice

[EVENTS e_event_sword_viking_justice] // char event
ON=@Damage
SRC.EFFECT 3,03715,6,15,1
SRC.SOUND snd_elementl_firelem1



RE: ON=@DAMAGE issue - TigerBlitz - 01-09-2017 05:02 AM

Thx guyz
Problem is solved with On=@Hit trigger coz On=@Damage trigger its damage itself Smile

Do I need to attach to the INI file?

Maybe this problem may cause a new trigger to be created Smile
ON=@Effect or like that..
very well thx for helping.