UnrealScript Game Programming Cookbook

(Chris Devlin) #1

Weapons


154


  1. We need to have a default state for our weapon to begin with, so we mark it
    as inactive.
    /****

    • Default state. Go back to prev state, and don't use our

    • current tick
      ****/
      auto simulated state Inactive
      {
      ignores Tick;




simulated function BeginState(name PreviousStateName)
{
Super.BeginState(PreviousStateName);

// not looking to lock onto a target
bTargetLockingActive = false;

// Don't adjust our target lock
AdjustLockTarget(None);
}

We ignore the tick which tells the weapon to stop updating any of its homing
functions. Additionally, we tell it not to look for an active target or adjust its
current target, if we did have one at the moment.


  1. While on the topic of states, if we finish our current one, then it's time to move
    onto the next:
    /****

    • Finish current state, & prepare for the next one
      ****/
      simulated function EndState(Name NextStateName)




{
Super.EndState(NextStateName);

// If true, weapon will try to lock onto targets
bTargetLockingActive = true;
}
}
Free download pdf