Having a look at the script for the pitching machine ("TRAPPitchingMachineScript", see below), it is split into the following sections:
- When first loaded, initialise variables that control state, ammunition, and rate of fire
- When activated, if the trap is armed, either trigger it or (if the player activated it) initiate the skill check for disarming the trap
- If the player can disarm the trap, check if they want to do so and, if they do, disarm the trap and award experience
- If the trap has been triggered, fire balls regularly until there are none left (controlled by variables set up previously)
The state of the trap is controlled mostly by the variables "
isArmed" and "
isFiring". When the trap is set up, "
isArmed" is set to 1, and "
isFiring" is set to 0. When the trap is activated, "
isArmed" is set to 0, and if the trap has not been disarmed "
isFiring" is set to 1. When the trap runs out of ammunition, "
isFiring" is set to 0.
If you want to re-arm the trap once it has been triggered, you'll need to allow the player to set the "
isArmed" variable back to 1, and you'll also need to set "
ballcount" to a positive value in order to give the trap more ammunition to use.
Here's the vanilla script:
scn TRAPPitchingMachineScript;This script runs the pitching machine.short skillPassed ;check to see if the player has activated the trap. 1=activated, 0=not activatedshort button ;0 = disarm, 1 = don't disarmshort isArmedshort isFiringshort rewardXPOnceshort XPForDisarmfloat fireIntervalshort ballcountshort windUp ;check to see if it is starting upshort init;========================================begin onLoad if init == 0 setStage NQlvl 1 set skillPassed to 0 set isFiring to 0 set isArmed to 1 set ballcount to 12 ;number of balls to shoot -12 set fireInterval to 0.50 ;about 20 frames set init to 1 endifend;========================================;========================================begin onActivate if isArmed == 1 if getActionRef == player if player.getAV repair >= NQlvl.TRAPPitchingSkillReq ;This var is set when the NQlvl stage is set to 1 ShowMessage TrapPitchingDetectMsg ;do you want to take the grenades? set skillPassed to 1; else ShowMessage TrapLowSkillRepairMsg NQlvl.TRAPPitchingSkillReq endif else set isFiring to 1 set isArmed to 0 playgroup left 1 ;startup animation ; set windup to 1 endIf endifend;============================================begin gameMode if skillPassed == 1 ;don't run stuff in game mode unless recently activated set button to getButtonPressed ;grab the button state, you don't know when this will be set if button > -1 ;if a valid response is received start doing stuff if button == 1 ShowMessage TrapDisarmMsg set isArmed to 0 ;disarm the trap if rewardXPOnce == 0 if NQlvl.TRAPPitchingSkillReq< getGS iLockLevelMaxVeryEasy set XPForDisarm to 0 elseif NQlvl.TRAPPitchingSkillReq< getGS iLockLevelMaxEasy set XPForDisarm to TrapXPRewardVeryEasy elseif NQlvl.TRAPPitchingSkillReq< getGS iLockLevelMaxAverage set XPForDisarm to TrapXPRewardEasy elseif NQlvl.TRAPPitchingSkillReq< getGS iLockLevelMaxHard set XPForDisarm to TrapXPRewardAverage elseif NQlvl.TRAPPitchingSkillReq< getGS iLockLevelMaxVeryHard set XPForDisarm to TrapXPRewardHard else set XPForDisarm to TrapXPRewardVeryHard endif set rewardXPOnce to 1 rewardXP XPforDisarm endif endif set skillPassed to 0 ;stop running stuff endif endif if isFiring == 1 if ballcount > 0 ;check to make sure there are enough balls ;wait, fire if fireInterval > 0 set fireInterval to fireInterval - GetSecondsPassed else playgroup forward 0 ;looping run animation set ballcount to ballcount -1 FireWeapon TrapBaseball set fireInterval to 0.5 endif else set isFiring to 0 playgroup right 0 ;end animation, ends looping sound. endif endifend
Note that the "
windUp" variable is not used anywhere, so feel free to delete it entirely.
Cipscis
EDIT:
With respect to the mailbox script, a http://www.cipscis.com/fallout/tutorials/staged_timers.aspx will work well for that, as
Gunmaster95 suggested. Instead of using explicit reference syntax to specify which reference to call http://geck.gamesas.com/index.php/PlaceAtMe and http://geck.gamesas.com/index.php/Disable on, you should just use implicit reference syntax to call them on the scripted reference, i.e.
Disable; instead ofMailboxRef.Disable
If you want the mailbox to still open when activated, you'll probably need to use http://geck.gamesas.com/index.php/PlayGroup in order for it to play the animation. Play around with it in the console to determine which group to use - my guess is "Forward". You'll also need to use http://geck.gamesas.com/index.php/SetPos if you want the grenade to appear in the correct location - http://geck.gamesas.com/index.php/PlaceAtMe will simply create it in a nearby "safe" area.
Cipscis