![]() |
Issue with custom spell - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: Issue with custom spell (/Thread-Issue-with-custom-spell) |
Issue with custom spell - kstanton03 - 03-19-2017 06:08 AM I wrote a script for a regen spell. It's still in the early stages. The script works fine when a player targets themselves; however, if the player target's another player the timer equips to the caster and not the person being casted on. Any help / suggestions would be appreciated. [Spell 200] DEFNAME=s_regen_rank1 NAME=Regen SOUND=snd_SPELL_GREATER_HEAL RUNES=IVM CAST_TIME=0 RESOURCES= RUNE_ITEM= //i_rune_GREATER_HEAL SCROLL_ITEM=i_scroll_GREATER_HEAL FLAGS=SPELLFLAG_TARG_CHAR|SPELLFLAG_FX_TARG|SPELLFLAG_GOOD|spellflag_playeronly ON=@Start ANIM 17 SAY @,3,1 Casting Regen ON=@Effect local.healpower=12 local.spelltics=5 IF (<TAG0.BUFFS.REGEN>) src.sysmessage That character already has this spell in effect. return 1 else //NO BUFF ON src.tag.mp -= 19 SERV.NEWITEM i_timer_regen NEW.TAG.HEALPOWER=<local.healpower> NEW.TAG.TICSLEFT=<local.spelltics> NEW.EQUIP tag.buffs.regen=<local.healpower> RETURN 1 end if return 1 [ITEMDEF i_timer_regen] ID=i_memory TYPE=t_eq_script ON=@Create TIMER = 3 ON=@Timer if (<tag.TICSLEFT> < 1) cont.TAG.BUFFS.REGEN= REMOVE return 1 end if if (<cont.flags>&statf_dead) cont.TAG.BUFFS.REGEN= REMOVE RETURN 1 end if CONT.EFFECT=3,01153 ,9,30,1, 03e if (<cont.tag.hp> < <cont.tag.maxhp>) cont.tag.hp += <tag.HEALPOWER> end if if (<cont.tag.hp> > <cont.tag.maxhp>) cont.tag.hp = <cont.tag.maxhp> end if local.newhits = ((<cont.tag.hp>*100) / <cont.tag.maxhp>) cont.HITS = <local.newhits> TAG.TICSLEFT -= 1 //cont.sysmessage You have <eval <tag.TICSLEFT>> tics to go. //cont.say I got healed for <eval <tag.healpower>> TIMER 3 RETURN 1 RE: Issue with custom spell - Leonidas - 03-19-2017 01:59 PM Tried testing this on my server and it wouldn't work even when targetting myself. I'd think all youd have to do is change it like this: Code: src.TARG.tag.mp -= 19 But I can't test it so I have no idea if that'll work. RE: Issue with custom spell - kstanton03 - 03-19-2017 07:13 PM Thanks for the reply, By mistake I cut out this part of the [Spell 200] SKILLREQ=MAGERY 0 INTERRUPT=0,0 I tested with the NEW.TARG, however it gives me a console error of undefined keyword TARG.EQUIP. I have tried to utilize TARG in both on=@start and on=@effect. My option may have to be to keep the timer on the player who casts the spell and store the target's UID in the timer. Things definitely work a lot different when written under a spell rather than a function. RE: Issue with custom spell - Artyk - 03-21-2017 07:57 AM I think the matter is "NEW.EQUIP" since that equips to the SRC, and in that case is the character responsible for the spell. |