-
Notifications
You must be signed in to change notification settings - Fork 0
Vehicle functions
These are the ZScript functions shared by all vehicles and turrets.
- TurretClass: The class of the turret to spawn, must be based on KAI_BaseTurret
- None, for a pointer to the spawned turret, just check the Turret pointer.
This function handles the basic tasks for spawning a vehicle turret, like setting its' allegiance, passing the vehicles spawn flags to the turret, etc. Useful if you have custom turret spawning logic in SpawnVehicleTurret(), such as a vehicle that can have different turrets through a user variable.
- AttachTo: The actor to attach the lights to, normally a vehicle.
- Offsets: The Vector3 offsets relative to AttachTo's origin at which the light should spawn.
- Flags:
- VHSF_BACKLIGHT: The spawned headlight is a backlight.
- LightColor: The color of the headlight, because this uses dynamic light actors, this is a Vector3 that stores the R, G, and B colors of the the light, respectively, can be any value between 0 and 255. Is white by default (255, 255, 255).
- Intensity: How strong the headlight is, default is 256.
- SpotlightAngles: A Vectpr2 that stores the inner (X) and outer (Y) angles of the headlight.
- Returns a KAI_Headlight pointer to the spawned light. For storing to the headlights array.
Spawn a vehicle headlight, vehicle headlights are spotlight actors. Normally called in the SpawnHeadlights() virtual to spawn and store the vehicle's headlights when it spawns.
This is how the function is used by one of the vehicles from the Military Vehicles Pack.
Override Void SpawnHeadlights ()
{
Headlights.Push(SpawnVehicleHeadlight(Self,(128,28,8),intensity:384));
Headlights.Push(SpawnVehicleHeadlight(Self,(128,-28,8),intensity:384));
Headlights.Push(SpawnVehicleHeadlight(Self,(128,28,8),VHSF_BACKLIGHT,(255,0,0),32,(40,80)));
Headlights.Push(SpawnVehicleHeadlight(Self,(128,-28,8),VHSF_BACKLIGHT,(255,0,0),32,(40,80)));
}
- None
Handles the vehicles' SearchTime property. Used by KAI_LandVehicleChase() and can also be called independently on turrets if you want them to be able to stop chasing their target and switch to a new one.
- MaxDist: The distance to check if the vehicles' friendplayer is within. Default is 384 map units.
- None
Checks if the player the vehicle is following is within MaxDist, if they are then the function turns +DONTFOLLOWPLAYERS on, otherwise it turns it off. This is used by KAI_LandVehicleChase() to try and prevent friendly vehicles from dogpiling the player and blocking their way.
- Flags: The flags to use for the retarget. These are mostly flags for not running specific retarget conditions.
- RVHF_NOTARGETCHANGE: Don't actually change the callers' target to the hull of the turret they are targeting, only return if the retarget SHOULD occur.
- RVHF_NOTRANSFERDAMAGECHECK: Don't retarget if the turret has +TRANSFERDAMAGE, and the hull its' attached to is bigger than the turret itself.
- RVHF_NOWEAKHULLCHECK: Don't retarget if the vehicle the turret is attached to is weaker than the turret itself.
- Returns true if the callers' target is a vehicle turret, and targeting the vehicle the turret is attached to would be more advantageous instead.
Checks if the callers' target is a vehicle turret, and changes it if it would be more advantageous to target the vehicle itself, this function checks for several conditions to determine if it would be better/easier to target the vehicle rather than its' turret:
- If the turret has +TRANSFERDAMAGE, and is overall smaller than the vehicle it's on. Then it would make more sense to target the bigger hull, since both actors share the same health pool.
- If the turret does not have +TRANSFERDAMAGE, but the vehicle it's attached to is weaker than 80% of the turrets' current health. Meaning that it should be easier and quicker to destroy the vehicle itself than its' turret, which it can probably function without anyway.
- RadiusMultiplier: The amount to multiply the crushing radius of the vehicle by. Default is 1.0, which only crushes corpses the vehicle is touching.
- None
Handles crushing any non-flying corpses the vehicle is touching. Useful for making vehicles that can crush corpses they drive or walk over. Like tanks. Must be called every time the vehicle moves ideally, to crush the corpses after every move.
These functions handle the vehicles' headlight system.
Turn the vehicle's headlights on if they aren't already, and increases its light level by 64, along with the light level of any turret attached on it.
Turns the headlights off and sets the vehicles and turrets' light levels back to 0.
Removes all the vehicles' headlights. Called when vehicles die or are erased from existence.
- Home
- Features
- Classes
- Functions
- Guides