Jump to content

Mod Scripting Problem


demonflame

Recommended Posts

Hi, I'm making a mod for oblivion that teleports you into a hospital-type room when you get below a specific number of health. Everything's set up... But the script doesn't work... Please help me. Here's my script:

 

ScriptName 0HospitalTpScript

 

Begin GameMode Player ;my begin command used and so it only affects the player

If ( player.getcurrenthealth << 15 ) ;so it runs when the player's health is lower than 15

player.moveto 0100110C ;where the player must be moved to (custom)

cast StandardRestoreHealth5Master player ;to heal the player

player.setcrimegold 0 ;to set the crime gold to 0

player.payfine ;to pay the - now 0 gold - fine

player.removeitem f 100 ;to remove 100 gold

EndIf

End

 

(I only added the discriptions for this post)

 

Please help me? Thanks in advance.

Link to comment
Share on other sites

Your script doesn't work because you are either using invalid functions, or are using them wrong. With the player, you should almost always use movetomarker rather than moveto, the location is predetermined and fixed, so you might as well use the more stable command which is not tied to whatever the pivot point is of the form you were using. Additionally, any time you move the player, the movement will act as a return command, ending the script. With cast, you should only use low cost, or no cost spells if you are having an actor use the spell. Casting a spell you don't have the magicka for can cause some problems. Having the spell cast by the player, on the player can also make for some annoyances. Having a nearby activator cast a targeted heal on the player would probably be the better way, but using an ability with a high magnitude heal that is removed almost immediately works just as well. Another way to do this might be to just have the script apply a low magnitude heal ability, and make the script check for when the player leaves the cell to determine when to remove this ability.

 

Try this.

 

short moving

Begin gamemode;; or Begin Scripteffectupdate if attached to an ability
if player.getav health <= 15
if moving == 0
set moving to 1
player.movetomarker <name of marker placed where you want the player to go
elseif moving == 1
set moving to 2
player.addspell <ID of ability with a very large restore health effect>
player.setcrimegold 0 
player.removeitem f 100
endif
elseif player.getav health >= 30 && moving == 2
player.removespell <Spell ID>
set moving to 0
endif
end

 

This script should be attached to either a quest or made into a scripted effect on an abity which is added to the player somehow. If you don't, the script will only end up running when whatever you attach it to is in the current, loaded cell.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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