SphereCommunity
Problem with custom spells... - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Problem with custom spells... (/Thread-Problem-with-custom-spells)

Pages: 1 2


Problem with custom spells... - Jonaleth - 04-25-2012 06:34 PM

Any idea why this doesn't work;

[SPELL 121]
DEFNAME=s_healI
NAME=Heal
SOUND=snd_spell_heal
RUNES=
CAST_TIME=3
RESOURCES=
RUNE_ITEM=
SCROLL_ITEM=
FLAGS=SPELLFLAG_TARG_CHAR | SPELLFLAG_DIR_ANIM | SPELLFLAG_FX_TARG
EFFECT_ID=i_fx_heal_effect
EFFECT=3,15
DURATION=0
MANAUSE=5
SKILLREQ=SKILL_SPIRITSPEAK 40.0
INTERRUPT=100.0,1.0

ON=@Select
IF <mana> > 4
flags=<flags>|020
mana=<mana> + (-5)
RETURN 0
ELSE
RETURN 1
ENDIF

ON=@Success
src.gain_int 60
src.flags=<src.flags>|020

ON=@EFFECT
var0.healingpower=(<eval <src.spiritspeak>>/5)
src.SPELLEFFECT 4, <var0.healingpower>
src.sound=snd_spell_heal
ENDIF

It just tells me that I establish a communication with the spirit world or something. While other spells that has SkillReq: Spiritspeak works just fine. Even if I change the Spiritspeak to Magery, it still establish a communication with the spirit world. I just get confused.


RE: Problem with custom spells... - admin phoenix - 04-25-2012 07:31 PM

maybe you have to restart the server and try to set the flag of the skill spiritspeak to SKF_MAGIC


RE: Problem with custom spells... - Shaklaban - 04-25-2012 08:51 PM

(04-25-2012 06:34 PM)Jonaleth Wrote:  Any idea why this doesn't work;

[SPELL 121]
DEFNAME=s_healI
NAME=Heal
SOUND=snd_spell_heal
RUNES=
CAST_TIME=3
RESOURCES=
RUNE_ITEM=
SCROLL_ITEM=
FLAGS=SPELLFLAG_TARG_CHAR | SPELLFLAG_DIR_ANIM | SPELLFLAG_FX_TARG
EFFECT_ID=i_fx_heal_effect
EFFECT=3,15
DURATION=0
MANAUSE=5
SKILLREQ=SKILL_SPIRITSPEAK 40.0
INTERRUPT=100.0,1.0

ON=@Select
IF <mana> > 4
flags=<flags>|020
mana=<mana> + (-5)
RETURN 0
ELSE
RETURN 1
ENDIF

ON=@Success
src.gain_int 60
src.flags=<src.flags>|020

ON=@EFFECT
var0.healingpower=(<eval <src.spiritspeak>>/5)
src.SPELLEFFECT 4, <var0.healingpower>
src.sound=snd_spell_heal
ENDIF

It just tells me that I establish a communication with the spirit world or something. While other spells that has SkillReq: Spiritspeak works just fine. Even if I change the Spiritspeak to Magery, it still establish a communication with the spirit world. I just get confused.

as admin phoenix says if you want to change skillreq, resources etc. of a spell you need to restart the server.


RE: Problem with custom spells... - Jonaleth - 04-25-2012 08:56 PM

But how come this spell wont work while others with Skill_SpiritSpeak works?


RE: Problem with custom spells... - Jonaleth - 04-27-2012 06:37 AM

I have another question related to New Custom Spells.
I am trying to add custom spells for NPC's, that are working just fine for me. But how can I add them so that NPC's will use them?
I cannot add them to a spellbook or can I?


RE: Problem with custom spells... - Khaos - 04-29-2012 01:26 PM

You would have to make a custom book for them or use .cast <spell name here> in some triggers on them with checks and circumstantial variables Tongue. Which you still might have to do with the custom spell book.


RE: Problem with custom spells... - Jonaleth - 04-29-2012 11:07 PM

Anyone got a simple example of how one can do a costum spellbook. Ive tried a script that tell the npc to .cast s_fart_dart, but he fizzles. He doent have that spell in his spellbook.
So yes a custom spellbook sounds indeed interesting!


RE: Problem with custom spells... - Anarch Cassius - 04-30-2012 06:23 AM

Code:
[FUNCTION npccast]
// Determine spell and skill used to cast
LOCAL.SPELL = <EVAL <ARGV[0]> &~ 0ff000000>
LOCAL.SKILL = <EVAL (<STREAT <SERV.SPELL.<LOCAL.SPELL>.SKILLREQ>>) &~ 0ff000000>
IF (<SERV.SPELL.<LOCAL.SPELL>.MANAUSE> > <MANA>)
    RETURN 1
ENDIF
IF (<EVAL STRLEN(<SERV.SPELL(<LOCAL.SPELL>).RUNES>)> > 0)
     SAY <RUNES <LOCAL.SPELL>>
ENDIF
IF !(<LOCAL.SKILL>)
  LOCAL.SKILL = 25
ENDIF
TAG.LASTCASTING=<eval (<SERV.TIME>+<SERV.SPELL.<LOCAL.SPELL>.CAST_TIME>)>
TAG.SPELLCASTING=<LOCAL.SPELL>

// Set spell target
IF (<ARGV> > 2) //use coords if given
    ACT = 0
    ACTP = <ARGV[1]>, <ARGV[2]>, <ARGV[3]>, <ARGV[4]>
ELIF (<SERV.SPELL.<LOCAL.SPELL>.FLAGS> & spellflag_targ_xyz) //use coords for ground targ spells regardless
    ACTP = <ACT.P>
    ACT = 0
ELSE
    REF1 = <ARGV[1]>
    IF !(<REF1.UID>)
        REF1 = <ACT.UID>
        IF !(<REF1.UID>)
            REF1 = <UID>
        ENDIF
    ENDIF
    ACT = <REF1.UID>
    ACTP = <REF1.P>
ENDIF

    
// Set character action
ACTPRV = <UID>
ACTARG1 = <LOCAL.SPELL>
ACTION = <LOCAL.SKILL>
RETURN 1

You can't just use CAST, it needs a target. This function works with objects or coordinates.

Code:
npccast s_fart_dart,<act>



RE: Problem with custom spells... - Khaos - 05-01-2012 11:28 AM

I'd use Cassius' code. It does work. I help on his server sometimes Wink


RE: Problem with custom spells... - Jonaleth - 05-04-2012 07:51 PM

Thank you! I will use this one Smile very kind of you!