Here is the switches script.
Spoiler
scn PGMQ4Test17C1StartSwitchSCRIPTShort TestOnShort Bottle[censored]Short CheckDelayShort AmmoCountFloat TimerBegin OnActivate If TestOn == 0 ; if the test isnt already going or done, start it EnablePlayerControls 0 0 1 0 0 0 0 ; enable fighting Player.AddItem PGMQ4Test17C132Pistol 1 1 Player.EquipItem PGMQ4Test17C132Pistol 1 Player.AddItem PGMQ4T17C1Ammo32Caliber 10 Set TestOn to 1 ; give the player the gun, equip it, and give them ammo, then set the test to started (teston == 1) EndIfEndBegin GameMode If Bottle[censored] == 5 && TestOn == 1 ; if they knock down all 5 bottles and the test is on, complete it Set TestOn to 2 PlaySound XXXPlaceholderBeep Set AmmoCount to Player.GetItemCount PGMQ4T17C1Ammo32Caliber Player.RemoveItem PGMQ4T17C1Ammo32Caliber AmmoCount 1 Player.RemoveItem PGMQ4Test17C132Pistol 1 ; play a 'win' sound, take their gun and remaining ammo, and set the test to complete ElseIf Player.GetItemCount PGMQ4T17C1Ammo32Caliber == 0 && TestOn == 1 && CheckDelay == 0 ; if the test is on, and they are out of ammo Set CheckDelay to 1 ; let the timer run Set Timer to 3 ; allow 3 seconds for flying bottles to settle incase their last shot hits the last bottle, so they dont loose instantly EndIf If Timer > 0 && CheckDelay == 1 ; if they are out of ammo and its checking Set Timer to Timer - GetSecondsPassed ElseIf Bottle[censored] < 5 && CheckDelay == 1 Set TestOn to 0 ; fail the test and set it to 'not started' PlaySound OBJBuzzerBell ; play lose sound Set CheckDelay to 0 ; stop checking if they failed Set Bottle[censored] to 0 ; reset the score of bottles shot Player.RemoveItem PGMQ4Test17C132Pistol 1 ; take away the pistol, ammo not neccisary as they are out PGMQ4T17C1B1.MoveTo PGMQ4T17C1B1Ref PGMQ4T17C1B2.MoveTo PGMQ4T17C1B2Ref PGMQ4T17C1B3.MoveTo PGMQ4T17C1B3Ref PGMQ4T17C1B4.MoveTo PGMQ4T17C1B4Ref PGMQ4T17C1B5.MoveTo PGMQ4T17C1B5Ref Set PGMQ4T17C1B1.DoOnce to 0 Set PGMQ4T17C1B2.DoOnce to 0 Set PGMQ4T17C1B3.DoOnce to 0 Set PGMQ4T17C1B4.DoOnce to 0 Set PGMQ4T17C1B5.DoOnce to 0 PGMQ4T17C1B1.Reset3DState PGMQ4T17C1B2.Reset3DState PGMQ4T17C1B3.Reset3DState PGMQ4T17C1B4.Reset3DState PGMQ4T17C1B5.Reset3DState ; last fiften lines are my attempt at resetting the bottles to sitting on their little stands properly, not succesfull fully EndIfEnd
Everywhere it says Bottle[censored], it should says Bottles*hit (without the *) but the S and Hit make it censore it. -_- The bottles dont reset properly. They go to the right place, but are tipped over, or take like 3 hits before they move...
Here is the triggers script.
Spoiler
scn PGMQ4Test17C1EndTriggerSCRIPTShort AmmoCountBegin OnTriggerLeave ; if they leave the area If PGMQ4Test17C1StartSwitchRef.TestOn == 1 ; if the test is going Set PGMQ4Test17C1StartSwitchRef.TestOn to 0 ; stop the test, play lose sound remove gun, remaining ammo, and reset bottles and score PlaySound OBJBuzzerBell Set PGMQ4Test17C1StartSwitchRef.CheckDelay to 0 Set PGMQ4Test17C1StartSwitchRef.Bottle[censored] to 0 Player.RemoveItem PGMQ4Test17C132Pistol 1 PGMQ4T17C1B1.MoveTo PGMQ4T17C1B1Ref PGMQ4T17C1B2.MoveTo PGMQ4T17C1B2Ref PGMQ4T17C1B3.MoveTo PGMQ4T17C1B3Ref PGMQ4T17C1B4.MoveTo PGMQ4T17C1B4Ref PGMQ4T17C1B5.MoveTo PGMQ4T17C1B5Ref PGMQ4T17C1B1.Reset3DState PGMQ4T17C1B2.Reset3DState PGMQ4T17C1B3.Reset3DState PGMQ4T17C1B4.Reset3DState PGMQ4T17C1B5.Reset3DState ; again attempt at resetting bottles Set AmmoCount to Player.GetItemCount PGMQ4T17C1Ammo32Caliber Player.RemoveItem PGMQ4T17C1Ammo32Caliber AmmoCount 1 EndIfEnd
And last here is the script on the empty soda cans.
Spoiler
scn PGMQ4T17C1SodaBottleSCRIPTShort DoOnceBegin GameMode If DoOnce == 0 If GetPos Z < 1910 ; if they fall below their stand (roughly 1910 on the z axis) Set PGMQ4Test17C1StartSwitchRef.Bottle[censored] to PGMQ4Test17C1StartSwitchRef.Bottle[censored] + 1 ; set the score to score + 1 Set DoOnce to 1 ; dont set the score to + 1 more than once, this is reset in the switch and trigger scripts above to 0, so if some fell they are reset EndIf EndIfEnd
Pretty much I got it somewhat working. But I think I did it in a really complicated manner. Can anyone suggest a simpler way to achieve this? Or a better way to write my scripts? Also the things that arent working are, the bottles dont reset to the right postion. Should I just add a set angle x, y and z to them to they stand up straight? Also, I will be setting up this whole scenario 6 times total, this being the first. Can I make any of these scripts more generic so I can, for example, just throw in a Linked ref instead of a specific script and reference? I tried using GetLinkedRef on the bottles to set the score up one, but it was no good.
Please ask any questions necissary to help, like if I need to clerify anything. I need to get this working first thing tomorrow morning, then do the other 5 scenarios of it. Thanks sooo much for any help!!!!
Gunmaster95