Deleted1205226User Posted November 28, 2018 Share Posted November 28, 2018 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 XIniPosfloat YIniPosfloat ZIniPosfloat XIniAnglefloat YIniAnglefloat ZIniAngleshort 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 endifEnd 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 ActivateEnd Link to comment Share on other sites More sharing options...
Deleted1205226User Posted November 28, 2018 Author Share Posted November 28, 2018 Must be the 01Ref. I've read it countless time: don't start Ref id with number... :dry: Link to comment Share on other sites More sharing options...
GamerRick Posted November 29, 2018 Share Posted November 29, 2018 (edited) 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 November 29, 2018 by GamerRick Link to comment Share on other sites More sharing options...
Deleted1205226User Posted November 29, 2018 Author Share Posted November 29, 2018 The OnLoad is an excellent suggestion, thanks for that! (It's a looong time since I scripted anything) Link to comment Share on other sites More sharing options...
Mktavish Posted December 1, 2018 Share Posted December 1, 2018 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 More sharing options...
Recommended Posts