Jump to content
IGNORED

Help with Spell Casting Script


Recommended Posts

If this isn't where scripting questions go, someone please move this appropriately ūüėÉ

 

I want to make a spell that the player can use to teleport to various places.  I'm not sure that's actually possible, because it would probably involve having a message box pop up instead of a spell effect graphic.

 

I've laid the groundwork, I think -- Created a Scroll that "teaches" the teleport spell via script, and written the spell effect script.  I've placed "AllaXMarkerAnvil" and Bravil, etc outside the cities in question.

 

The scroll works -- it teaches "World Walking".

The spell casts, but nothing happens.

 

Here are my scripts -- the "Teach" script (which works) and the "Travel" script (which doesn't work).  What have I done wrong?

Is it impossible to do it this way, and do I instead need 8 separate spells (one for each city's XMarker) instead?

 

Thanks in advance for advice, links to tutorials, and all other help!

 

Spoiler
ScriptName AllaTeachTravelSpell


Begin OnActivate

   Player.AddSpell AllaTravelSpell
   Activate

End

 

 

 

 

 

 

Spoiler

 

ScriptName AllaTravelScript


;Lets you teleport to Anvil, Bravil, Bruma, Chorrol, Cheydinhal, Imperial City, Leyawiin, or Skingrad
;AllaXMarkerSuchandSuch at these locations
;AnvilMainEntrance, BravilExterior17, BrumaMainEntrance, CheydinhalStable01, ChorrolStables00, WawnetInnExterior, LeyawiinStables00, SkingradSurilieVineyards




Short Choosing
Short Choice

Begin OnActivate
   Set Choosing to -1
     MessageBox "Where do you want to go?", "Anvil", "Bravil", "Bruma", "Chorrol", "Cheydinhal", "Imperial City", "Leyawiin", "Skingrad", "Never Mind"
     Set Choosing to 1
     Set Choice to -1
End

Begin GameMode
   If (Choosing == 1)

     	If (Choice == -1) ;No choice yet
        	Set Choice to GetButtonPressed

		If Choice == 0 ;Anvil		 
        		Player.MoveTo AllaXMarkerAnvil

		ElseIf (Choice == 1) ;Bravil   
        		Player.MoveTo AllaXMarkerBravil

		ElseIf (Choice == 2) ;Bruma		 
        		Player.MoveTo AllaXMarkerBruma

		ElseIf (Choice == 3) ;Chorrol   
        		Player.MoveTo AllaXMarkerChorrol

		ElseIf (Choice == 4) ;Cheydinhal		 
        		Player.MoveTo AllaXMarkerCheydinhal

		ElseIf (Choice == 5) ;ImperialCity   
        		Player.MoveTo AllaXMarkerICBridge

		ElseIf (Choice == 6) ;Leyawiin		 
        		Player.MoveTo AllaXMarkerLeyawiin

		ElseIf (Choice == 7) ;Skingrad   
        		Player.MoveTo AllaXMarkerSkingrad
   EndIf
   EndIf
     	EndIf ;Choice block end

   EndIf ;Choosing block end

End ;GameMode end

 

Link to comment
5 hours ago, Allannaa said:

If this isn't where scripting questions go, someone please move this appropriately ūüėÉ

 

I want to make a spell that the player can use to teleport to various places.  I'm not sure that's actually possible, because it would probably involve having a message box pop up instead of a spell effect graphic.

 

I've laid the groundwork, I think -- Created a Scroll that "teaches" the teleport spell via script, and written the spell effect script.  I've placed "AllaXMarkerAnvil" and Bravil, etc outside the cities in question.

 

The scroll works -- it teaches "World Walking".

The spell casts, but nothing happens.

 

Here are my scripts -- the "Teach" script (which works) and the "Travel" script (which doesn't work).  What have I done wrong?

Is it impossible to do it this way, and do I instead need 8 separate spells (one for each city's XMarker) instead?

 

Thanks in advance for advice, links to tutorials, and all other help!

 

  Reveal hidden contents

 

 

 

  Hide contents

 

ScriptName AllaTravelScript


;Lets you teleport to Anvil, Bravil, Bruma, Chorrol, Cheydinhal, Imperial City, Leyawiin, or Skingrad
;AllaXMarkerSuchandSuch at these locations
;AnvilMainEntrance, BravilExterior17, BrumaMainEntrance, CheydinhalStable01, ChorrolStables00, WawnetInnExterior, LeyawiinStables00, SkingradSurilieVineyards




Short Choosing
Short Choice

Begin OnActivate
   Set Choosing to -1
     MessageBox "Where do you want to go?", "Anvil", "Bravil", "Bruma", "Chorrol", "Cheydinhal", "Imperial City", "Leyawiin", "Skingrad", "Never Mind"
     Set Choosing to 1
     Set Choice to -1
End

Begin GameMode
   If (Choosing == 1)

     	If (Choice == -1) ;No choice yet
        	Set Choice to GetButtonPressed

		If Choice == 0 ;Anvil		 
        		Player.MoveTo AllaXMarkerAnvil

		ElseIf (Choice == 1) ;Bravil   
        		Player.MoveTo AllaXMarkerBravil

		ElseIf (Choice == 2) ;Bruma		 
        		Player.MoveTo AllaXMarkerBruma

		ElseIf (Choice == 3) ;Chorrol   
        		Player.MoveTo AllaXMarkerChorrol

		ElseIf (Choice == 4) ;Cheydinhal		 
        		Player.MoveTo AllaXMarkerCheydinhal

		ElseIf (Choice == 5) ;ImperialCity   
        		Player.MoveTo AllaXMarkerICBridge

		ElseIf (Choice == 6) ;Leyawiin		 
        		Player.MoveTo AllaXMarkerLeyawiin

		ElseIf (Choice == 7) ;Skingrad   
        		Player.MoveTo AllaXMarkerSkingrad
   EndIf
   EndIf
     	EndIf ;Choice block end

   EndIf ;Choosing block end

End ;GameMode end

 

Sorry, too lazy to check your script, here is a script that works (at least the choice), just substitute your values (after 0,1,2,3... and so on, the last number is exiting the menu)

 

TeleportSpell.esp

 

scn aadkzzTELEPORT

ref me
short button
short buttonwait
short step


Begin ScriptEffectStart

    set step to 0
    set button to -1
    set buttonwait to 0

    set me to GetSelf
    if me==0
        return
    endif

End

 

Begin ScriptEffectUpdate
printC" Processing..."

    if step>1
        me.dispel aaaaaTSp
    endif

 


    if step == 0
        MessageBoxEx "Skull Teleport|Target 1|Target 2|Exit"button
        set buttonwait to 1
        set step to 1
    endif

printC"button == %0f        buttonwait == %0f"button,buttonwait

    if buttonwait>0 && step==1

        set button to GetButtonPressed
        if button < 0
            return
        endif

        if button==0
            set me to GetSelf
            if me.IsActor==1
                MessageBoxEx "Go to Tar1"
                set step to 999
                me.dispel aaaaaTSp
            endif
        elseif button==1
            set me to GetSelf
            if me.IsActor==1
                MessageBoxEx "Go to Tar2"
                set step to 999
                me.dispel aaaaaTSp
            endif
        elseif button==2
            set me to GetSelf
            if me.IsActor==1
                MessageBoxEx "Bye..."
                set step to 999
                me.dispel aaaaaTSp
            endif

        endif

    endif


end

Link to comment

Oh, my gosh, I can't believe you went to all that trouble for a cranky old lady.  That was REALLY nice of you, TDA!  Thank you so much!  I'll try this out and go from there.

You're a sweetheart!

Link to comment

Well... I seem to have this sort of working.

 

The spell casting animation starts

The message box pops up

You can click the destination

 

......and nothin' happens.  You don't go to the X marker at the destination.  You just stay where you are.

 

When I made this an "object" instead of a "script effect", and attached it to a lever you could pull, it worked fine -- pull lever, message box, select town, blammo, you're there!

 

What am I *not* figuring out when this is a Spell instead of an Activator?  Why does it work as an activator and not as a spell?

Link to comment
Posted (edited)

oh good lord, I'm an idiot.... I thought I had.

 

Here it is.  As I say, it works as an "Object" script attached to a lever -- but not otherwise.

 

Spoiler
ScriptName AllaTravelSpellsScript

;Lets you choose a destination, pay for a port to it, and go there

Short Choosing
Short Choice

Begin OnActivate
   Set Choosing to -1
     MessageBox "Where do you want to go?", "Anvil", "Bravil", "Bruma", "Cheydinhal", "Nowhere"
     Set Choosing to 1
     Set Choice to -1
End

Begin GameMode
   If (Choosing == 1)

     	If (Choice == -1) ;No choice yet
        	Set Choice to GetButtonPressed

		If Choice == 0 ;Anvil		 
        		If (Player.GetItemCount Gold001 >= 5)
             		   Player.RemoveItem Gold001 5
             		   Player.MoveTo AllaAnvilPortMarker
        		Else (Player.GetItemCount Gold001 < 5)
             		   MessageBox "You can't afford that."
			EndIf

		ElseIf (Choice == 1) ;Bravil		 
        		If (Player.GetItemCount Gold001 >= 5)
             		   Player.RemoveItem Gold001 5
             		   Player.MoveTo AllaBravilPortMarker
        		Else (Player.GetItemCount Gold001 < 5)
             		   MessageBox "You can't afford that."
			EndIf

		ElseIf Choice == 2 ;Bruma		 
        		If (Player.GetItemCount Gold001 >= 5)
             		   Player.RemoveItem Gold001 5
             		   Player.MoveTo AllaBrumaPortMarker
        		Else (Player.GetItemCount Gold001 < 5)
             		   MessageBox "You can't afford that."
			EndIf

		ElseIf (Choice == 3) ;Cheydinhal		 
        		If (Player.GetItemCount Gold001 >= 5)
             		   Player.RemoveItem Gold001 5
             		   Player.MoveTo AllaCheyPortMarker
        		Else (Player.GetItemCount Gold001 < 5)
             		   MessageBox "You can't afford that."
			EndIf
   EndIf
   EndIf
     	EndIf ;Choice block end

   EndIf ;Choosing block end

End ;GameMode end

 

 

Edited by Allannaa
because I'm still an idiot
Link to comment

Begin OnActivate in a spell script?  How do you was able to compile it? The CS should tell you that is not possible.

And after a else there can't be anything !!!  Must e elseif or you delete the (Player.GetItemCount Gold001 < 5)

And there is one endif in your object script too much?

I can't compile your script , my CS won't let me.

 

You have?

A spell with
SEFF "Skript-Effekt" [MGEF:0000189A]
and you add the AllaTravelSpellsScript


----------------------

magic effect script !  NO object script

--------------------------

ScriptName AllaTravelSpellsScript

;Lets you choose a destination, pay for a port to it, and go there

Short Choosing
Short Choice

 

Begin ScriptEffectStart
   Set Choosing to 1
End

 

BEGIN ScriptEffectUpdate  ; mybe Begin GameMode also works

  If ( Choosing == 0 )

    return

  Endif

 

  If (Choosing == 1)
     MessageBox "Where do you want to go?", "Anvil", "Bravil", "Bruma", "Cheydinhal", "Nowhere"
     Set Choosing to 2       ; LOL I set it to 2 but never used it , there is a lot of missing in the script.  And with ScriptEffectUpdate it removes all my gold.
     Set Choice to -1

 

       If (Choice == -1) ;No choice yet
            Set Choice to GetButtonPressed

 

        If Choice == 0 ;Anvil        
                If (Player.GetItemCount Gold001 >= 5)
                        Player.RemoveItem Gold001 5
                        Player.MoveTo AllaAnvilPortMarker
                Else
                        MessageBox "You can't afford that."
                EndIf

 

        ElseIf (Choice == 1) ;Bravil        
                If (Player.GetItemCount Gold001 >= 5)
                        Player.RemoveItem Gold001 5
                        Player.MoveTo AllaBravilPortMarker
                Else
                        MessageBox "You can't afford that."
                EndIf

 

        ElseIf Choice == 2 ;Bruma        
                If (Player.GetItemCount Gold001 >= 5)
                        Player.RemoveItem Gold001 5
                        Player.MoveTo AllaBrumaPortMarker
                Else
                        MessageBox "You can't afford that."
                EndIf

 

        ElseIf (Choice == 3) ;Cheydinhal        
                If (Player.GetItemCount Gold001 >= 5)
                        Player.RemoveItem Gold001 5
                        Player.MoveTo AllaCheyPortMarker
                Else
                        MessageBox "You can't afford that."
                EndIf
         EndIf

 

     EndIf ;Choice block end
     Set Choosing to 0 ;to finish up
  EndIf ;Choosing block end

End ;GameMode end

--------------------

 

I hope that's right.  I'm a bit out of script practice.

 

Edited by fejeena
Link to comment
Posted (edited)

Thank you, Fejeena.  I'll give that a try.  You and TDA are really nice to go to so much trouble to help me figure out what to do!

 

All right, the changes you made do compile, once I add the X markers to the right spots.  The spell does cast, but now, there is no message box to allow the player to pick a port, and the player doesn't go anywhere.  And it doesn't remove the 5 gold pieces.

Edited by Allannaa
Link to comment

I will try it in game.

 

But is your spell duration long enough for a ScriptEffectUpdate ?  I don't think it works if you set it to 0

And have you tried Begin GameMode ?

 

I will post again when I have a working script.

 

 

EDIT

See my old post LOL

 

Here the script and my test esp

 

I used vanilla X Markers for testing in my esp !

spelltest.esp

 

The script you will use

Spoiler

ScriptName AllaTravelSpellsScript

;Lets you choose a destination, pay for a port to it, and go there

Short Choosing
Short Choice

 

Begin ScriptEffectStart
    Set Choosing to 1
End

 


Begin GameMode

    If ( Choosing == 0 )

        return

    Endif

    If (Choosing == 1)
        MessageBox "Where do you want to go?", "Anvil", "Bravil", "Bruma", "Cheydinhal", "Nowhere"
        Set Choosing to 2
        Set Choice to -1

    Elseif (Choosing == 2)
        If (Choice == -1) ;No choice yet
            Set Choice to GetButtonPressed
            return

        Elseif Choice == 0 ;Anvil        
            If (Player.GetItemCount Gold001 >= 5)
                Player.RemoveItem Gold001 5
                Set Choosing to 0
                Player.MoveTo AllaAnvilPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf (Choice == 1) ;Bravil        
            If (Player.GetItemCount Gold001 >= 5)
                Player.RemoveItem Gold001 5
                Set Choosing to 0
                Player.MoveTo AllaBravilPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf Choice == 2 ;Bruma        
            If (Player.GetItemCount Gold001 >= 5)
                Player.RemoveItem Gold001 5
                Set Choosing to 0
                Player.MoveTo AllaBrumaPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf (Choice == 3) ;Cheydinhal        
            If (Player.GetItemCount Gold001 >= 5)
                Player.RemoveItem Gold001 5
                Set Choosing to 0
                Player.MoveTo AllaCheyPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        EndIf ;Choice block end


        Set Choosing to 0 ;to finish up
    EndIf ;Choosing block end

 

End
 

 

 

The spell I used

spelltest.jpg

 

Teleport and Gold removed.

No teleport and message if you have no gold.

 

 

Edited by fejeena
Link to comment
  • 2 weeks later...

I still can't really get it to work on my own, so I am going to look at the script you wrote and go from there.  You're right, it's partly because the spell casts so fast.  I think.

 

But I'm wondering about something else, too.

When you click on the Spell Altar in the Arcane Uni, it pops up a menu box or message box (not sure what to call it) that lets you use the altar, and it runs the "SpellmakingStation" script.  When you click on the Enchant Altar, it runs "EnchantingStationScript".

You can find both those scripts in the Gameplay > EditScripts > Open window of the CK

That makes sense.

BUT

When you click on a bed, you get the "How long do you want to rest" and slider menu box/message box.  But is that a script also?  If so, where is it?  I've been looking all evening for it in the CK but I can't figure out where it is.

I do know the Enchant Altar and Spellmaking Altar are "Activators" and not "Furnitures" but is there still a script for Beds?

I'm so darned confused!

Link to comment

I made something like that from some time to use in some mod I create, I got some difficulties to make it compatible with shivering Isle ( like change map )  BUT finally I succeeded

here is the scripts I use and work great in game 

 

1- IS Compatibility

    use this without any modifications, except the yellow color ( Name ) if u want

 

Spoiler

Type of script : object

 

scn XXXXXAA

int go

Begin Function{go}
    Player.SCAOnActor
    If go
        SetPlayerInSEWorld 1
        SEJailMarkerParentTamriel.Disable
        SEJailMarkerCrucible.Enable
        SEJailMarkerBliss.Enable
        SEPrisonMarkerAichan.Enable
        SEPrisonMarkerCorpserot.Enable
        if Player.GetEquipped TGGrayFoxCowl == 1
            Set SECrime.EnteredSECowlOn to 1
        endif
    Else
        setPlayerInSEWorld 0
        SEJailMarkerParentTamriel.Enable
        SEJailMarkerCrucible.Disable
        SEJailMarkerBliss.Disable
        SEPrisonMarkerAichan.Disable
        SEPrisonMarkerCorpserot.Disable
        If Player.GetEquipped TGGrayFoxCowl == 1
            Set SECrime.LeftSECowlOn to 1
        EndIf
    EndIf
    ReleaseWeatherOverride
End

 

 

2- Teleportation Script 

     U need to put X marker to map to places to teleport  and give them Editor IDs .. In this case i put 7 marker & the last one is in SI

     Yellow color names u can change but be careful to put the same script name of SI Compatibility in step 1 in its place

 

Spoiler

Type of script : Magic

 

ScriptName XXXXXAB

float MessageDelayTime
ref SheoCount
short Button

begin ScriptEffectStart

If IsInCombat
    Message "Can't teleport while in combat."
     Let MessageDelayTime := .2
      return
ElseIf IsInOblivion
    Message "U Can't escape from Oblivion so easily."
     Let MessageDelayTime := .2
      return
Else
    MessageBox "Locations Destination:", "Location A", "Location B",  "Location C",  "Location D", "Location E", "Location F", "Location G", "Shivering Isles", "Cancel"

    PlaySound SPLAlterationCast

     EndIf
end

begin ScriptEffectUpdate
    PlaySound SPLAlterationCast
        Set Button to GetButtonPressed
        if ( Button == 0 )
                 player.Moveto XXMarkerAA
            elseif ( Button == 1 )
                 player.Moveto XXMarkerBB
            elseif ( Button == 2 )
                 player.Moveto XXMarkerCC
            elseif ( Button == 3 )
                     player.Moveto XXMarkerDD
            elseif ( Button == 4 )
                     player.Moveto XXMarkerEE
            elseif ( Button == 5 )
                     player.Moveto XXMarkerFF
            elseif ( Button == 6 )
                     player.Moveto XXMarkerGG
            elseif ( Button == 7 )
                     Let SheoCount := GetFormFromMod "Oblivion.esm" 06A7FC
                  If IsFormValid SheoCount
                  If Player.GetFactionRank SheoCount == 9
                     player.Moveto XXMarkerHH  
             Else
             Message "U Can't Go there Yet."
             Let MessageDelayTime := .2
                     return 
             endif
             endif
             elseif ( Button == 8 )
                     return
        endif
           If GetPlayerInSEWorld     
                     Call XXXXXAA 0
        endif
end       

 

3- Create the spell 

     just normal way  Type : Lesser Power  &  mark  Disallow spell absorb\Ref - script effect always apply - immune to silence

     and unmark  auto calculate  -  spell level : Novice  - spell cost 0

     then new  effect : Script effect   Range : Self    Duration : 2  

     Script effect info 

     Script : XXXXXAB 

     Chose spell effect name and magic school & visual effect as U like

     unmark  Effect is Hostile 

 

4- The script can be also changed to be Activator type to attach to object in game like button or Statue .... etc  , IF u try it and work with U & NEED the  Activator type let me know 

 

Edited by mma75online
Link to comment

Beds have no script. You see it in CS or TES4Edit.  The bed menu is a hardcoded game function you can not change.

You can add  a script to a bed so the script opens/run before the bed menu opens. It's done in the Mage guild Dreamworld  quest ( Through A Nightmare, Darkly ). The script teleports you to the dreamworld instead of opening the sleep menu.

 

------------------

The teleport script:

 

Have you tried my esp ?

Put the spelltest.esp  in your game data folder.  Then start  TES4Edit and open the esp (or CS, but better with TES4Edit )

There is only a spell and script in the esp.

You can copy both ( rename x markers , script name , spell name )

 

Or first try it in game.

You have to add the spell with console.

 

Open console and click on you player, the enter

addspell xx000801

hit enter key

 

!! replace the xx with the load order number of the spelltest.esp in your game.

Then you have a new spell with name "Teleport"

 

I tested it in game, it works.

 

-----------

And  mma75online mad a good extension/addition. 

The problem with the ShiveringIsle world.

You can block the spell in ShiveringIsle   so the spell can't teleport you to Tamriel.

Or you add in the spript

setPlayerInSEWorld 0

 

?? You only have teleport locations in Tamriel ? right ?

 

Script with blocking the teleport spell in Shivering isle

Spoiler

ScriptName AllaTravelSpellsScript

;Lets you choose a destination, pay for a port to it, and go there

Short Choosing
Short Choice

 

Begin ScriptEffectStart
    Set Choosing to 1
End

 


Begin GameMode

 

   If GetPlayerInSEWorld == 1

      Set Choosing to 0

      Message "The spell doesn't work here."

   endif

 

    If ( Choosing == 0 )

        return

    Endif

 

    If (Choosing == 1)
        MessageBox "Where do you want to go?", "Anvil", "Bravil", "Bruma", "Cheydinhal", "Nowhere"
        Set Choosing to 2
        Set Choice to -1

    Elseif (Choosing == 2)
        If (Choice == -1) ;No choice yet
            Set Choice to GetButtonPressed
            return

        Elseif Choice == 0 ;Anvil        
            If (Player.GetItemCount Gold001 >= 5)
                Player.RemoveItem Gold001 5
                Set Choosing to 0
                Player.MoveTo AllaAnvilPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf (Choice == 1) ;Bravil        
            If (Player.GetItemCount Gold001 >= 5)
                Player.RemoveItem Gold001 5
                Set Choosing to 0
                Player.MoveTo AllaBravilPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf Choice == 2 ;Bruma        
            If (Player.GetItemCount Gold001 >= 5)
                Player.RemoveItem Gold001 5
                Set Choosing to 0
                Player.MoveTo AllaBrumaPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf (Choice == 3) ;Cheydinhal        
            If (Player.GetItemCount Gold001 >= 5)
                Player.RemoveItem Gold001 5
                Set Choosing to 0
                Player.MoveTo AllaCheyPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        EndIf ;Choice block end


        Set Choosing to 0 ;to finish up
    EndIf ;Choosing block end

 

End

 

 

Or script  with the SI world fix.  So you can use the spell in Shivering isle and world is "reset to Tamriel"

Spoiler

ScriptName AllaTravelSpellsScript

;Lets you choose a destination, pay for a port to it, and go there

Short Choosing
Short Choice

 

Begin ScriptEffectStart
    Set Choosing to 1
End

 


Begin GameMode

 

    If ( Choosing == 0 )

        return

    Endif

 

    If (Choosing == 1)
        MessageBox "Where do you want to go?", "Anvil", "Bravil", "Bruma", "Cheydinhal", "Nowhere"
        Set Choosing to 2
        Set Choice to -1

    Elseif (Choosing == 2)
        If (Choice == -1) ;No choice yet
            Set Choice to GetButtonPressed
            return

        Elseif Choice == 0 ;Anvil        
            If (Player.GetItemCount Gold001 >= 5)
                Player.RemoveItem Gold001 5
                Set Choosing to 0

                If GetPlayerInSEWorld == 1

                   SetPlayerInSEWorld 0

               endif

                Player.MoveTo AllaAnvilPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf (Choice == 1) ;Bravil        
            If (Player.GetItemCount Gold001 >= 5)
                Player.RemoveItem Gold001 5
                Set Choosing to 0

                If GetPlayerInSEWorld == 1

                   SetPlayerInSEWorld 0

               endif

                Player.MoveTo AllaBravilPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf Choice == 2 ;Bruma        
            If (Player.GetItemCount Gold001 >= 5)
                Player.RemoveItem Gold001 5
                Set Choosing to 0

                If GetPlayerInSEWorld == 1

                   SetPlayerInSEWorld 0

               endif

                Player.MoveTo AllaBrumaPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf (Choice == 3) ;Cheydinhal        
            If (Player.GetItemCount Gold001 >= 5)
                Player.RemoveItem Gold001 5
                Set Choosing to 0

                If GetPlayerInSEWorld == 1

                   SetPlayerInSEWorld 0

               endif

                Player.MoveTo AllaCheyPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        EndIf ;Choice block end

        Set Choosing to 0 ;to finish up
    EndIf ;Choosing block end

 

End

 

Both scripts same as in my post above ( or in the esp )  you only add the yellow part.

Edited by fejeena
Link to comment

My stupid Internet just got back up... So frustrating!

 

I'm going to try your script today, Fejeena.  I'm also going to try MMA's script.

 

I can't believe how nice you both are to help me figure this out!  It's really great of you.

 

I thought the Beds were probably hard-code, and I don't suppose it matters much.  I just wanted to see how that was put together, because I thought it might help me learn.

 

But you folks are helping me, so that's much better anyway.

 

Off to try now!  (and here's hoping my Internet stops going out just because there's a thunderstorm somewhere on earth)

Link to comment

Well -- Things sort of work.

 

The spell casts (as long as the Duration is set to 0 )

The message box pops up with all the choices

You can click a choice

 

But you don't go anywhere.  The spell finishes casting and you're still standing where you started.

 

I did try console "player.MoveTo AllaAnvilPortMarker"  without casting the spell, just console.  I couldn't go there, it said Invalid Reference.  But I expected that since it's just an X marker with that as the ID name in the Render window.

 

One thing I did wonder -- when I made the individual Port Spells -- I had to have the MoveTo part inside a "Begin ScriptEffectStart / End" block.  (The individual spells work fine, I just hate having 8 separate spells in my book)

ScriptName AllaPortSpellAnvilScript

   Begin ScriptEffectStart
      Player.MoveTo AllaAnvilPortMarker01
   End

 

 

So I changed "Begin GameMode" to that for the message box version, and.... It still doesn't work.  You cast, the menu comes up, you click a town, and.... Nothing.  It doesn't even take away the 2 gold piece fee.  (I console-gave myself 100 gold just to be sure I had moneys)

 

There must be something really simple I'm messing up... I just can't figure what.

 

Spoiler


 

ScriptName AllaTravelSpellsScript

;Lets you choose a destination, pay for a port to it, and go there

Short Choosing
Short Choice

Begin ScriptEffectStart
    Set Choosing to 1
End



Begin GameMode
    If ( Choosing == 0 )
        return
    Endif

    If (Choosing == 1)
        MessageBox "Where do you want to go?", "Anvil", "Bravil", "Bruma", "Cheydinhal", "Chorral", "Imperial City Bridge", "Leyawiin", "Skingrad", "Nowhere"
        Set Choosing to 2
        Set Choice to -1

    Elseif (Choosing == 2)
        If (Choice == -1) ;No choice yet
            Set Choice to GetButtonPressed
            return

        Elseif Choice == 0 ;AnvilMainEntrance        
            If (Player.GetItemCount Gold001 >= 2)
                Player.RemoveItem Gold001 2
                Set Choosing to 0
                Player.MoveTo AllaAnvilPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf (Choice == 1) ;BravilExterior17        
            If (Player.GetItemCount Gold001 >= 2)
                Player.RemoveItem Gold001 2
                Set Choosing to 0
                Player.MoveTo AllaBravilPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf Choice == 2 ;BrumaMainEntrance        
            If (Player.GetItemCount Gold001 >= 2)
                Player.RemoveItem Gold001 2
                Set Choosing to 0
                Player.MoveTo AllaBrumaPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf (Choice == 3) ;CheydinhalStable01        
            If (Player.GetItemCount Gold001 >= 2)
                Player.RemoveItem Gold001 2
                Set Choosing to 0
                Player.MoveTo AllaCheyPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf


        Elseif Choice == 4 ;ChorralStables00        
            If (Player.GetItemCount Gold001 >= 2)
                Player.RemoveItem Gold001 2
                Set Choosing to 0
                Player.MoveTo AllaChorPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf (Choice == 5) ;IC Bridge WawnetInnExterior       
            If (Player.GetItemCount Gold001 >= 2)
                Player.RemoveItem Gold001 2
                Set Choosing to 0
                Player.MoveTo AllaICBPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf Choice == 6 ;LeyawiinStables00        
            If (Player.GetItemCount Gold001 >= 2)
                Player.RemoveItem Gold001 2
                Set Choosing to 0
                Player.MoveTo AllaLeyaPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        ElseIf (Choice == 7) ;SkingradSuralieVinyards        
            If (Player.GetItemCount Gold001 >= 2)
                Player.RemoveItem Gold001 2
                Set Choosing to 0
                Player.MoveTo AllaSkinPortMarker
            Else
                MessageBox "You can't afford that."
                Set Choosing to 0
            EndIf

        EndIf ;Choice block end


        Set Choosing to 0 ;to finish up

    EndIf ;Choosing block end

End

 

 

Edited by Allannaa
Link to comment

Your script should work.

 

And if you can compile the script in CS the reference names of the X Markers are right.

 Don't know why the console is not working ?  Player.moveto AllaAnvilPortMarker  must work.   if it doesn't work with the console, it can't work with the spell either.

There must be something wrong. . .  maybe you have deleted  or renamed XMarkers after you made the spript ?

 

But you say about the spell " Duration is set to 0  "  NO ! If duration is 0 the spell will not work. Set it to duration 5

Set the spell like in the picture in my post above ( TES4Edit Screenshot )

And here a CS Screenshot

spellCS.jpg

 

Yes  my german Oblivion.

selbst = self

Zauber = spell

Veränderung = alteration  ( you can use any other school you want )

 

-----------------

You use a copy of my spell   and if you also use a copy of my spell it must work, I tested it in game.

 

 

But if you have a Oblivion version with Shivering Isle you should block the spell in Shivering Isle or add the

                If GetPlayerInSEWorld == 1

                   SetPlayerInSEWorld 0

               endif

 

See my post above in the spoilers

 

Edited by fejeena
Link to comment

Okay.... I haven't worked on SI stuff yet because I hate that expansion.  I usually either ignore the quest for it, or cheat with the console and just "completequest" for all of them.

 

That aside....

 

On the ESP you gave me, Fejeena -- With the spell duration set to 5, Oblivion just crashes.

On my own test ESP -- the same thing.

 

If I set the duration to 0 the spell will cast.  The message box will come.  You click your place.

.........And you don't go anywhere.

 

I think I'm going to go off in a corner and cry!

Link to comment

Upload your esp. Or send with PM. I must see it in the esp.

 

My esp works is game. I used vanilla XMarker for testing.

 

------------------

And the SI  fix / block spell in SI.

You know when you travel to SI and back there is the "Set is in SI world" 

It must be set to 1 or 0 for the dialogs. If the setting is wrong you get the "I  have no greetings" bug with NPCs  . And then you must fix it with console.

Edited by fejeena
Link to comment

Wait, yours worked with the 5 second delay?  It did NOT work for me when I used your ESP.  It just crashed Oblivion, same as my own did.

 

When I make a single-destination travel spell, it goes straight to the appropriate X marker.  It's only when I try to make them all into this ONE spell that things go bad.

 

(If it matters, for testing, I have NO other mods loaded.  Just the one we're working on.)

 

The "teach spell" scroll is in the row boat at the ICPrisonSewerExit.  Or, from the CS the formID for it is xx000EDC  (but I don't know if it is the same formID for anyone else.)

 

Oh Also as you probably have noticed, everything I do, script or spell or NIF or whatever, it starts with "Alla" mainly so it's easy to find and fix when I screw something up.

 

AllaTeleTests.esp

Edited by Allannaa
Link to comment

If it matters, I opened the console as soon as the game had loaded all the way.  It does say "xOBSE22.6.1 loaded successfully"

 

And no joke, I seriously only have Oblivion.esm selected, plus either your ESP or mine depending on which one I'm trying to figure out.  And I let BOSS sort the load order.  Like that matters with only 1 mod active, hehe -- But it's my habit to run BOSS, so I just did it without thinking.

 

Now it IS possible there's something wrong with my installation somewhere.  Since I don't run any heavy duty mods, I let Steam do what it wanted when I bought the latest Oblivion version.  I had lost my old Oblivion disk, so I couldn't play, so I had to get the Steam version.  I have the DLCs that came with it, but I leave those unselected except for SI.  But as I said, I never actually play SI.  It's too creepy!

 

So Oblivion and the CS are installed in the ProgramFiles(x86) > Steam > SteamApps > Common > Oblivion.  (Basically same directory as Skyrim) I put OBSE where the ReadMe on the GitHub said to put it, and I run Oblivion the way the OBSE ReadMe said to do it.

 

EDIT -- also last night I deleted Oblivion, then re-acquired it from Steam, on the chance I had messed up my installation.

 

It didn't help.  If that teleport spell has a duration other than 0 the game crashes.

 

Is there a way to get a crash log similiar to how you can for Skyrim?  So maybe I could at least figure why my game crashes and fix it?

Edited by Allannaa
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
√ó
√ó
  • Create New...