Jump to content

Few minor problems with a script.


Ellerin

Recommended Posts

First of all hello to all , This is my 1st post since i registered here , well umm was playing Oblivion with mods i DLed from here :biggrin: .

 

So now to the point .

 

I decided to create a simple mod (my 1st one) , nothing big just a simple custom summon , and got stucked on few problems.

 

1 : Well the spell itself is okie , but maybe you could have a look and give little suggestion about my summon spell effect check . (maybe there is simpler way of doing it)

 

 

 

ScriptName SummonSpellEffect

ref Summon                            ; <--- This will be Summoned npc
string_var TempName              ; <--- Future summons name
string_var TempPlayerName      ; <--- Value will store players name

Begin ScriptEffectStart

   set Summon to ElvenScoutRef         ; <--- Set refference to NPC wich will be summoned .

       ; Here will script check for active summon spell effect if there
       ; is any , then dispel it.
       ; Lets say is again emulation of "real" Summon spell in way of
       ; allowing player have only one summoned creature .


         if player.HasMagicEffect ZSKE
                 player.dispel StandardSummonSkeletonApprentice   
         endif
         if player.HasMagicEffect ZZOM
                 player.dispel StandardSummonZombieApprentice   
         endif
         if player.HasMagicEffect ZGHO
                 player.dispel StandardSummonGhostApprentice   
         endif
         if player.HasMagicEffect ZSKA
                 player.dispel StandardSummonSkeletonGuardianJourneyman   
         endif
         if player.HasMagicEffect Z002
                 player.dispel PwRaceDarkElfGuardian   
         endif
         if player.HasMagicEffect ZHDZ
                 player.dispel StandardSummonZombieHeadlessJourneyman   
         endif
         if player.HasMagicEffect ZSKH
                 player.dispel StandardSummonSkeletonHeroExpert  
         endif
         if player.HasMagicEffect ZWRA
                 player.dispel StandardSummonWraithFadedExpert   
         endif
         if player.HasMagicEffect ZSKC
                 player.dispel StandardSummonSkeletonChampionExpert   
         endif
         if player.HasMagicEffect ZWRL
                 player.dispel StandardSummonWraithGloomMaster   
         endif
         if player.HasMagicEffect ZLIC
                 player.dispel StandardSummonLichMaster   
         endif
         if player.HasMagicEffect ZSCA
                 player.dispel StandardSummonScampApprentice   
         endif
         if player.HasMagicEffect ZFIA
                 player.dispel StandardSummonAtronachFlameJourneyman   
         endif
         if player.HasMagicEffect ZDRE
                 player.dispel StandardSummonDremoraJourneyman   
         endif
         if player.HasMagicEffect ZCLA
                 player.dispel StandardSummonClannfearExpert   
         endif
         if player.HasMagicEffect ZFRA
                 player.dispel StandardSummonAtronachFrostExpert   
         endif
         if player.HasMagicEffect ZDRL
                 player.dispel StandardSummonDremoraLordMaster   
         endif
         if player.HasMagicEffect ZSTA
                 player.dispel StandardSummonAtronachStormMaster   
         endif
         if player.HasMagicEffect ZSPD
                 player.dispel StandardSummonSpiderDaedraExpert   
         endif
         if player.HasMagicEffect ZXIV
                 player.dispel StandardSummonXivilaiMaster   
         endif

       ; And here is the actual summoning process.

         Summon.disable                                   ; <-- Just in case ...
         summon.resurrect                                 ; <-- Again just in case ...
         Summon.moveto Player 10 10 10           ; <--- Lets teleport target NPC somewhere near player.
         Summon.SetOwnership                         ; <--- Just a test if player can own NPC.

                                                 ; This part will still happen before showing up summon 

         set TempPlayerName to player.getname                          ; <--- Get players name . WARNING : requires OBSE
         let TempName := TempPlayerName + "'s Elven Scout"      ; <--- Build Summons name . WARNING : requires OBSE

         Summon.setname $TempName      ; <--- Set summons name to look like summoned creature name . WARNING : requires OBSE
         Summon.enable       ; <---  Time to show it .

End


Begin ScriptEffectFinish

    ; Is it already time to end spell effect? Okie then let's kill summon . Vanishing will be done by AI script

    summon.kill
                                                    
End

 

 

 

2 :

2a : In the next one (Is the script running on NPC for successfull emulation of summoning and scripting "AI" if i can call it like that.)

i would like again suggestion about simpler way of doing that spell effect check .

2b : In "Summon AI Script" part fuction IsPlayerMovingIntoNewSpace sometimes do not work , did i do something wrong?

 

 

 

ScriptName ScoutScpt

float Fade
short Died
short curPlayerHP
short PlayerHp

Begin OnLoad
   set Fade to 1      ; <--- Alpha value
   SetOwnership     ; <--- Just tested if player can actualy "own" NPC
End

Begin OnDeath
   set Died to 1        ; <--- Tell to script summon died
End

Begin GameMode

     ; If is players summon enabled , script will check if player is target of other
     ; summoning spell and if yes, then dispel this summon.
     ; Lets say its emulation of summon canceling effect wich happens when
     ; player use summoning spell and already have one active summon.

       if GetDisabled == 0 ; <--- Check
           if player.IsSpellTarget StandardSummonSkeletonApprentice
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonZombieApprentice
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonGhostApprentice
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonSkeletonGuardianJourneyman
              player.dispel SummonScout
           endif
           if player.IsSpellTarget PwRaceDarkElfGuardian
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonZombieHeadlessJourneyman
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonSkeletonHeroExpert
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonWraithFadedExpert
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonSkeletonChampionExpert
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonWraithGloomMaster
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonLichMaster
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonScampApprentice
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonAtronachFlameJourneyman
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonDremoraJourneyman
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonClannfearExpert
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonAtronachFrostExpert
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonDremoraLordMaster
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonAtronachStormMaster
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonSpiderDaedraExpert
              player.dispel SummonScout
           endif
           if player.IsSpellTarget StandardSummonXivilaiMaster
              player.dispel SummonScout
           endif
        endif 

      ; Always check if is summon enabled because if you put him/her on some place 
      ; with possibility of player runing around then this summon will DO whats scripted
      ; even when is disabled , and player may be affected by it.
 
      ; Summon AI Script

        if GetDisabled == 0  ; <--- Check
           
            if IsPlayerMovingIntoNewSpace == 1  ; <--- If player is teleporting (by teleporting i mean FastTravel, entereing Interiors etc...)
                moveto playerRef  ; <---- then follow him
            endif

            set PlayerHp to player.GetBaseAV Health  ; <--- Let's get value of players max HP
            set curPlayerHP to player.GetAV Health        ; <--- and current player HP

            if curPlayerHP < (PlayerHP/2)         ; <---- If is players HP under half send message
               message "Your HP is under half consider use of healing spell or potion."
            endif

        endif

      ; There is no need to check if is summon enabled in the next one , there is nothing more than script
      ; wich will be executed after summons death.

        if ( Died == 1 )         ; <--- Summon died
         
             if ( Fade > 0 )      ; <--- Fade Effect
               set Fade to ( Fade - getsecondspassed )
               saa Fade
            else                      ;<--- if Faded then
               moveto ElvenRockId 0 0 10        ;<--- move it somewhere . (ElvenRockId is reference for object near wich the summon will be teleported)
               player.dispel SummonScout       ;<--- Dispel Summoning spell effect. (SummonScout is summoning spell ID)
               disable                                         ;<--- Disable
               resurrect                                      ;<--- and resurrect.
               set Died to 0                                ;<--- For script to not repeat itself.
            endif

       endif  
End

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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