Vehicle Spawner --> lua issues [Solved]

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
User avatar
Firefang
Major
Major
Posts: 518
Joined: Mon Nov 15, 2010 8:55 pm
Location: California

Vehicle Spawner --> lua issues [Solved]

Post by Firefang »

Ok, I have a vehicle spawning weapon (works fine). I want to set up the lua so when the vehicle spawned through the weapon is destroyed, events will happen.

My Code (the print line is just till I get it working)

Code: Select all

vehicleevent = OnObjectKill(
   function(object, killer)
      if GetEntityName(object) == "all_hover_combatspeeder" then
         print("vehicle found")
      end
   end
)
The spawned vehicle odf
Hidden/Spoiler:
[GameObjectClass]

ClassLabel = "hover"
GeometryName = "all_hover_rebel_attack_speeder.msh"

[Properties]
Label = "all_hover_combatspeeder"
WaterEffect = "com_sfx_waterwake_lg"

FLYERSECTION = "BODY"
VehicleType = "light"
AISizeType = "MEDIUM"
FirstPersonFOV = 52
CockpitTension = 20

WaterEffect = "com_sfx_waterwake_lg"
WakeEffect = "hailfire_wake"

MapTexture = "all_tank_icon"
HealthTexture = "HUD_combat_speeder_icon"
VehiclePosition = "common.vehiclepositions.pilot"
MapScale = 1.5

GeometryName = "all_hover_rebel_attack_speeder"
FirstPerson = "all\allcmspd;all_1st_cockpit_combatspeeder"
ExplosionName = "all_hover_combatspeeder_exp"

MaxHealth = 8000.0
HealthType = "vehicle"
//HitLocation = "p_crithit 4.0"

TimeRequiredToEject = "7.5"
EjectResistance = "0.03"
TimeTilReboard = "5.0"

CollisionScale = 1.5
CollisionThreshold = 5.0

SetAltitude = 0.5
GravityScale = 4.0
LiftSpring = 10.0
LiftDamp = 3.0

Acceleration = 5.0
Deceleration = 5.5
Traction = 20.0
ForwardSpeed = 11.0
ReverseSpeed = 7.0
StrafeSpeed = 7.0

EnergyBar = 50
EnergyAutoRestore = 7.5
EnergyBoostDrain = 20
BoostSpeed = 20
BoostAcceleration = 75.0
BoostFOV = 60

SpinRate = 1.7
TurnRate = 1.7
TurnFilter = 10.0
PitchRate = 0.5
PitchFilter = 10.0


AddSpringBody = "-1.8 1.4 1.7 2.5"
BodySpringLength = 1.0
AddSpringBody = "1.8 1.4 1.7 2.5"
BodySpringLength = 1.0

AddSpringBody = "0.0 2.4 -2.0 3.5"
BodySpringLength = 1.0
BodyOmegaXSpringFactor = 2

VelocitySpring = 5
VelocityDamp = 2.5
OmegaXSpring = 3.0
OmegaXDamp = 3.0
OmegaZSpring = 5.0
OmegaZDamp = 1.5

//// COLLISION ////

SoldierCollision = "CollisionMesh"
SoldierCollision = "p_cube1"
SoldierCollision = "p_cube2"
SoldierCollision = "p_cube3"
SoldierCollision = "p_cube4"

OrdnanceCollision = "CollisionMesh"
OrdnanceCollision = "p_cube1"
OrdnanceCollision = "p_cube2"
OrdnanceCollision = "p_cube3"
OrdnanceCollision = "p_cube4"

TerrainCollision = "p_sphere1"
TerrainCollision = "p_sphere2"
TerrainCollision = "p_sphere3"
TerrainCollision = "p_sphere4"
TerrainCollision = "p_sphere5"
TerrainCollision = "p_sphere6"

VehicleCollision = "p_sphere1"
VehicleCollision = "p_sphere2"
VehicleCollision = "p_sphere3"
VehicleCollision = "p_sphere4"
VehicleCollision = "p_sphere5"
VehicleCollision = "p_sphere6"

BuildingCollision = "p_box"




StrafeRollAngle = 0.01
ThrustPitchAngle = 0.0
BankAngle = -0.01
BankFilter = 3.0 //low is slow - How quickly the bank returns to level
LevelSpring = 2.0 //low is slow - the force the restores level
LevelDamp = 1.0 //low is slow - the force that reduces the momentum of the rotation

PCPitchRate = "15.0"
PCSpinRate = "25.0"
PCTurnRate = "30.0"

EyePointOffset = "0.0 1.0 -2.2"
TrackCenter = "0.0 2.0 -5"
TrackOffset = "0.0 1.0 5.0"
TiltValue = "8.0"

AutoAimSize = 1.0

