A few script questions

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
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

A few script questions

Post by wishihadaname »

Just a few AI spawn control and ambush related questions in conquest mode, mostly I just don't know enough script commands to create what I want.

1) I know there is a command for "on cp capture", does anyone know what it is and how to tie an ambush to it and make it repetetive? Basically I want to have a few "hot" cp's, when you capture them you get an extra 35 regular trooper and 5 elite troops to tip the tide in your favor in that particular fight. This has to happened every time someone capture the CP, if CIS captures it then they get a boost, if reps capture it then they get a boost, if CIS re-captures it then they get another boost.

2) Is there a command for setting AI spawn preferance and having it be dynamic? I've run into the problem that on those occasions when the battlefield becomes even and each side controls one half of the map entirely, then the battle fizzles out because AI spawn 100 miles behind the front at some outpost and take forever to catch up.
Basically I need to set it up so that the AI always spawn at the closest CP to their enemies.

3) I'm not exacly sure why, but my AI defenders (extra backup that I use to fix the issue of unguarded command posts) don't want to obey their defend objective, I get an error that says the weight is zero even though I set it at a hunder, they don't react to combat either. any ideas?
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

Re: A few script questions

Post by myers73 »

for question one, look at the docs. you will need to write a separate function for each team, at least it wil be the most stable that way
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Re: A few script questions

Post by wishihadaname »

any ideas on the other two? I've never actually seen #2 done so it may be impossible but as for #3, do I need to have a special objective setup in order for objective to work in conquest mode, or is there a specific place in the code where objectives go?
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: A few script questions

Post by [RDH]Zerted »

2) Not that I know of. There are a few things you could try. One of them being to teleport spawning AI units to CPs with nearby enemies.

3) Your AI don't do anything because their goals are messed up. Post your Lua AI code and the error messages.
User avatar
wishihadaname
Captain
Captain
Posts: 493
Joined: Fri Dec 28, 2007 2:10 pm
Projects :: The Corellian Resistance
Games I'm Playing :: Halo Reach and LOTRO
Location: Look to your left.... no, your other left....

Re: A few script questions

Post by wishihadaname »

ok, for the AI, here is my .lua code
Hidden/Spoiler:
},
DTR = {
team = DTR,
units = 20,
reinforcements = -1,
soldier = {"rep_inf_ep2_rifleman", 10, 10},
assault = {"rep_inf_ep3_officer", 5, 5},
engineer = {"rep_inf_ep3_rocketeer", 4, 4},
sniper = {"rep_inf_ep2_rocketeer", 1, 1},
},
DTC = {
team = DTC,
units = 20,
reinforcements = -1,
soldier = {"cis_inf_rifleman", 15, 15},
assault = {"cis_inf_officer", 5, 5},
}
}

--setting up friends and foes

SetTeamAsFriend(DTR, REP)
SetTeamAsFriend(REP, DTR)
SetTeamAsEnemy(CIS, DTR)
SetTeamAsEnemy(DTR, CIS)
AddAIGoal(DTR, "Defend", 100, "cp12")

SetTeamAsFriend(CIS, DTC)
SetTeamAsFriend(DTC, CIS)
SetTeamAsEnemy(DTC, REP)
SetTeamAsEnemy(REP, DTC)
AddAIGoal(DTC, "Defend", 100, "cp14")
and here is the error message

Message Severity: 2
.\Source\AIGoalManager.cpp(253)
Invalid goal target for "Defend" goal (team 3, weight 0)

Message Severity: 2
.\Source\AIGoalManager.cpp(253)
Invalid goal target for "Defend" goal (team 4, weight 0)


Also on the teleporter idea, i've never played with that before. I'll read the tut here on gametoast but whats the special modification for making them teleport to the closest CP to the enemy? or is that included in the tut?
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

Re: A few script questions

Post by myers73 »

move you AI goals under ScriptPostLoad() not ScritpInit(), im pretty sure that is your problem.
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: A few script questions

Post by [RDH]Zerted »

Invalid goal target
It doesn't know what cp12 and cp14 are.

The teleporting idea isn't great. You would need to setup regions to track were the enemy AI are. Then teleport the new units to the CPs nearest the regions were the most enemies are.
Post Reply