Jump to content

Reset script problem


Deleted1205226User

Recommended Posts

This script is placed on an activator and reset object placement upon activation.

I can't compile it and I don't understand why.

Any idea?

 

 

Float XIniPos
float YIniPos
float ZIniPos
float XIniAngle
float YIniAngle
float ZIniAngle
short DoOnce


Begin GameMode

if DoOnce == 0
Set XIniPos to 01Ref.GetPos X
Set YIniPos to 01Ref.GetPos Y
Set ZIniPos to 01Ref.GetPos Z
Set XIniAngle to 01Ref.GetAngle X
Set YIniAngle to 01Ref.GetAngle Y
Set ZIniAngle to 01Ref.GetAngle Z
Set DoOnce to 1
endif
End


Begin OnActivate

01Ref.SetPos to XIniPos
01Ref.SetPos to YIniPos
01Ref.SetPos to ZIniPos
01Ref.SetPos to XIniAngle
01Ref.SetPos to YIniAngle
01Ref.SetPos to ZIniAngle
Activate
End

 

Link to comment
Share on other sites

Was that it? I see another thing. Instead of using the GameMode block (which runs every frame) to init things, use an OnLoad block (which only runs once when the player enters that interior cell or gets near that exterior cell. You still need the DoOnce check. So just change GameMode to OnLoad.

 

Also, if you wanted that script to potentially work for anything else, you can set the activator's LinkedRef to the 01Ref object, and then in the script:

ref LRef

Begin OnLoad

    if DoOnce == 0
        Set LRef to GetLinkedRef
        ...etc...
    endif
end

Begin OnActivate
     
     LRef.SetPos to XIniPos
    ....etc....
end
Edited by GamerRick
Link to comment
Share on other sites

That script will only reset the position one time though.

 

So to make it reusable , put this line at the end of the "OnActivate" block ...

 

Set DoOnce to 0

 

@ GamerRick Good thinking with the linked ref ;)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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