Jump to content

Pitching Machine Grenade Trap Help


machoMADmax

Recommended Posts

Hi. I'm attempting to rework the pitching machine trap so that it will fire one single grenade. I've managed to get the trap to fire said grenades but I'm currently having trouble w/ it firing only one grenade. Currently it is firing 12 grenades which is... not good. I've fiddled around with the code for what seems like hours on end, yet I've been unable to get it working. Any help would be dearly appreciated.

 

 

scn TRAPPitchingMachineScript
;This script runs the pitching machine.
short skillPassed ;check to see if the player has activated the trap. 1=activated, 0=not activated
short button ;0 = disarm, 1 = don't disarm
short isArmed
short isFiring
short rewardXPOnce
short XPForDisarm
float fireInterval
short ballcount
short windUp ;check to see if it is starting up
short init
;========================================
begin onLoad
if init == 0
setStage NQlvl 1
set skillPassed to 0
set isFiring to 0
set isArmed to 1
set ballcount to 1 ;number of balls to shoot -1
set fireInterval to 2.00 ;about 5 frames
set init to 1
endif
end
;========================================
;========================================
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
endif
end
;============================================
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 000ATRAPFragGrenade
set fireInterval to 2.5
endif
else
set isFiring to 0
playgroup right 0 ;end animation, ends looping sound.
endif
endif
end
Edited by machoMADmax
Link to comment
Share on other sites

  • Recently Browsing   0 members

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