WillWorthington3 Posted March 28, 2011 Share Posted March 28, 2011 ScriptName aaTortureCageSwitchScript ref myParent ref mySelf short initialized short Busy short Open short AlreadyOpened float timer Begin OnActivate If Busy == 0 && Open == 0 set mySelf to getSelf set myParent to getParentRef set Busy to 1 set Open to 1 set timer to 2 message "The prisoner has been condemned." ElseIf Busy == 1 message "You may not use this switch at this time." ElseIf Busy == 0 && Open == 1 message "SOMETHING IS WRONG" set Busy to 1 EndIf End Begin GameMode If timer > 0 set timer to timer - getSecondsPassed EndIf If timer <= 0 && Open == 1 && AlreadyOpened == 0 myparent.activate mySelf 1 set AlreadyOpened to 1 EndIf If IsAnimPlaying == 0 set Busy to 0 set Open to 0 Reset3dState EndIf End The above code is me trying to make a reusable script that will open a cage and drop it's occupant to a fiery death. I use this to reset things: ScriptName aaTortureResetScript Begin OnActivate message "The prisoner has been resurrected." wTortureHangingCageRef.Reset3dState wLabsPrisonerRef.Resurrect wLabsPrisonerRef.MoveTo TortureVictemRecall wLabsPrisonerRef.Evp End Please, please, please someone tell me where I'm going wrong here. I've been going at it for 2 days now =/ Link to comment Share on other sites More sharing options...
fg109 Posted March 28, 2011 Share Posted March 28, 2011 (edited) I'm just a beginner myself, but I think that if you have an OnActivate block, then the object doesn't activate normally unless you have it in your script. So you need something like: Begin OnActivate If Busy == 0 && Open == 0 set mySelf to getSelf set myParent to getParentRef set Busy to 1 set Open to 1 set timer to 2 message "The prisoner has been condemned." Activate ElseIf Busy == 1 message "You may not use this switch at this time." ElseIf Busy == 0 && Open == 1 message "SOMETHING IS WRONG" set Busy to 1 EndIf End Edited March 28, 2011 by fg109 Link to comment Share on other sites More sharing options...
WillWorthington3 Posted March 28, 2011 Author Share Posted March 28, 2011 Thanks for the suggestion, but, sadly, no dice =/ I'll keep at it. Link to comment Share on other sites More sharing options...
fg109 Posted March 28, 2011 Share Posted March 28, 2011 (edited) Exactly what happens when you try and use your script? You should put in more debug messages so you know which step it's stopping at. Try this: ScriptName aaTortureCageSwitchScript ref mySelf ref myParent short Open float timer Begin OnActivate If Open == 0 set mySelf to getSelf set myParent to getParentRef set Open to 1 set timer to 2 message "The prisoner has been condemned." Activate ElseIf Open == 1 message "You may not use this switch at this time." EndIf End Begin GameMode If timer > 0 && Open == 1 set timer to timer - getSecondsPassed message "Countdown: %.1f seconds" timer Return ElseIf timer <= 0 && Open == 1 myparent.activate myself 1 set Open to 2 message "Dropping prisoner" EndIf If Open == 2 If IsAnimPlaying == 0 set Open to 0 Reset3dState message "resetting switch" Endif EndIf End ScriptName aaTortureResetScript float timer short initialize Begin OnActivate set timer to 5 set initialize to 1 Activate End Begin GameMode if initialize == 1 && timer >= 0 set timer to timer - GetSecondsPassed Return elseif timer < 0 set timer to 0 set initialize to 0 message "The prisoner has been resurrected." wTortureHangingCageRef.Reset3dState wLabsPrisonerRef.MoveTo TortureVictemRecall wLabsPrisonerRef.Resurrect wLabsPrisonerRef.Evp endif End Edited March 28, 2011 by fg109 Link to comment Share on other sites More sharing options...
WillWorthington3 Posted March 29, 2011 Author Share Posted March 29, 2011 That's a damn good idea, I'll try it out and let you know. Link to comment Share on other sites More sharing options...
Recommended Posts