Page 1 of 1

A few script questions

Posted: Thu May 20, 2010 10:45 pm
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?

Re: A few script questions

Posted: Thu May 20, 2010 10:57 pm
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

Re: A few script questions

Posted: Sat May 22, 2010 3:22 pm
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?

Re: A few script questions

Posted: Tue May 25, 2010 5:37 pm
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.

Re: A few script questions

Posted: Wed May 26, 2010 5:55 pm
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?

Re: A few script questions

Posted: Thu May 27, 2010 10:57 am
by myers73
move you AI goals under ScriptPostLoad() not ScritpInit(), im pretty sure that is your problem.

Re: A few script questions

Posted: Fri May 28, 2010 6:29 am
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.