Weapon Headaches

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
Sky_216
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2086
Joined: Mon Feb 13, 2006 3:28 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Weapon Headaches

Post by Sky_216 »

Well I've recently made a 'survivor mode' (see "Maloss" topic in wip forum), one feature of which is upgrading/adding weapons. This unfortunately has run into a snag: whenever a new weapon class (as in one in a new slot, replacing an old one presents no problems, you can only use that weapon by dying - if you just go to a cp to collect it (ie respawn at a cp) then there is a CTD.

here's the unit's odf:
Hidden/Spoiler:
[GameObjectClass]
ClassParent = "rep_inf_default"


[Properties]
UnitType = "Scout"
PointsToUnlock = 0
MaxHealth = 550.0
MaxSpeed = 7.8 // base forward speed
MaxStrafeSpeed = 6.1 // base right/left speed
maxShield = 100
addShield = 30


WEAPONSECTION = 1
WeaponName1 = "rep_weap_inf_pistol"
WeaponAmmo1 = 0
WeaponChannel1 = 0

WEAPONSECTION = 2
WeaponName2 = "com_weap_Melee_Attack"
WeaponAmmo2 = 0
WeaponChannel2 = 1

WEAPONSECTION = 3
WeaponName3 = ""
WeaponAmmo3 = 0
WeaponChannel3 = 1

WEAPONSECTION = 4
WeaponName4 = ""
WeaponAmmo4 = 0
WeaponChannel4 = 0

WEAPONSECTION = 5
WeaponName5 = ""
WeaponAmmo5 = 0
WeaponChannel5 = 1

WEAPONSECTION = 6
WeaponName6 = ""
WeaponAmmo6 = 0
WeaponChannel6 = 0

VOUnitType = 122

And here's the relevant bit of lua code (based on Mav's levelup system from FFx map):
Hidden/Spoiler:
score = OnObjectKill(
function(object, killer)
if killer and IsCharacterHuman(killer) and GetObjectTeam(object) ~= ATT then
killcount = killcount + 1
killerunit = GetCharacterUnit(killer)
if killcount == 2 then
SetClassProperty("rep_inf_ep3_delta", "WeaponChannel3", 1)
SetClassProperty("rep_inf_ep3_delta", "WeaponName3", "rbt_weap_inf_emp")
SetClassProperty("rep_inf_ep3_delta", "WeaponAmmo3", 1)
ShowMessageText("level.upg.1.1", ATT)
end
if killcount == 5 then
SetClassProperty("rep_inf_ep3_delta", "WeaponName1", "rep_weap_inf_rifle")
SetClassProperty("rep_inf_ep3_delta", "WeaponAmmo1", 1)
ShowMessageText("level.upg.1.2", ATT)
end
if killcount == 10 then
SetClassProperty("rep_inf_ep3_delta", "WeaponAmmo3", 2)
SetClassProperty("rep_inf_ep3_delta", "WeaponName4", "rbt_weap_inf_cpistol")
SetClassProperty("rep_inf_ep3_delta", "WeaponAmmo4", 0)
ShowMessageText("level.upg.1.3", ATT)
end
if killcount == 15 then
SetClassProperty("rep_inf_ep3_delta", "WeaponAmmo1", 2)
ShowMessageText("level.upg.1.4", ATT)
end
if killcount == 24 then
SetClassProperty("rep_inf_ep3_delta", "WeaponName1", "rep_weap_inf_assault_jet")
SetClassProperty("rep_inf_ep3_delta", "WeaponAmmo1", 5)
ShowMessageText("level.upg.1.5", ATT)
end
if killcount == 35 then
SetClassProperty("rep_inf_ep3_delta", "WeaponName3", "rep_weap_inf_thermaldetonator")
ShowMessageText("level.upg.1.6", ATT)
end
if killcount == 47 then
SetClassProperty("rep_inf_ep3_delta", "WeaponChannel5", 1)
SetClassProperty("rep_inf_ep3_delta", "WeaponName5", "rep_weap_inf_beacon")
SetClassProperty("rep_inf_ep3_delta", "WeaponAmmo5", 1)
ShowMessageText("level.upg.1.8", ATT)
end
if killcount == 60 then
SetClassProperty("rep_inf_ep3_delta", "WeaponName6", "rep_weap_inf_rocket_launcher")
SetClassProperty("rep_inf_ep3_delta", "WeaponAmmo6", 5)
ShowMessageText("level.upg.1.7", ATT)
end
if killcount == 80 then
SetClassProperty("rep_inf_ep3_delta", "WeaponName3", "rep_weap_inf_pulse")
SetClassProperty("rep_inf_ep3_delta", "WeaponAmmo3", 3)
SetClassProperty("rep_weap_inf_assault_jet", "RoundsPerClip", 80)
SetClassProperty("rep_weap_inf_assault_jet", "ShotDelay", 0.1)
SetClassProperty("rep_inf_ep3_delta", "WeaponAmmo1", 6)
ShowMessageText("level.upg.1.9", ATT)
end
end
end)
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Weapon Headaches

Post by Maveritchell »

Use "dummy" weapons for the weaponslots you plan on filling, instead of no weapon at all.
Post Reply