Jump to content

Problems while scripting


Mage Phil

Recommended Posts

Hello,

this is my first topic I opened at all so i´m not sure if this is the correct section to put it into :|

 

i started trying to edit a script in oblivion which makes mounts flying, in my opinion everything would work but it doesn´t -.-

 

 

scn 12fliegen

 

; Saiden Storm's Mounted Flight Script :)

 

ref Ich ; Earth Drake Reference

ref FlightPlane ; Flight Plane Ref

float XPos ; X Position

float YPos ; Y Position

float ZPos ; Z Position

float XAngle ; Flight Planes X Rotation Angle

float Height ; Players X Angle, Used To Rotate FlightPlane

float Direction ; Direction EarthDrake Is Facing

 

;Set up references and condition for Flight

 

Begin Gamemode

 

Set Ich to Player

Set FlightPlane to SSPlattform

SetIgnoreFriendlyHits 1

 

;Set FlightPlane to Under EarthDrake when player is riding him and is running

 

If Player.IsRunning == 1

Set XPos to Ich .GetPos X

Set YPos to Ich .GetPos Y

Set ZPos to Ich .GetPos Z

Set Direction to Ich .GetAngle Z

Set Height to (Player.GetAngle X)

 

; Adjusts Height to avoid the player from creating an unpassable wall or falling of the FlightPlane

 

If Height < -30

Set Height to -30

Endif

 

If Height > 40

Set Height to 40

Endif

 

; Reposition the FlightPlane so it is always under the EarthDrake in Flight

 

If Player.GetDistance FlightPlane > 400

FlightPlane.SetPos X, XPos

FlightPlane.SetPos Y, YPos

FlightPlane.SetPos Z, ZPos

Endif

 

; Sets the Tilt of the FlightPlane Based on EarthDrake Facing Direction and Player "X" Angle

 

If Direction > 0 && Direction < 90

FlightPlane.SetAngle X, Height

Set Height to -Height

FlightPlane.SetAngle Y, Height

Endif

 

If Direction > 90 && Direction < 180

Set Height to -Height

FlightPlane.SetAngle X, Height

FlightPlane.SetAngle Y, Height

Endif

 

If Direction > 180 && Direction < 270

FlightPlane.SetAngle Y, Height

Set Height to -Height

FlightPlane.SetAngle X, Height

Endif

 

If Direction > 270 && Direction < 360

FlightPlane.SetAngle X, Height

FlightPlane.SetAngle Y, Height

Endif

 

; Makes it so if you are riding EarthDrake and Running the FlightIdle will play

 

 

 

;Set FlightPlane Above EarthDrake when Player is walking

 

Elseif Player.isRunning != 1

Set XPos to Ich .GetPos X

Set YPos to Ich .GetPos Y

Set ZPos to Ich .GetPos Z + 1000

FlightPlane.SetPos X, XPos

FlightPlane.SetPos Y, YPos

FlightPlane.SetPos Z, ZPos

 

; Set FlightPlane to Above EarthDrake When Player is not riding him

 

 

Endif

 

End

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

 

scn 13fliegensetup

 

; This script is to set up mounted flight

 

ref Ich ; Earth Drake Reference

ref FlightPlane ; Flight Plane Referance

short Follow ; Variable for the Follow Package

short Wander ; Variable for the Wander Package

 

 

;Set up references and condition for Flight

 

Begin Gamemode

 

Set Ich to Player

Set FlightPlane to SSPlattform

 

; Set the Flight Plane into the same cell as EarthDrake

 

If FlightPlane.GetInSameCell Ich != 1

FlightPlane.MoveTo Ich

Endif

 

 

 

End

 

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

 

scn 14fliegenpeg

 

; This script is for a Mount that lets you fly

 

ref Mount ; get a ref to Mount

float xfactme ; position in x

float yfactme ; position in y

float zfactme ; position in z hight

float height ; value that modifies position in z

float direc ;The direction the player is facing

float Speed ; How much the speed is reduced

