Jump to content

Here is a custom summon spell code.


lostdarkwolf

Recommended Posts

This does work for OpenMW. Below is a process for making an alit summoning spell. Replace "alit" with whatever you want to summon. It should be noted that a custom summoning spell cannot be used in spellmaking. repeat this process to make something else. This example is for the player only. This spell will not work correctly for anyone else, unless they have thier own version of the spell. This would mean changing "Player" to your NPC's ID. Also, if an NPC summon needs to attack the player, its fight value needs to be 90.

 

Summoning an alit:

1. Make a "Summon Ancestral Ghost" effect spell. Duration should be 1. It's title should be "Summon Alit". In this example, the spell's ID is called "summonAlit".

2. Attach the small bit of code below to the summoned Ancestral Ghost, called "summon ancestral ghost"
- Unfortunately, this will make you unable to summon an Ancestral Ghost during summoning an alit, but I don't think it's a big deal. EDIT: Oops, nevermind. This is not an issue because summonAlit is deacivated too quickly. the spell that sticks around is summonAlitCover.

if ( player->GetSpellEffects, summonAlit == 1 )
    Disable
endif

3. Edit the default Alit's ID and make a new object with a new ID. This alit will be for summoning. Its fight value should be 50. In this example, the summoned alit's ID is called "aaa_alit_summon".

4. make a float-type global variable as a timer, value zero. In this example, the timer is called "SummonAlitTimer".
5. apply the code below into a start script.

short LastSpellEffectsAlit

if ( LastSpellEffectsAlit == 0 )
    if ( Player->GetSpellEffects, summonAlit == 1 )
        if ( SummonAlitTimer > 0 )
            MessageBox, "You cannot re-cast this spell while it is still in effect."
        endif
        if ( SummonAlitTimer <= 0 )
            Player->PlaceAtMe, aaa_alit_summon, 1, 120, 0
            set SummonAlitTimer to 60
        endif
    endif
endif

set LastSpellEffectsAlit to ( Player->GetSpellEffects, summonAlit )

6. make a "EXTRA SPELL" effect spell. It's type is an ability. In this example, the spell's ID is called "summonAlitCover".

7. apply the code below to the summoned alit that was created in step 3. (I called it "aaa_alit_summon".)

short doOnce
short OnDeath
float LastTime

; track remaining summon time
if ( LastTime<GetCurrentTime )
    if ( SummonAlitTimer >= 0 )
        set SummonAlitTimer to (SummonAlitTimer - GetSecondsPassed)
    endif
endif    
; set the summon to follow the player and make it register as a spell by using a cover. (It is not a spell, it is code.)
if ( doOnce == 0 )
    AIFollow, Player, 0, 0, 0, 0
    set doOnce to 1
    set TimePassed to 0
    player->addspell, summonAlitCover
endif
; have the cover spell vanish when 2 seconds are left
if ( SummonAlitTimer <= 2 )
    player->removespell, summonAlitCover
endif
; destroy the summon when time is up
if ( SummonAlitTimer <= 0 )
    disable
endif
; have the cover spell vanish, and destroy the summon, all upon death.
if ( OnDeath == 1 )
    set OnDeath to 0
    player->removespell, summonAlitCover
    disable
endif

set LastTime to GetCurrentTime

Change Edit: Added the missing "set" command for the LastSpellEffectsAlit variable.

Edit 2: Step-by-step process cleaned up a bit. Added specification of used ID names when making resources.

Edited by lostdarkwolf
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...