Making heroes earnable/unlockable [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
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Making heroes earnable/unlockable [Solved]

Post by thelegend »

Hey all,
my currently problem is simple but for me..it`s not.
I want to make a hero earnable. Then a player earns points to unlock him then the hero can not be played. It shows up: There are to many units.." But he is only playable for the player, not by the bots.
I had this problem on a few other maps but I never got it solved. I guess there`s a line that says: LockableforthisUnit = 1....But I'm not sure, because I can't find a line similar to this one.
If anyone can help me I`d be very thankful.
Last edited by thelegend on Fri Sep 26, 2014 12:47 pm, edited 1 time in total.
Indytotof
Chief Warrant Officer
Chief Warrant Officer
Posts: 348
Joined: Fri Jun 06, 2014 6:58 am
Projects :: SWBF2 Sides Overhaul Mod
Games I'm Playing :: Battlefront 2
xbox live or psn: No gamertag set
Location: Senlis, France

Re: Making heroes earnable/unlockable

Post by Indytotof »

Maybe "Point to Unlock" ?

Here is an ODF for this kinf of unit, maybe that can helped:
Hidden/Spoiler:
[code][GameObjectClass]
ClassParent = "all_inf_default"


[Properties]
PointsToUnlock = 12
UnitType = "support"

ScanningRange = 30.0
TransmitRange = 300.0

MaxSpeed = 8.0
MaxStrafeSpeed = 6.0

WEAPONSECTION = 1
WeaponName = "all_weap_inf_mortar_launcher"
WeaponAmmo = 3

WEAPONSECTION = 2
WeaponName = "all_weap_inf_pistol"
WeaponAmmo = 0

WEAPONSECTION = 3
WeaponName = "all_weap_inf_thermaldetonator"
WeaponAmmo = 4
WeaponChannel = 1

WEAPONSECTION = 4
WeaponName4 = "all_weap_inf_remotedroid"
WeaponAmmo4 = 1
WeaponChannel4 = 1

WEAPONSECTION = 5
WeaponName = "all_weap_award_pistol"
WeaponAmmo = 6

VOUnitType = 3
VOSound = "all1_inf_pc_com_hostile SpottedVO"
VOSound = "all1_inf_pc_com_bacta NeedMedicVO"
VOSound = "all1_inf_pc_com_mechanic NeedRepairVO"
VOSound = "all1_inf_pc_com_ammo NeedAmmoVO"
VOSound = "all1_inf_pc_com_transport NeedPickupVO"
VOSound = "all1_inf_pc_com_backup NeedBackupVO"
VOSound = "all1_inf_pc_com_clear_area AttackPositionVO"
VOSound = "all1_inf_pc_com_defend DefendPositionVO"

VOSound = "all1_inf_pc_com_hostile_inVehicle SpottedVO +InVehicle"
VOSound = "all1_inf_pc_com_bacta_inVehicle NeedMedicVO +InVehicle"
VOSound = "all1_inf_pc_com_mechanic_inVehicle NeedRepairVO +InVehicle"
VOSound = "all1_inf_pc_com_ammo_inVehicle NeedAmmoVO +InVehicle"
VOSound = "all1_inf_pc_com_transport_inVehicle NeedPickupVO +InVehicle"
VOSound = "all1_inf_pc_com_backup_inVehicle NeedBackupVO +InVehicle"
VOSound = "all1_inf_pc_com_clear_area_inVehicle AttackPositionVO +InVehicle"
VOSound = "all1_inf_pc_com_defend_inVehicle DefendPositionVO +InVehicle"[/code]
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Re: Making heroes earnable/unlockable

Post by thelegend »

Ah..I forgot to write I actually use this line "PointstoUnlock". It works for all default units, but not for heroes. And that's my problem. But thank you for help.
Indytotof
Chief Warrant Officer
Chief Warrant Officer
Posts: 348
Joined: Fri Jun 06, 2014 6:58 am
Projects :: SWBF2 Sides Overhaul Mod
Games I'm Playing :: Battlefront 2
xbox live or psn: No gamertag set
Location: Senlis, France

Re: Making heroes earnable/unlockable

Post by Indytotof »

Maybe, make heroes not appears as a hero, but as a special unit (like the dark trooper) ?
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Re: Making heroes earnable/unlockable

Post by thelegend »

Hm..they are actually normal units. I want to make them exactly like in Suun Rar: Desert City there you can earn a jedi and only the palyer can play as him. That's what I mean.
hunpeter12
Command Sergeant Major
Command Sergeant Major
Posts: 260
Joined: Mon Apr 18, 2011 2:53 pm
Projects :: Underground City The Complex [WIP]
Games I'm Playing :: SWBF2

Re: Making heroes earnable/unlockable

Post by hunpeter12 »

I'm bit a confused by your question, if you could elaborate it a bit more, I'd be grateful.
So - if I understood it well - there is an error message showing up beginning with: There is too many units..., or sth like that?

Also, you can add heroes to the normal unit setup, just as you would a unit (like in place of the 'special' class or something), but maybe you have to change their ClassParents.
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Re: Making heroes earnable/unlockable

Post by thelegend »

Hm..ok. I will describe that more detailed.
I have a hero. He only should be playable for the players, not by the bots. But I want him unlockable. So yo have to earn points to get him, but...then I can select my unit ingame it shows up, below my unit (Who is now completly black): "To many units already exist"

Here an example .odf of my captain rex and also my map.lua file if it helps:
Odf(Default):
Hidden/Spoiler:
[GameObjectClass]
ClassParent = "rep_inf_default"


[Properties]
MaxHealth = "1000"
PointsToUnlock = "2"

UnitType = "support"

AnimationName = "clonecommander"

MaxSpeed = 6.5 // base forward speed
MaxStrafeSpeed = 4.7 // base right/left speed

WEAPONSECTION = 1
WeaponName = "rep_weap_inf_rifle1"
WeaponAmmo = 8

WEAPONSECTION = 2
WeaponName = "rep_weap_inf_pistol"
WeaponAmmo = 0

WEAPONSECTION = 3
WeaponName = "rep_weap_inf_thermaldetonator"
WeaponAmmo = 4
WeaponChannel = 1

WEAPONSECTION = 4
WeaponName = "rep_weap_award_pistol"
WeaponAmmo = 6


VOUnitType = 121
And my .lua file:
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("LinkedTurrets")

-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;


function ScriptPostLoad()


--This defines the CPs. These need to happen first
cp1 = CommandPost:New{name = "cp1"}
cp2 = CommandPost:New{name = "cp2"}
cp3 = CommandPost:New{name = "cp3"}
cp4 = CommandPost:New{name = "cp4"}
cp5 = CommandPost:New{name = "cp5"}
cp6 = CommandPost:New{name = "cp6"}
cp11 = CommandPost:New{name = "cp11"}
cp12 = CommandPost:New{name = "cp12"}



--This sets up the actual objective. This needs to happen after cp's are defined
conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF,
textATT = "game.modes.con",
textDEF = "game.modes.con2",
multiplayerRules = true}

--This adds the CPs to the objective. This needs to happen after the objective is set up
conquest:AddCommandPost(cp1)
conquest:AddCommandPost(cp2)
conquest:AddCommandPost(cp3)
conquest:AddCommandPost(cp4)
conquest:AddCommandPost(cp5)
conquest:AddCommandPost(cp6)
conquest:AddCommandPost(cp11)
conquest:AddCommandPost(cp12)


conquest:Start()
SetUberMode(1);
EnableSPHeroRules()
AddDeathRegion("deathregion1")
AddDeathRegion("deathregion2")
AddDeathRegion("deathregion3")
AddDeathRegion("deathregion4")
AddDeathRegion("deathregion5")
AddDeathRegion("deathregion6")
AddDeathRegion("deathregion7")
AddDeathRegion("deathregion8")
AddDeathRegion("deathregion9")
AddDeathRegion("deathregion10")
AddDeathRegion("deathregion11")
AddDeathRegion("deathregion12")
AddDeathRegion("deathregion13")
AddDeathRegion("deathregion14")
AddDeathRegion("deathregion15")

end


---------------------------------------------------------------------------
-- FUNCTION: ScriptInit
-- PURPOSE: This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES: The name, 'ScriptInit' is a chosen convention, and each
-- mission script must contain a version of this function, as
-- it is called from C to start the mission.
---------------------------------------------------------------------------
function ScriptInit()

ReadDataFile("ingame.lvl")


SetMaxFlyHeight(1100)
SetMaxPlayerFlyHeight (1100)
SetMinFlyHeight(-500)
SetMinPlayerFlyHeight (-500)

SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",50) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",650) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",550) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",6000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",100) -- should be ~1x #combo

ReadDataFile("sound\\yav.lvl;yav1cw")
ReadDataFile("dc:SIDE\\rep.lvl",
"rep_inf_ep3_rifleman",
"rep_inf_ep3_rocketeer",
"rep_inf_ep3_engineer",
"rep_inf_ep3_sniper",
"rep_inf_ep3_officer",
"rep_inf_ep3_jettrooper",
"rep_inf_ep3_assault",
"rep_hero_anakin",
"rep_rex",
"rep_hero_krell",
"rep_walk_oneman_atst",
"rep_fly_anakinstarfighter_sc",
"rep_fly_vwing",
"rep_fly_arc170fighter_sc")


ReadDataFile("SIDE\\cis.lvl",
"cis_inf_rifleman",
"cis_inf_rocketeer",
"cis_inf_engineer",
"cis_inf_sniper",
"cis_inf_officer",
"cis_inf_droideka",
"cis_hero_darthmaul",
"cis_hover_aat",
"cis_fly_droidfighter_sc",
"cis_fly_greviousfighter",
"cis_fly_tridroidfighter")


ReadDataFile("SIDE\\tur.lvl",
"tur_bldg_chaingun_roof",
"tur_bldg_spa_cis_chaingun",
"spa_veh_turret_chair")

SetupTeams{
rep = {
team = REP,
units = 100,
reinforcements = 3000,
soldier = { "rep_inf_ep3_rifleman",30, 40},
assault = { "rep_inf_ep3_rocketeer",10, 15},
engineer = { "rep_inf_ep3_engineer",10, 20},
sniper = { "rep_inf_ep3_sniper",10, 15},
officer = {"rep_inf_ep3_assault",5, 10},
special = { "rep_rex",0, 0},
hero1 = { "rep_hero_anakin",0, 0},
hero2 = { "rep_hero_krell",0, 0},

},
cis = {
team = CIS,
units = 100,
reinforcements = 3000,
soldier = { "cis_inf_rifleman",30, 40},
assault = { "cis_inf_rocketeer",10, 15},
engineer = { "cis_inf_engineer",10, 20},
sniper = { "cis_inf_sniper",10, 15},
officer = {"",0, 0},
special = { "",0, 0},
hero1 = { "",0, 0},
hero2 = { "",0, 0},
}
}


-- Level Stats
-- ClearWalkers()
AddWalkerType(0, 4) -- special -> droidekas
AddWalkerType(1, 0) -- 1x2 (1 pair of legs)
AddWalkerType(2, 6) -- 2x2 (2 pairs of legs)
AddWalkerType(3, 0) -- 3x2 (3 pairs of legs)
local weaponCnt = 1024
SetMemoryPoolSize("Aimer", 75)
SetMemoryPoolSize("rep_rex", 1)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 1024)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityCloth", 32)
SetMemoryPoolSize("EntityFlyer", 32)
SetMemoryPoolSize("EntityHover", 32)
SetMemoryPoolSize("EntityLight", 200)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 128)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("SoundSpaceRegion", 64)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 128)
SetMemoryPoolSize("UnitController", 128)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)
--ReadDataFile("dc:BOU\\BOU.lvl", "BOU_conquest")
ReadDataFile("dc:BOU\\BOU.lvl", "BOU_conquest")
SetDenseEnvironment("false")
I did put out the Sound section or it would be a bit too long.
Edit: I am calling him "rep_rex". His name was "rep_hero_rex" but It did not work.
hunpeter12
Command Sergeant Major
Command Sergeant Major
Posts: 260
Joined: Mon Apr 18, 2011 2:53 pm
Projects :: Underground City The Complex [WIP]
Games I'm Playing :: SWBF2

Re: Making heroes earnable/unlockable

Post by hunpeter12 »

Oh, ok. Now I understand. Well, to be honest I don't think you can do that directly by a command. What you can do is to change the hero lines e.g:
hero1 = { "rep_hero_anakin",0, 0}, to hero1 = { "rep_hero_anakin",0, 1}.
But then the AI will spawn as them. So you should check through LUA when somebody spawns as one of them, and if it's an AI kill it, and add 1 reinforcement to the team to 'pretend' it didn't happen.
The following code may not be working, cause I'm not good at LUA.

Code: Select all

OnCharacterSpawn( function(character) 
if GetCharacterUnit(character == "rep_hero_anakin" and IsCharacterHuman(character) == false then
KillObject(character) and AddReinforcements(1, 1)
end
This is quite a complicated workaround, but this is what I can think about for now. I'll keep searching.
JazzMaster
Master Sergeant
Master Sergeant
Posts: 166
Joined: Sun Mar 31, 2013 2:56 pm
Projects :: Cato Neimoidia- Invasion
Games I'm Playing :: Battlefront 2
xbox live or psn: No gamertag set

Re: Making heroes earnable/unlockable

Post by JazzMaster »

In Suun Ra all i did was put this line in the properties section of the odf:
PointsToUnlock = "80"
And then in the team setup part where you specify how many of each unit i just put this:
special = { "cis_hero_whatever",1, 1},
So only one unit can play as that character at a time. It doesnt bar the AI from taking up that slot though, so i cant help you there. And in my experience you never see that character being played when you're on the same team as the character. only when you're the opposing team. Life for example when you play as the republic you never see Quinlan Vos spawn as AI, but if you played as the CIS you would most likely see him being played by AI.
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Re: Making heroes earnable/unlockable

Post by thelegend »

Hm..well. That also would be nice if my enemy plays as a hero. I will try that.
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: Making heroes earnable/unlockable

Post by AnthonyBF2 »

From my take, you want the human to access this unit, but not the ai units.

AddUnitClass(CIS, "your character's odf name here")
-put your team of course
This I think allows the human to select it, but you are not defining a min/max for ai units.
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Re: Making heroes earnable/unlockable [Solved]

Post by thelegend »

Ah thank you so much JazzMaster. I did make the changes you told me and now it works. Thank you.
Post Reply