short toggle ; used to se if direction is set

short toggle2 ; used to se if flying has happend

 

;Set up reference's and make player running = flight and player walking = idle

 

Begin Gamemode

Set Mount to Player

Set Mount to GetSelf

Mount.ResetFallDamageTimer

if Player.IsRidingHorse == 1 && Player.GetDistance Mount< 512

if Mount.IsRunning == 1

Mount.PlayGroup FastForward, 0

set toggle to 0

set toggle2 to 1

 

;Set the mounts speed

 

set Speed to 15 * GetSecondsPassed

 

;Prevent excessive speeds

 

if Speed > 4

set Speed to 4

endif

 

;Go up and down

 

set zfactme to Mount.GetPos z

set height to (Player.GetAngle X) * Speed

set zfactme to zfactme - height

 

;The start position for movement

 

set xfactme to Mount.GetPos x

set yfactme to Mount.GetPos y

set direc to Mount.GetAngle z

 

;Direction 0-89

 

if direc < 90 && toggle == 0

set toggle to 1

set yfactme to yfactme + ( 90 - direc ) * Speed

set xfactme to xfactme + ( direc - 0 ) * Speed

endif

 

;Direction 90-179

 

if direc < 180 && toggle == 0

set toggle to 1

set direc to direc - 90

set yfactme to yfactme + ( 0 - direc ) * Speed

set xfactme to xfactme + ( 90 - direc ) * Speed

endif

 

;Direction 180-269

 

if direc < 270 && toggle == 0

set toggle to 1

set direc to direc - 180

set yfactme to yfactme + ( direc - 90 ) * Speed

set xfactme to xfactme + ( 0 - direc ) * Speed

endif

 

;Direction 270-360

 

if toggle == 0

set toggle to 1

set direc to direc - 270

set yfactme to yfactme + ( direc - 0 ) * Speed

set xfactme to xfactme + ( direc - 90 ) * Speed

endif

 

;Move the horse in the direction

 

Mount.SetPos y, yfactme

Mount.SetPos x, xfactme

Mount.SetPos z, zfactme

endif

 

;Prevents the mount from falling

 

Mount.SetScale 1.0

 

endif

 

if Mount.IsRunning != 1 && toggle2 == 1

Mount.Playgroup Idle, 0

set toggle2 to 0

endif

end

 

 

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

 

the comments of the author don´t fit anymore :)

thanks for help

Link to comment
Share on other sites

What exactly doesn't work with it?

An obvious thing I can suggest is "never start your names with numbers"! The compiler will think it's a formid (hex-number) and nothing will work.

Perhaps that's it already. If not, could you give some more information about what isn't working?

Link to comment
Share on other sites

No, "Mount" is a simple reference variable. It is first set to the player, then immediately afterwards to the object the script is running on.

I take it those scripts are also used in the same conditions as the originals from Saiden? That is Quest scripts are attached to quests which are either started at game start ("start game enabled") or by you yourself from console later ("startquest XXX"), and Object scripts are attached and running on the objects they're meant to be on, namely the mount creature in this case, and I don't really know what else which ones of them need to be attached to? As far as I can see there's at least no Spell script, but that could be the GameMode blocks misleading as well.

 

Given the complexity of this mechanism I'd say you will need some debug outputs at one point or another, telling you a script line was actually reached, so you can better check at which point it goes wrong and why.

If not even the first line gets executed, then the use of the scripts itself is wrong, for example.

 

This could be either text message output or output to console, or you could just add a line like "Mount.ModAV Fatigue -50000" right after "set Mount to GetSelf" and hopefully the creature will drop down unconscious ingame... things like that. I personally like to use PlayMagicShaderVisuals or PMS and then codes for like fire or lightning or some such, and then I check the actors who should be affected by my script if they're really "on fire" or "electrocuted"... serves as a fine debug mechanism, but definitely serves as a cause for laughter as well :thumbsup:

Edited by DrakeTheDragon
Link to comment
Share on other sites

  • Recently Browsing   0 members

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