home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1999-11-29 | 37.5 KB | 1,386 lines
if(VActorFlag==_AFLAGattached && VAICon==0)//for 2-man animation, changes guy who punches him in the face into an enemy { print("IM DOING ATTACHED ACTION. STILL HERE 777777777777777"); } float(_declare,RandomGnkNoisem,0); float(_declare,RandomGnkNoisea,200); float(_declare,ShootDelayCounter,0) float(_declare,JumpIdleCounter,0); float(_declare,JumpPressCounter,0); float(_declare,DownwardPull,0); float(_declare,TurnSpeed,0); float(_declare,ColAngleCorrectNeeded,0); float(_declare,ForceRunFrames,0); float(_declare,AirSpeedForward,0); float(_declare,AirSpeedSideways,0); float(_declare,FallStartAltitude,0); float(_declare,SmokeCount,1000); float(_declare,FireCount,0); float(_declare,ActionOK,1); float(_declare,KeyPressCounter,0); float(_declare,ActorDeathType,0); float(_declare,DropDelay,100); float(_declare,DieCounter,0); float(_declare,stickumDelay,0); //float(_declare,batterydelay,0); float(_declare,riotshieldhitcount,0); float(_declare,riotshieldoncount,18); float(_declare,riotshieldoffcount,0); float(_declare,CurrentDirection,_DIRforward|_DIRwalking); float(_declare,SeenFlag,0); //used in aicode float(_declare,Counter,0); //Not Used? float(_declare,AIChoiceVar,0); float(_declare,AIEncounterVar,0); float(_declare,AIGrenadeCounter,200); float(_declare,AILastPathTurn,0); float(_declare,limbblownoff,0); float(_declare,SteamCounter,0); float(_declare,GeigerCounter,0); vector(_declare,WeaponPickUpPos,0,0,0); if(VAICon==0) { callsub(Sub_PrintStates); } call(CheckColSphereOffset,GENClimbUp); if(VActorFlag==_AFLAGinitialize) //re-initialize after a loadgame { if(GeigerCounter==1) { sample(SFXGeigerCounter,-1); } } if(VActiveTime==0) { call(CheckForPickup,12,_ClassWeapon); callsub(Sub_ChangeStateToNormal); vector(_settoactorpos,TmpVector); vector(_copyy,TmpVector,FallStartAltitude); } callsub(Sub_SqueezeCheck,CopCrush); if(VActorFlag==_AFLAGnorotation) { print("Removing direction flags",TurnSpeed); Direction(_clr,_DIRleft|_DIRright); if(VAICon==0) { call(ClrAnalogValues); //for sub_turncharacter float(_set,TurnSpeed,0); } } float(_declare,PlayOnce,0); if(VAICon==0 && vstate==statedead && PlayOnce==0) { message("YOU CALL YOURSELF THE MESSIAH?",400,10); callsub(Sub_RandomWalkieKillSFX); float(_set,PlayOnce,1); call(ChangeSniperMode,0,0); } elseif(vstate!=statedead) { float(_set,PlayOnce,0); } if(VTrigger!=_DIRhavegun) { ActorFlag(_clr,_AFLAGlogon); } /* if(VAICon==0 && vstate==StateDead && VDifficulty==_DifficultyEasy) { message("YOU CALL YOURSELF THE MESSIAH ?",400,10); callsub(Sub_RandomWalkieKillSFX); call(ChangeSniperMode,0,0); } */ if(AIAbility&=_AIAFakeWeapon) { Direction(_or,_DIRhavegun); //to fool the enemies into believing she is packing } if(AIAbility&=_AIAHideWeapon && VTrigger==_DIRhavegun && VTrigger!=_DIRmove) { print("check for holster/unholster"); if(VTrigger==_DIRcombatmode) { print("Weapon visible"); if(VActorFlag==_AFlagweaponinvisible) { if(VAction==GENUnHolsterGun && VFrame==11) { ActorFlag(_clr,_AFLAGweaponinvisible); } else { spawnaction(GENUnHolsterGun); } } } else { print("Weapon invisible"); if(VActorFlag!=_AFlagweaponinvisible) { if(VAction==GENHolsterGun && VFrame==20) { ActorFlag(_or,_AFLAGweaponinvisible); } else { spawnaction(GENHolsterGun); } } } } if(AIAbility&=_AIAAlwaysInCombatMode) { Direction(_or,_DIRcombatmode); } if(VActorFlag==_AFLAGconfused && AIAbility&!=_AIAFlashVisors) { call(AIorder,_set,_AIstateConfused); call(AIorder,_set,_AIinspecialmode); } if(VActorFlag==_AFLAGradiated) { ActorFlag(_clr,_AFLAGradiated); if(VAIClass==_AIClassScientist&&VRank==_RankScum) // If radiation worker { if(GeigerCounter==0) { sample(SFXGeigerCounter,-1); float(_set,GeigerCounter,1); } } else { call(AIorder,_set,_AIstateRadioactive); call(AIorder,_set,_AIinspecialmode|_AIdontdopickdest); } } else { if(GeigerCounter==1) { samplestop(SFXGeigerCounter); float(_set,GeigerCounter,0); } } if(AIAbility&=_AIAShield && VActorFlag==_AFLAGshieldon) { print("Shield On: ",AIAbility); if(riotshieldhitcount>0) { //we've been hit ..aarrggghhhh!!!! callsub(Sub_riotshield,fx_riotshlda1hit,fx_riotshlda2hit,fx_riotshlda3hit,fx_riotshlda4hit,fx_riotshlda5hit,fx_riotshlda6hit,emptyfloat); float(_sub,riotshieldhitcount,1); } else { if(riotshieldoncount==18) { sample(SFXRiotShieldOn,-1); } if(riotshieldoncount>0) { //shield forming on callsub(Sub_riotshield,fx_riotshlda1on,fx_riotshlda2on,fx_riotshlda3on,fx_riotshlda4on,fx_riotshlda5on,fx_riotshlda6on,riotshieldoncount); float(_sub,riotshieldoncount,1); } else { //normal sheild active!!! callsub(Sub_riotshield,fx_riotshlda1,fx_riotshlda2,fx_riotshlda3,fx_riotshlda4,fx_riotshlda5,fx_riotshlda6,emptyfloat); } } float(_set,riotshieldoffcount,18); if(VTrigger==_DIRactorbulletcol) { if(VColAngle>3072 || VColAngle<1024) { sample(SFXRiotShield,-1); float(_set,riotshieldoncount,0); float(_set,riotshieldhitcount,18); call(RestoreOldHealth); //printilog("ColAngle: ",VColAngle); Direction(_clr,_DIRactorbulletcol); SpecialFlag(_clr,_sFLAGLostALimb); SpecialFlag(_clr,_sFLAGTargetAimKillShot); SpecialFlag(_clr,_sFLAGTargetAimCloseRange); ActorFlag(_clr,_AFLAGSniped); } } } else { float(_set,riotshieldhitcount,0); float(_set,riotshieldoncount,18); if(riotshieldoffcount==18) { sample(SFXRiotShieldOff,-1); } if(riotshieldoffcount>0) { float(_set,tmpfloat,18); float(_sub,tmpfloat,riotshieldoffcount); callsub(Sub_riotshield,fx_riotshlda1off,fx_riotshlda2off,fx_riotshlda3off,fx_riotshlda4off,fx_riotshlda5off,fx_riotshlda6off,tmpfloat); float(_sub,riotshieldoffcount,1); } } //don't move up higher than this to prevent sequencing problems if(VHealth<=0 && VTrigger==_DIRalive) { Direction(_clr,_DIRalive); //sample(SFXJustDiedReact,-1); consistently repeating and crashing game!!! } if(VColMaterialProperties==_MATDrown || VAction==CopDrown) { if(VAction!=CopDrown || Vaction!=CopDrownDead || Vaction!=CopDrownDeadLoop) { state(_or,StateExecuteAnim); SpawnAction(CopDrown); } if(DieCounter==0) { state(_or,StateDead); direction(_clr,_DIRalive); callsub(Sub_Deposses); if(VAICon==0) { call(LockCamera,true); } float(_add,DieCounter,1); move(0,-75,0); } else { if(vrnd<15&&DieCounter<60) { callsub(Sub_RandomWaterSFX); } if(DieCounter>=125 && VAICon==0) { killactor(); } /* Add some bubble from mouth here if(vrnd<20) { } */ float(_add,DieCounter,1); } move(0,-1,0); } //XXXdoesn't belong in CopGen if(VAction==CopEatenSlowLink || VAction==CopEatenLink) { State(_or,StateDead); Direction(_clr,_DIRalive); if(VFrame>=130 && VFrame<=175 && VRnd<20) { spawnparticle(fx_bloodspurt,1,emptyvector,emptyvector,-1); //1 is lower torso spawnparticle(fx_bloodspray,1,emptyvector,emptyvector,-1); spawnparticle(fx_blood,1,emptyvector,emptyvector,-1); spawnparticle(fx_blood,1,emptyvector,emptyvector,-1); } } //XXXdoesn't belong in CopGen if(VAction==MedicWorking) { if(VFrame>=90 && VFrame<=100 && VRnd<10) { spawnparticle(fx_bloodspurt,8,emptyvector,emptyvector,-1); //12 is right hand spawnparticle(fx_bloodspray,8,emptyvector,emptyvector,-1); spawnparticle(fx_blood,8,emptyvector,emptyvector,-1); spawnparticle(fx_blood,8,emptyvector,emptyvector,-1); } } // ActorDeathType - 1 is die from fire after walking around blinded if(VState==StateDead) { direction(_clr,_DIRcombatmode); Direction(_clr,_DIRaiRemoveFlags); if(VAIState==_AIStateHide) { //to free up corner occupied by dead actor call(AIclrhidenode); call(AIorder,_set,_AIStateidle); } } //elseif(VAICon!=0 && aitoggle==0 && VState!=StateThrown && VState!=StateHarpooned && VState!=StateCrawling && VActorFlag!=_AFLAGattached && VActorFlag!=_AFLAGnoai) elseif(VAICon!=0 && aitoggle==0 && VState!=StateThrown && VState!=StateHarpooned && VState!=StateCrawling && VActorFlag!=_AFLAGnoai && VState!=StateExecuteAnim && VState!=StateExecuteAnim && VActorFlag!=_AFLAGattached) { // ************************************************************************** // ************ Start of AI Control Code ************************************ // ************************************************************************** /* printi("PathDestDist: ",VPathDestDistance); printi("PathDestAngle: ",VPathDestAngle); printi("PickDestAngle: ",VPickDestAngle); printi("TargetDistance: ",vtargetdistance); printi("TargetAngle: ",vtargetangle); */ float(_declare,pRndAngle,0); vector(_declare,pHaloOuterPos,0,0,0); vector(_declare,pHaloPos,0,0,-50); Direction(_clr,_DIRaiRemoveFlags) if(VTrigger!=_DIRHaveGun && VState!=StateCrawling) { call(IsPickupClose,_ClassWeapon,115,TmpFloat,TmpVector); if(vtrigger==_DIRTempFlag && TmpFloat!=0) { print("Trying to pick up weapon"); Direction(_set,_DIRaction); float(_set,ActionOK,1); } } call(AIcorrectforobstacles,5); float(_set,CurrentDirection,0); //************************************************************************ //********* HIDE CONTROL **************************************** //************************************************************************ if(vaistate==_AIstateHide) { #include "messiahscripts\enemies\cophide.hxx" } //************************************************************************ //********* END OF HIDE CONTROL ********************************* //************************************************************************ elseif(VAIstatehigh==_AInomove) { printi("Moving routine no move: ",VAIhastarget); if(VAIstatehigh!=_AInoturn) { if(VAIhastarget==_AIenemy) { callsub(Sub_AI1WayAlignToTarget); } else { CallSub(Sub_AI1WayAlignToPickDestAngle) } } } elseif(vstate==StateFollowPath || vstate==StateExecutePathSequence) { //moving pattern for normal patroling print("Moving routine for normal patrolling "); if(VTrigger==_DIRcombatmode && VAIstatehigh!=_AIinspecialmode) { direction(_clr,_DIRcombatmode); //not in attack } if(VAIhastarget==0) { print("Has target"); CallSub(Sub_AI1WayAlignToPickDestAngle) if(VPathDestDistance>20) { if(vaistate==_AIstateRun) { printi("In state run: ",vpickdestanglecorr); print("In state run: ",CurrentDirection); if(vpickdestanglecorr<128 && vpickdestanglecorr>-128) //aligned with target but standing still { float(_set,CurrentDirection,_DIRforward); } } else { if(vpickdestanglecorr<256 && vpickdestanglecorr>-256) //aligned with target but standing still { float(_set,CurrentDirection,_DIRforward|_DIRwalking); } } } } else { CallSub(Sub_AI1WayAlignToTarget); if(vtargetdistance>800 || AIUsage&=_AIUAlwaysRun) { if(vtargetdistance>80) { CallSub(Sub_AI8WayMoveRun,CurrentDirection); } } elseif(vtargetdistance>80) { CallSub(Sub_AI8WayMoveWalk,CurrentDirection); } } } elseif(vtargetdistance>200) { //moving pattern for any anything but patrolling print("Moving routine for anything but patrolling"); //float(_set,AIFlags,_AIHideReset); //clr hide control so ready for next hide session //if(vaistate==_AIstateAttack && VAItargetfound==_AIenemy && vtargetdistance<1000) //if in attack and close //if(vaistate==_AIstateAttack || vaistate==_AIstatesearch || vaistate==_AIstateGetWeapon) //{ print("In special control routine"); CallSub(Sub_AI1WayAlignToTarget); if(VTrigger==_DIRhavegun) { if(vtargetdistance>800) { CallSub(Sub_AI8WayMoveRun,CurrentDirection); } else { CallSub(Sub_AI8WayMoveWalk,CurrentDirection); } } else { CallSub(Sub_AI8WayMoveRun,CurrentDirection); } if(vtrigger!=_DIRcombatmode) //put character in combatmode { direction(_set,_DIRcombatmode); } CallSub(Sub_AIShootCheck,Counter,AIGrenadeCounter); //} //else //{ /* if(vaistate!=_AIstateAttack && vaistate!=_AIstatesearch) { if(VAIstatehigh!=_AIinspecialmode) { direction(_clr,_DIRcombatmode); //not close enough for combatmode or not in attack } } else { direction(_set,_DIRcombatmode); } if(vpickdestanglecorr<-20) { if(vpickdestanglecorr<-2000 && AILastPathTurn>0) { turn(0,19,0); } else { turn(0,-19,0); } //Direction(_set,_DIRleft); } elseif(vpickdestanglecorr>20) { if(vpickdestanglecorr>2000 && AILastPathTurn<0) { turn(0,-19,0); } else { turn(0,19,0); } //Direction(_set,_DIRright); } float(_seti,AILastPathTurn,vpickdestanglecorr); if(CurrentDirection!=_DIRwalking && CurrentDirection==_DIRforward) { if(vpickdestanglecorr>256 || vpickdestanglecorr<-256) //if not aligned with target stop running { float(_set,CurrentDirection,_DIRforward|_DIRwalking); } if(vpathdestdistance<500) //if closer than 500 units to target stop running { float(_set,CurrentDirection,_DIRforward|_DIRwalking); } } elseif(CurrentDirection==_DIRwalking && CurrentDirection==_DIRforward) { if(vaistate==_AIstateAttack && vpathdestdistance>600 && vpickdestanglecorr<256 && vpickdestanglecorr>-256) //if aligned and far from target start running { float(_set,CurrentDirection,_DIRforward); } if(vpickdestanglecorr>256 || vpickdestanglecorr<-256) //if not aligned with target stop walking until aligned { float(_set,CurrentDirection,0); } } elseif(CurrentDirection==0) { if(vpickdestanglecorr<256 && vpickdestanglecorr>-256) //aligned with target but standing still { float(_set,CurrentDirection,_DIRforward|_DIRwalking); } } */ //} } else //condition true if character is closer to subject than 200 units { print("Close up attack move"); if(vaistate==_AIstateAttack || vaistate==_AIstatesearch) { print("Close up attack move"); CallSub(Sub_AI1WayAlignToTarget) CallSub(Sub_AIShootCheck,Counter,AIGrenadeCounter); if(VTrigger!=_DIRhavegun || VAItargetfound!=_AIenemy) { if(vtargetdistance>90) { CallSub(Sub_AI8WayMoveWalk,CurrentDirection); } if(VTrigger!=_DIRhavegun) { if(AIAbility&=_AIAPossesion && AIUsage&=_AIUFindHost) { if(VTargetAngle<100 && VTargetAngle>-100) { Direction(_set,_DIRjump); } } else { Direction(_set,_DIRshoot); } } } } else { //printi("aligning to pickdestcorr ",vtargetangle); print("In close up mode"); CallSub(Sub_AI1WayAlignToPickDestAngle) } if(VState!=StateCrawling) { direction(_set,_DIRaction); float(_set,ActionOK,1); } } if(AIUsage&=_AIUAlwaysRun) { float(_clr,CurrentDirection,_DIRwalking); } /* //testing if illegal Directions were entered if(vstate==StateCrouching) { if(CurrentDirection&=_DIRrun) //walk is not possible in crouch mode { float(_set,CurrentDirection,_DIRwalk); } if(CurrentDirection&=_DIRrunbackward) //walk is not possible in crouch mode { float(_set,CurrentDirection,_DIRbackward); } if(CurrentDirection&=_DIRrunsideleft) //walk is not possible in crouch mode { float(_set,CurrentDirection,_DIRsideleft); } if(CurrentDirection&=_DIRrunsideright) //walk is not possible in crouch mode { float(_set,CurrentDirection,_DIRsideright); } } */ //printlog("CurrentDirection: ",CurrentDirection); //printilog("Pickdestangle: ",vpickdestanglecorr); // if(vaistate!=_AIstateRun) //not the best implementation but will do for now // { Direction(_set,CurrentDirection); // } // else // { // Direction(_clr,_DIRwalking); // Direction(_set,_DIRforward); // } //***************************** //******** jump code ********** //***************************** if(vtrigger==_DIRvercol && vstate!=StateJump && vaistate!=_AIstateHide) { Collision(0,-20,0, 0,-20,-130); if(vcolflag==_DIRvercol) { Collision(0,80,0, 0,80,-130); if(vcolflag!=_DIRvercol) { if(JumpPressCounter>30) { Direction(_set,_DIRjump); } else { float(_add,JumpPressCounter,1); } } } } elseif(vstate==StateJump) { Direction(_set,_DIRjump); } else { float(_set,JumpPressCounter,0); } //***************************** //***** end of jump code ****** //***************************** if(VTrigger|=_DIRMoveBits) { Direction(_set,_DIRMove); } else { Direction(_set,_noDIR); } //print("CurrentDirection: ",CurrentDirection); if(VTrigger==_DIRactoractorcol && VTrigger!=_DIRmove) { if(VAIStatehigh!=_AIcombatmodereact && VAIStatehigh!=_AIcloseupaction) { sample(SFXBumpIntoReact,-1); } Direction(_clr,_DIRactoractorcol); } #include "messiahscripts\enemies\copai.hxx" // ************************************************************************** // ************ End of AI Control Code ************************************** // ************************************************************************** } elseif(VAIcon==0) { //Player control call(AIupdateAIvars); //to update aicounters like TimeNotTarget call(AIcheckfortarget,10); //for LineOfSight reasons etc. this is called for player character also // call(AIsetlockedonactortotarget); if(VAItimenottarget>30) { call(AIreinstateactoraiclass); } } if(vtrigger==_DIRpossesion) { float(_set,PlayerHeadBone,4); callsub(Sub_InitPossesion,GENPossesed,GENCrouchPossession,GENCrawlPossession); //Possesion callback effect init here call(MatrixCallback,_SXEXPActorMatrixBulb,0.1,120); resetbone(PlayerHeadBone); resetbone(2); ActorFlag(_or,_AFLAGpossesed); ActorFlag(_clr,_AFLAGnorotation); //(Torg) make sure this is cleared out so the player can turn } elseif(vtrigger==_DIRdepossesion) { if(DepossesionAbilityActive!=0) { spawnactor(BulletAntiSatan,0,0,-100); //Satan depossesion weapon } callsub(Sub_InitDepossesion,GENDepossesed,GENCrouchDepossession,GENCrawlDepossession) //DePossesion callback effect init here call(MatrixCallback,_SXEXPActorMatrixBulb,0.1,120); ActorFlag(_clr,_AFLAGpossesed); } if(VState!=StateDead && VActorFlag!=_AFLAGattached) { callSub(Sub_ActionKeyHandler,ActionOK); if(vstate|=StateAllNormalStates && vtrigger!=_DIRhavegun) { if(AIAbility&=_AIAPickUpWeapon && VAIStateHigh!=_AIinspecialmode && VState!=StateCrawling) { if(VState==StateCrouching) { callSub(Sub_CheckActionPickupCrouch,GENPickupCrouch,14,0,0); } else { callSub(Sub_CheckActionPickup,GENPickup,14,GENPickupChest,36); } } call(DeadClassRank,true,175); callsub(BackGroundTriggerChecks); call(DeadClassRank,false); callsub(Sub_BatteryHandler); if(VAICon==0) { callsub(Sub_CombatKeyHandler,KeyPressCounter,20); } } else { call(DeadClassRank,true,175); callsub(BackGroundTriggerChecks); call(DeadClassRank,false); callsub(Sub_BatteryHandler); if(VAICon==0) { callsub(Sub_CombatKeyHandler,KeyPressCounter,20); } if(vstate==StateNormal) { if(VState==StateCrouching) { callSub(Sub_CheckActionDropCrouch,GENPickupCrouch,14,0,0,DropDelay); } else { callSub(Sub_CheckActionDrop,GENPickup,14,GENPickupChest,36,DropDelay); } } } if(VActorFlag==_AFLAGresetfallalt) //need to be after bacgroundtriggerchecks prevent death { ActorFlag(_clr,_AFLAGresetfallalt); vector(_settoactorpos,TmpVector); vector(_copyy,TmpVector,FallStartAltitude); } callSub(Sub_CheckRemainingActions,GENPressGun,11); callsub(Sub_Headtrack); //Track head against object //if in the electric shock animations do not check for fall, it's done for you!! if(VState==StateThrown) { CallSub(Sub_CheckThrownFallDamage,FallStartAltitude,CopMaxFall); if(VState==StateNormal) { callsub(Sub_TurnCharacter,TurnSpeed,CopMaxTurnSpeedWounded,CopTurnAccWounded); } } elseif(VState!=StateElectricShock) { CallSub(Sub_CheckFallDamage,AIAbility,GENTouchDown,FallStartAltitude,CopMaxFall,DamageCopFall,GENFallDead,0,GENFallInPlace); } if(AIAbility&=_AIAPossesion) { if(Vstate==StateFlying||vstate==StateFalling||vstate==StateJump||vstate==StateGliding) { call(CheckForPossesion); //DiameterSqr } } } //If character was sniped do bonespecific damage else call Sub_CheckHit() as usual if(AIAbility&!=_AIANoBoneCollision && VActorFlag==_AFLAGSniped && VState==StateNormal && VState!=StateThrown) { ActorFlag(_clr,_AFLAGSniped); if(VState!=StateCrawling) { //if distance greater than 70 feet with pumpgun, then no killshot or specific bone shots! if(VSpecialFlag==_sFLAGTargetAimCloseRange) { if(VColBone>=15 && VColBone<=18) //left leg { SpawnAction(GENShotInLLeg); state(_or,StateCrawling); state(_or,StateExecuteAnim); sample(SFXShotInLegReact,-1); call(CheckAttached,_CADropWeaponAndShells); CallSub(Sub_ChangeStateToNormal); } elseif(VColBone>=19 && VColBone<=22) //right leg { SpawnAction(GENShotInRLeg); state(_or,StateCrawling); state(_or,StateExecuteAnim); sample(SFXShotInLegReact,-1); call(CheckAttached,_CADropWeaponAndShells); CallSub(Sub_ChangeStateToNormal); } else { if(VColAngle>=3072 || VColAngle<=1024) //hit in front { if(VSpecialFlag==_sFLAGLostALimb) { State(_or,StateDead); call(CheckAttached,_CADropWeaponAndShells); spawnaction(CopHeadBlownOffDead); } elseif(VColBone==11 || VColBone==12 && VHealth<500) //right hand and weak { call(CheckAttached,_CADropWeaponAndShells); } elseif(VColBone==3 || VColBone==4) //face, neck { //SpawnAction(GENShotFrHead); SpawnAction(CopThrownSpin); State(_or,StateDead); call(CheckAttached,_CADropWeaponAndShells); } elseif(VColBone==1) //lower torso (balls really) { SpawnAction(GENShotFrTorso); State(_or,StateDead); call(CheckAttached,_CADropWeaponAndShells); } elseif(VColBone==2 || VColBone==9 || VColBone==10) // upper torso, right collar and upper right shoulder { SpawnAction(GENShotFrRShoulder); //right shoulder } elseif(VColBone>=5 && VColBone<=8) //left collar -> left hand { SpawnAction(GENShotFrLShoulder); //left shoulder } else { SpawnAction(GENShotGeneric); //generic shot anim } } elseif(VColAngle>1024 && VColAngle<3072) //hit in back { if(VSpecialFlag==_sFLAGLostALimb) { State(_or,StateDead); call(CheckAttached,_CADropWeaponAndShells); spawnaction(CopHeadBlownOffDead); } elseif(VColBone==11 || VColBone==12 && VHealth<500) //right hand and weak { call(CheckAttached,_CADropWeaponAndShells); } elseif(VColBone==3 || VColBone==4) //face, neck { SpawnAction(CopThrownSpin); //SpawnAction(GENShotBkHead); State(_or,StateDead); call(CheckAttached,_CADropWeaponAndShells); } elseif(VColBone==1 || VColBone==2 || VColBone==5 || VColBone==9) //ltorso,rtorso,lcollar,rcollar { SpawnAction(GENShotBkBack); } else { spawnaction(GENShotGeneric); } } } } else { spawnaction(GENShotGeneric); } } else { spawnaction(CopShotCrawl); } } else { //if(VState!=StateThrown && VState!=StateAttached) if(VState!=StateThrown && VActorFlag!=_AFLAGattached) { callsub(Sub_CheckHit,AIAbility,GENWoundLight,GENWoundLightRun,GENWoundLightNoBreak,FireCount,GENPoleDead,GENCrouchWoundLight,GENThrownForward,GENThrownBack,GENThrownLeft,GENThrownRight); } } if(vstate==StateOnFire) //These first if-statements are just for effects { if(vrnd<20) { CheckActorCollision(0,emptyVector,96,0,_COLfire,DamageFlameThrower); } if(FireCount==0) { sample(SFXOnFire,-1); sample(SFXGenericBurn,-1); /* if(vrnd<50) { sample(SFXActorPainInFire1,-1); } else { sample(SFXActorPainInFire2,-1); } samplestop(SFXcough); */ float(_rnd2,ActorFireType,70); float(_set,ActorDeathType,1); } callsub(Sub_ActorFireEffect,SmokeCount,FireCount,255) } elseif(vstate==StateBlind) { if(SmokeCount==0) { float(_set,FireCount,0); samplestop(SFXGenericBurn); sample(SFXcough,-1); } callsub(Sub_ActorSmokeEffect,SmokeCount,255) if(vstate!=StateDead && ActorDeathType==1) { //actor will die as he's been roasted call(SubtractHealth,0,DamageAfterFire); } } //The last number here is used if they have to fall on their knees when energy is low callsub(Sub_CheckDeadOrDying,AIAbility,GENPoleDead,GENCrawlDead,GENStandDead,GENCrawlSpreadOut,0,GENFallToCrawl,GENCrouchDead,0); //0=health when entering crawling-mode if(VState==StateDead) { callsub(Sub_LostAnyLimbsLately,limbblownoff); if(VTrigger==_DIRdepossesion) { callsub(Sub_InitDepossesion,GENDepossesed,GENCrouchDepossession,GENCrawlDepossession) //DePossesion callback effect init here call(MatrixCallback,_SXEXPActorMatrixBulb,0.1,120); direction(_clr,_DIRdepossesion); } if(VCurSet=="s2r9") { callsub(BackGroundTriggerChecks); } } if(vstate==StateExecuteAnim) { callsub(Sub_CheckExecuteAnimEnd); if(AIAbility&!=_AIASpecialSecondaryWeapon) { if(VOAction==GENThrowGrenade) { if(VFrame==0) { callsub(Sub_SpawnGrenade); if(vrnd<50) { sample(SFXThrow1,-1); } else { sample(SFXThrow2,-1); } } callsub(Sub_TurnCharacter,TurnSpeed,CopMaxTurnSpeed,CopTurnAcc); } elseif(VAction==GENCrouchGrenade) { if(VFrame==26) { callsub(Sub_SpawnGrenade); if(vrnd<50) { sample(SFXThrow1,-1); } else { sample(SFXThrow2,-1); } } callsub(Sub_TurnCharacter,TurnSpeed,CopMaxTurnSpeed,CopTurnAcc); } } if(vaction==GENPossesed) { callsub(Sub_TurnCharacter,TurnSpeed,CopMaxTurnSpeed,CopTurnAcc); } elseif(VOAction==GENClimbUp && VState!=StateExecuteAnim) { Move(0,0,CopHangMoveIn); // MoveFeetColOffset(0,0,CopHangMoveIn); //callsub(Sub_CheckHanging,KeyPressCounter,CopClimbUp,CopFall,CopHangMoveIn); } } elseif(vstate==StateCrawling||vstate==StateBlind||vstate==StateOnFire||vstate==StateSteamed||vstate==StateHarpooned||vstate==StateElectricShock) { direction(_clr,_DIRcombatmode); if(VState!=StateDead) { if(vstate==StateHarpooned) //Here are the if-statements that control the actions when you are badly wounded { if(RandomGnkNoisem<0) { float(_rnd2,RandomGnkNoisem,100); float(_add,RandomGnkNoisem,RandomGnkNoisea); float(_add,RandomGnkNoisea,30); callsub(Sub_RandomHarpoonedSFX,100); } else { float(_sub,RandomGnkNoisem,1); } callsub(Sub_Harpooned,GENHarpoonFrontHold,GENHarpoonFrontHitWall,GENHarpoonFrontIdle,GENHarpoonFrontBurn,GENHarpoonBackHold,GENHarpoonBackHitWall,GENHarpoonBackIdle,GENHarpoonBackBurn); callsub(Sub_Deposses); } else { callsub(Sub_TurnCharacter,TurnSpeed,CopMaxTurnSpeedWounded,CopTurnAccWounded); if(vstate==StateCrawling) { sample(SFXCrawlingReact,-1); // if(RandomGnkNoisem<0) // { // float(_rnd2,RandomGnkNoisem,100); // float(_add,RandomGnkNoisem,RandomGnkNoisea); // float(_add,RandomGnkNoisea,30); // callsub(Sub_RandomHarpoonedSFX,85); // } // else // { // float(_sub,RandomGnkNoisem,1); // } //is this where he has to roll over and hug his knees, and scream if you force him to move? callsub(Sub_Crawling,GENCrawlSpreadOut,GENFallToCrawl) } elseif(vstate==StateOnFire || vstate==StateSteamed || vstate==StateBlind) { callsub(Sub_BurnedSteamedBlind,GENBurningRollOnFloor,GENBurnedIdle,GENGettingBurned,GENBlindForward,GENBlindBackwards,GENBurningRunInCircle,GENSlowGetUpFace,SteamCounter,GENIdle) } elseif(vstate==StateElectricShock) { callsub(Sub_ElectricShock,GENelectricshock0,GENelectricshock1); if(vaction==GENelectricshock0) { if(vframe==1) { sample(SFXElectricShock1,-1); sample(SFXElectrocuteReact,-1); call(SubtractHealth,0,DamageElectric); } } elseif(vaction==GENelectricshock1) { if(vendofanim!=0) { sample(SFXElectricShock2,-1); call(PlaneTriggerQuadrant,TmpFloat,1); if(TmpFloat==0) { spawnaction(GENThrownForward); move(0,0,-150); } elseif(TmpFloat==1) { spawnaction(GENThrownLeft); move(150,0,0); } elseif(TmpFloat==2) { spawnaction(GENThrownBack); move(0,0,150); } elseif(TmpFloat==3) { spawnaction(GENThrownRight); move(-150,0,0); } // state(_change,StateElectricShock,StateThrown); state(_clr,StateElectricShock); } } } } } } /* DO NOT UNCOMMENT WITHOUT ASKING SAXS elseif(VState==StateThrown) { print("In thrown sequence"); if (VOAction==CopGetUpFromFrontFaceDown || VOAction==CopGetUpFromBack || VOAction==CopGetUpFromLeftFaceDown || VOAction==CopGetUpFromRightFaceDown) { CallSub(sub_ChangeStateToNormal); } // elseif(VAction!=CopThrownSpin && VAction!=CopThrownForward && VAction!=CopThrownForwardLand && VAction!=CopThrownRight && VAction!=CopThrownRightLand && VAction!=CopThrownLeft && VAction!=CopThrownLeftLand && VAction!=CopThrownBack && VAction!=CopThrownBackLand) // { // //PrintLog("Resetting StateThrown! risky..."); // //CallSub(sub_ChangeStateToNormal); // state(_clr,StateThrown); // } } */ elseif(VTrigger==_DIRalive && VState!=StateThrown && VActorFlag!=_AFLAGattached) { CallSub(Sub_CheckClimbUp,GENClimbUp,60,ColAngleCorrectNeeded,20,CopHangMoveIn); if(vstate==StateNormal && VTrigger!=_DIRTempFlag) //TempFlag comes from checkclimbup, if set, character is gonna climb up { if(VState!=StateCrouching) { //callsub(Sub_AlignToWallAndCheckRunUpStairs,GENRunUpStairs,GENIdle,GENIdleHitWall,ColAngleCorrectNeeded,GENIdleHitWallFront,GENHitWallSpreadOut,-0.95,CopSpreadOut,GENSpreadOutGun,ForceRunFrames) //callsub(Sub_AlignToWallAndCheckRunUpStairs,GENRunUpStairs,GENIdle,GENIdleHitWall,ColAngleCorrectNeeded,GENIdleHitWallFront,GENHitWallSpreadOut,-0.95,GENSpreadOut,GENSpreadOutGun,ForceRunFrames) if(VAIClass==_AIclassmale && VAICon==0) { callsub(Sub_AlignToWallAndCheckRunUpStairs,GENRunUpStairs,GENIdle,GENIdleHitWall,ColAngleCorrectNeeded,GENIdleHitWall,GENHitWallSpreadOut,-0.95,GENSpreadOut,GENSpreadOutGun,ForceRunFrames) } } callsub(Sub_CheckForIdleLongTime,GENIdle,GENIdleLongTime); //control for Sub_SpawnGrenade: stickum control, so it doesn't look stupid! if(VAICon==0) { //only PlayerOne controls stickem if(StickEmState==StickEmReady&&VTrigger==_DIRGrenade) { //we got here , which means we have thrown a StickEm grenade, and now we are going to explode it! float(_set,StickEmState,StickEmExploding); direction(_clr,_DIRGrenade); float(_set,stickumDelay,60); } if(VInventoryType==_AmmoGrenadeStickEm) { float(_sub,stickumDelay,1); if(stickumDelay>0) { direction(_clr,_DIRGrenade); } } } if(VTrigger==_DIRGrenade && VInventoryLeft>0) { state(_or,StateExecuteAnim); if(VState==StateCrouching) { spawnaction(GENCrouchGrenade); } else { spawnaction(GENThrowGrenade); } } CallSub(Sub_CheckCrouching,GENCrouchDown,GENCrouchUp); CallSub(Sub_CheckJumpFallDown,AIAbility,GENRunUpStairs,JumpPressCounter,DownwardPull,CopJumpSpeed,GENJump,AirSpeedForward,AirSpeedSideways,GENFall,CopAirSpeed) CallSub(Sub_CheckSliding,GENRunUpStairs,GENSlide); if(vtrigger==_DIRaction) { call(CheckForGrab,200,TmpFloat); //Deletes diraction flag if there is no grap possible !??! if(TmpFloat!=0) { if(TmpFloat&=16) //on stomach { if(TmpFloat&=1) { spawnaction(GENKickHeadFD); } elseif(TmpFloat&=2) { spawnaction(GENKickRightFD); } elseif(TmpFloat&=4) { spawnaction(GENKickCrotchFD); } elseif(TmpFloat&=8) { spawnaction(GENKickLeftFD); } } else //on back { if(TmpFloat&=1) { spawnaction(GENKickHeadFU); } elseif(TmpFloat&=2) { spawnaction(GENKickRightFU); } elseif(TmpFloat&=4) { spawnaction(GENKickCrotchFU); } elseif(TmpFloat&=8) { spawnaction(GENKickLeftFU); } } } } if(VActorFlag!=_AFLAGnorotation) { callsub(Sub_TurnCharacter,TurnSpeed,CopMaxTurnSpeed,CopTurnAcc); } } elseif(vstate==StateFalling||vstate==StateJump) { if(vstate==StateJump) { CallSub(Sub_Jump,JumpPressCounter,DownwardPull,CopMinHoldJumpAction,CopJumpGravity,2,0); } callsub(Sub_TurnCharacter,TurnSpeed,CopMaxTurnSpeedAir,CopTurnAccAir); callsub(Sub_MoveInAir,AirSpeedSideways,AirSpeedForward,CopAirSpeed,CopAirBulb); CallSub(Sub_CheckSliding,GENRunUpStairs,GENSlide); } } if(VState!=StateThrown && VAction!=GenClimbup && VActorFlag!=_AFLAGattached) { if(VTrigger==_DIRcombatmode && VTrigger!=_DIRhavegun && VTrigger==_DIRshoot) { print("Fire pressed and you have no gun"); //if(VState!=StateDead && Vaction!=CopBoxing) //{ //SpawnAction(CopBoxing); //if(vrnd<50) //{ // sample(SFXThrow1,-1); //} //else //{ // sample(SFXThrow2,-1); //} //}7 } else { callsub(FireWeaponsAndCheckAttached,ShootDelayCounter,1,GENReload,GENReloadCrouch,GENHeavyRecoil,GENLightRecoil,GENCrouchHeavyRecoil,GENCrouchLightRecoil); } } //footsteps if(VAICon==0 && vtrigger==_DIRleft||vtrigger==_DIRright||vtrigger==_DIRforward||vtrigger==_DIRbackward||vtrigger==_DIRsideleft||vtrigger==_DIRsideright) { if(VSpecialFlag==_sFLAGTrodInGoo) { if(vrnd<50) { spawnparticle(fx_footbloodspray,18,emptyvector,emptyvector,-1); } else { spawnparticle(fx_footbloodspray,22,emptyvector,emptyvector,-1); } sample(SFXBlood2,-1); } else { callsub(Sub_CheckFootSteps,_sFLAGLeftFoot); callsub(Sub_CheckFootSteps,_sFLAGRightFoot); } } //weapons if(VAICon==0 && VSpecialFlag==_sFLAGPickedUpGun) { sample(SFXWeaponPickUp,-1); } if(VAICon==0 && VSpecialFlag==_sFLAGPickedUpAmmo) { if(vrnd<33) { sample(SFXWeaponAmmo1,-1); } elseif(vrnd<66) { sample(SFXWeaponAmmo2,-1); } else { sample(SFXWeaponAmmo3,-1); } } if(VState==StateForceField) { State(_clr,StateForceField); float(_add,DownWardPull,CopJumpGravity); }