PitchLimits = "-10 20"
YawLimits = "-0 0"

PilotPosition = "hp_pilot"
PilotAnimation = "drive"

VehiclePosition = "common.vehicleposition.pilot"

WEAPONSECTION = 1
WeaponName = "all_weap_hover_combatspeeder_cannon1"
WeaponAmmo = "0"

AimerNodeName = "gun_left"
AimerPitchLimits = "-25.0 90.0"
AimerYawLimits = "-25.0 15.0"
BarrelNodeName = "barrel_left"
BarrelRecoil = "0.20"
FirePointName = "hp_fire_2"

NextAimer = "-"

AimerNodeName = "gun_right"
AimerPitchLimits = "-25.0 90.0"
AimerYawLimits = "-15.0 25.0"
BarrelNodeName = "barrel_right"
BarrelRecoil = "0.20"
FirePointName = "hp_fire_3"

WEAPONSECTION = 2

WeaponName = "all_weap_hover_combatspeeder_missile"
WeaponAmmo = 30

AimerPitchLimits = "-30 90"
AimerYawLimits = "-20.0 20.0"

AimerNodeName = "hp_missile_1"
NextAimer = "-"

AimerPitchLimits = "-30 90"
AimerYawLimits = "-20.0 20.0"
AimerNodeName = "hp_missile_2"


ForceMode = 2

FLYERSECTION = "TURRET1"
VehiclePosition = "common.vehiclepositions.gunner"
FirstPerson = "all\allsccam;all_1st_cockpit_securitycam"
CockpitTension = 40
EyePointOffset = "0.0 2.0 4.0"
TrackCenter = "0.0 2.0 -1.0"
TrackOffset = "0.0 0.0 0.0"
TiltValue = "5.0"

PitchLimits = "-15.0 10.0"
YawLimits = "-80 80"
PCPitchRate = 15.0
PCTurnRate = 20.0

TurnRate = 1.5
TurnFilter = 5.0
PitchRate = 0.5
PitchFilter = 1.0
PitchDamp = 1.0

//PitchRate = 0.8
//PitchFilter = 2.75
//TurnRate = 1.3
//TurnFilter = 2.75

VehiclePosition = "common.vehicleposition.copilot"

WeaponName = "all_weap_hover_combatspeeder_cannon"
WeaponAmmo = "0"


//TurretNodeName = "turret_body"
HierarchyLevel = 1
AimerNodeName = "turret_body"
AimerPitchLimits = "-0 0"
AimerYawLimits = "-80.0 80.0"

NextAimer = "-"

AimerNodeName = "turret_aimer"
AimerPitchLimits = "-20 70"
AimerYawLimits = "-0.0 0.0"

BarrelNodeName = "turret_barrel"
BarrelRecoil = "0.25"
FirePointName = "hp_fire_1"

PilotPosition = "hp_gunner"
PilotAnimation = "drive"


TurretYawSound = "turret_whir_yaw_lp"
TurretYawSoundPitch = "0.7"
TurretPitchSound = "turret_whir_pitch_lp"
TurretPitchSoundPitch = "0.7"
TurretAmbientSound = ""
TurretActivateSound = "vehicle_equip"
TurretDeactivateSound = "vehicle_equip"
TurretStartSound = ""
TurretStopSound = ""

TurretYawSound = "turret_whir_yaw_lp"
TurretYawSoundPitch = "0.7"
TurretPitchSound = "turret_whir_pitch_lp"
TurretPitchSoundPitch = "0.7"
TurretAmbientSound = ""
TurretActivateSound = "vehicle_equip"
TurretDeactivateSound = "vehicle_equip"
TurretStartSound = ""
TurretStopSound = ""

AISizeType = "MEDIUM"
MovingTurnOnly = 1


CHUNKSECTION = "CHUNK1"
ChunkGeometryName = "all_hover_rebel_attack_speeder_chunk1"
ChunkNodeName = ""
ChunkTerrainCollisions = "1"
ChunkTerrainEffect = "dirtspray"
ChunkPhysics = "FULL"
ChunkOmega = "-0.1 -0.1 0.2"
ChunkSpeed = "1.0"
ChunkUpFactor = "2.00"

CHUNKSECTION = "CHUNK2"
ChunkGeometryName = "all_hover_rebel_attack_speeder_chunk2"
ChunkNodeName = ""
ChunkTerrainCollisions = "3"
ChunkTerrainEffect = "com_sfx_explosion_lg"
ChunkPhysics = "FULL"
ChunkOmega = "2.0 0.5 2.0"
ChunkBounciness = 0.4
ChunkStickiness = 0.25
ChunkSpeed = "11.0"
ChunkUpFactor = "8.00"
ChunkTrailEffect = "com_sfx_chunktrail_sm"

