machoMADmax Posted July 1, 2015 Share Posted July 1, 2015 (edited) 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 activatedshort button ;0 = disarm, 1 = don't disarmshort isArmedshort isFiringshort rewardXPOnceshort XPForDisarmfloat fireIntervalshort ballcountshort windUp ;check to see if it is starting up short init ;======================================== begin onLoad if init == 0setStage NQlvl 1set skillPassed to 0set isFiring to 0set isArmed to 1set ballcount to 1 ;number of balls to shoot -1set fireInterval to 2.00 ;about 5 framesset init to 1endif end ;======================================== ;======================================== begin onActivate if isArmed == 1if getActionRef == playerif player.getAV repair >= NQlvl.TRAPPitchingSkillReq ;This var is set when the NQlvl stage is set to 1ShowMessage TrapPitchingDetectMsg ;do you want to take the grenades?set skillPassed to 1;elseShowMessage TrapLowSkillRepairMsg NQlvl.TRAPPitchingSkillReqendifelseset isFiring to 1set isArmed to 0playgroup left 1 ;startup animation; set windup to 1endIfendif 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 setif button > -1 ;if a valid response is received start doing stuffif button == 1ShowMessage TrapDisarmMsgset isArmed to 0 ;disarm the trap if rewardXPOnce == 0if NQlvl.TRAPPitchingSkillReq< getGS iLockLevelMaxVeryEasyset XPForDisarm to 0elseif NQlvl.TRAPPitchingSkillReq< getGS iLockLevelMaxEasyset XPForDisarm to TrapXPRewardVeryEasyelseif NQlvl.TRAPPitchingSkillReq< getGS iLockLevelMaxAverageset XPForDisarm to TrapXPRewardEasyelseif NQlvl.TRAPPitchingSkillReq< getGS iLockLevelMaxHardset XPForDisarm to TrapXPRewardAverageelseif NQlvl.TRAPPitchingSkillReq< getGS iLockLevelMaxVeryHardset XPForDisarm to TrapXPRewardHardelseset XPForDisarm to TrapXPRewardVeryHardendif set rewardXPOnce to 1rewardXP XPforDisarmendif endifset skillPassed to 0 ;stop running stuff endifendif if isFiring == 1if ballcount > 0 ;check to make sure there are enough balls;wait, fireif fireInterval > 0 set fireInterval to fireInterval - GetSecondsPassedelseplaygroup forward 0 ;looping run animationset ballcount to ballcount -1FireWeapon 000ATRAPFragGrenadeset fireInterval to 2.5endifelseset isFiring to 0playgroup right 0 ;end animation, ends looping sound.endifendif end Edited July 1, 2015 by machoMADmax Link to comment Share on other sites More sharing options...
DaemonGrin Posted July 2, 2015 Share Posted July 2, 2015 The first thing that pops up in my head is the grenadefrag weapon says it has a clip of 12 might check that out? Link to comment Share on other sites More sharing options...
Recommended Posts