Jump to content


Photo

How to create my own Spells?


  • Please log in to reply
2 replies to this topic

#1 Kyros

Kyros
  • Member
  • 14 posts

Posted 29 June 2017 - 07:34 AM

Hello, 

 

I would like to know how to create my own spells? It should be possible for the spell to be casted by monsters so it has to be used in .bcs files.

So far, I only used spells from other mods and edited them to my liking. If I create just a random .spl file, the spell will not be casted by monsters.

Any ideas? Thanks.

 

Kyros



#2 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5155 posts

Posted 29 June 2017 - 09:10 AM

The topic title is a little misconstrued.. as it should be "How to get a custom spell to work (in a script) ?", not how to create it, as that's a topic totally of it's own.

 

In scripts you can use the same exact usage of the normal spell casting, but instead of using the:

31 Spell(O:Target*,I:Spell*Spell)

You just use the:

31 SpellRES(S:RES*, O:Target*)

-action, with the RES meaning what ever you name the spell with... and it needs to be 7 letters or less, not 8.

 

95, 113 and 114 etc actions have their own RES version.

 

So if you spell file is "magmiss.spl" you just make the script to utilize that file, you take a script that has similar action...

 

IF
    ActionListEmpty()
    See(NearestEnemyOf(Myself))
    HaveSpell(CLERIC_MAGIC_STONE) // SPPR106.SPL (Magical Stone)
    HPGT(NearestEnemyOf(Myself),20)
THEN
    RESPONSE #100
        Spell(NearestEnemyOf(Myself),CLERIC_MAGIC_STONE) // SPPR106.SPL (Magical Stone)
END

For example, and edit it:

 

IF
    ActionListEmpty()
    See(NearestEnemyOf(Myself))
    GLOBAL("firstspelltouse","LOCALS",0)
    HPGT(NearestEnemyOf(Myself),20)
THEN
    RESPONSE #100
        SpellRES("magmiss",NearestEnemyOf(Myself)) // SPPR106.SPL (Magical Stone)
    SetGlobal("firstspelltouse","LOCALS",1)
END

And yes, the global is there to watch out that the creature has the spell ... there might be better ways to do it, but this WILL definitely work, which is important.


Edited by The Imp, 29 June 2017 - 09:45 AM.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#3 Kyros

Kyros
  • Member
  • 14 posts

Posted 29 June 2017 - 02:26 PM

Hello The Imp,

 

Thanks for your reply. I know the SpellRes, ForceSpellRes and so on approach, but it doesn't work. It works when I use custom spells added by mods. But let's just say I copy "SPWI112" (Magic Missile) from the original game resources.

I rename it to "xxx.spl" for example, that is where my problem is. I don't want to rely on spells that get introduced by mods, I want to create some random spl.file and get it work. So far it doesn't.

I remember reading something about an ADD_Spell command in Weidu? Could that help with my problem? I don't know so please tell me what to do :D

 

Kyros

 

EDIT: Nevermind, I managed to get it to work with ForceSpellRes. I can't believe that in all these years I thought this would not work probably because I once tried this in an erroneous script.  :doh:

Thanks!


Edited by Kyros, 30 June 2017 - 06:42 AM.