ChunkSmokeEffect = "com_sfx_smokeplume"
ChunkSmokeNodeName = "hp_smoke_2"


CHUNKSECTION = "CHUNK3"
ChunkGeometryName = "all_hover_rebel_attack_speeder_chunk3"
ChunkNodeName = ""
ChunkTerrainCollisions = "5"
ChunkTerrainEffect = "dirtspray"
ChunkTrailEffect = "com_sfx_chunktrail_sm"
ChunkPhysics = "FULL"
ChunkOmega = "3.0 2.0 2.0"
ChunkSpeed = "14.0"
ChunkUpFactor = "7.00"
ChunkBounciness = 0.5
ChunkStickiness = 0.25
ChunkSmokeEffect = "com_sfx_smokeplume"
ChunkSmokeNodeName = "hp_smoke_2"

CHUNKSECTION = "CHUNK4"
ChunkGeometryName = "all_hover_rebel_attack_speeder_chunk4"
ChunkNodeName = ""
ChunkTerrainCollisions = "1"
ChunkTerrainEffect = "dirtspray"
ChunkPhysics = "FULL"
ChunkOmega = "0.2 0.1 0.1"
ChunkSpeed = "1.2"
ChunkBounciness = 0.3
ChunkStickiness = 0.45
ChunkUpFactor = "2.00"



DamageStartPercent = 50.0
DamageStopPercent = 30.0
DamageEffect = "com_sfx_vehiclespark"
DamageEffectScale = 1.5
DamageInheritVelocity = 0.5
DamageAttachPoint = "hp_damage3"

DamageStartPercent = 50.0
DamageStopPercent = 30.0
DamageEffect = "com_sfx_vehiclespark"
DamageEffectScale = 1.5
DamageInheritVelocity = 0.5
DamageAttachPoint = "hp_damage4"

//DamageStartPercent = 50.0
//DamageStopPercent = 30.0
//DamageEffect = "com_sfx_vehiclespark"
//DamageEffectScale = 1.5
//DamageInheritVelocity = 0.5
//DamageAttachPoint = "hp_damage_5"

DamageStartPercent = 30.0
DamageStopPercent = 2.0
DamageEffect = "com_sfx_vehiclesmoke"
DamageEffectScale = 1.5
DamageInheritVelocity = 0.5
DamageAttachPoint = "hp_damage1"

//DamageStartPercent = 5.0
//DamageStopPercent = 0.0
//DamageEffect = "com_sfx_vehicleflame"
//DamageEffectScale = 1.5
//DamageInheritVelocity = 0.5
//DamageAttachPoint = "hp_damage_1"

DamageStartPercent = 30.0
DamageStopPercent = 2.0
DamageEffect = "com_sfx_vehiclesmoke"
DamageInheritVelocity = 0.5
DamageAttachPoint = "hp_damage2"

//DamageStartPercent = 5.0
//DamageStopPercent = 0.0
//DamageEffect = "com_sfx_vehicleflame"
//DamageEffectScale = 1.5
//DamageInheritVelocity = 0.5
//DamageAttachPoint = "hp_damage_2"

VOUnitType = 124
EngineSound = "all_hover_combatspeeder_engine_parameterized"
TurnOnSound = ""
TurningOffSound = ""
TurnOffSound = ""
TurnOffTime = ""
HurtSound = "com_amb_spark_c"
DeathSound = "imp_weap_ord_exp_lg"
VehicleCollisionSound ="com_veh_collision_lg"
Music = ""
ImpMusic = "imp_vehicle"
AllMusic = "all_vehicle"
MusicSpeed = ".25"
MusicDelay = "3.0"
GroundedSound = ""
GroundedHeight = ""
BoostSound = ""
FoleyFXGroup = "metal_foley"
I basically want to know two things, Is this possible? and if so, What am I doing wrong?
Last edited by Firefang on Sat Apr 02, 2011 7:45 pm, edited 1 time in total.
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Vehicle Spawner --> lua issues

Post by DarthD.U.C.K. »

what happens? does the map crash? do you get an error, or does it just not work?
one thing that may be wrong: you check for the name of the object, but compare it to a class.
the name is set in ZE and would return the name of the vehiclespawn. since you dont spawn the vehicles through a vehiclespawn you should use the "GetEntityClass" function to check for the class.
User avatar
Firefang
Major
Major
Posts: 518
Joined: Mon Nov 15, 2010 8:55 pm
Location: California

Re: Vehicle Spawner --> lua issues

Post by Firefang »

Nothing happens, but I'll try the GetEntityClass and see what works.

Edit: It didn't work, but it led me to GetEntityClass(object) == FindEntityClass("all_hover_combatspeeder"), which works.
Post Reply