Mod Team Assemble!

Talk and share anything related to Star Wars Battlefront 2. No maps or mod announcements here. Use Work in Progress forum.

Moderator: Moderators

Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Mod Team Assemble!

Post by Noobasaurus »

I've begun working on scripting it. It's (of course) not as easy as I had thought.

EDIT: Got most of the stuff working. Right now there are four teams, the assassins, the guards, the target, and the civilians. Everyone is friendly toward each other in the beginning, but once the target dies the guards turn against the assassin and the assassin has to get to the safe zone. Once he gets there he wins. If the assassin dies at any time he loses.

The only problem is the AI goals. For some strange reason, they don't want to follow or defend the target. Instead, they fire a shot off at it in the beginning and then run away. But here's what I have.
Hidden/Spoiler:
BEFORE ScriptPostLoad[code]
TAR = 3;
CIV = 4;[/code]
IN ScriptPostLoad[code]
ForceHumansOntoTeam1()

-----------------KILL THE TARGET AND ESCAPE STARTS RIGHT HERE RIGHT NOW

SetAIDifficulty(999, -999, "hard")
target = GetTeamMember(3,0)
AddAIGoal(4, "deathmatch", 100)
AddAIGoal(3, "deathmatch", 100)
--AddAIGoal(2, "deathmatch", 100)
SpawnCharacter(target, GetPathPoint("target", 0))

onfirstspawn = OnCharacterSpawn(
function(character)
if IsCharacterHuman(character) then
ReleaseCharacterSpawn(onfirstspawn)
onfirstspawn = nil
AllowAISpawn(2, false)
AllowAISpawn(3, false)
AllowAISpawn(4, false)
--ShowMessageText("level.abc.kill") --put the localization string that says kill the guy here
SetTeamAsFriend(2,1)
SetTeamAsFriend(1,3)
SetTeamAsFriend(3,1)
SetTeamAsFriend(1,2)
SetTeamAsFriend(4,1)
SetTeamAsFriend(4,2)
SetTeamAsFriend(4,3)
SetTeamAsFriend(1,4)
SetTeamAsFriend(2,4)
SetTeamAsFriend(3,4)
SetTeamAsFriend(2,3)
SetTeamAsFriend(3,2)
AddAIGoal(2, "follow", 1000, GetCharacterUnit(target))
MapAddEntityMarker(GetCharacterUnit(target), "hud_objective_icon1", 5, 1, "RED", true, true, true)
end
end
)

deathcheck = OnCharacterDeath(
function(character, killer)
if GetNumTeamMembersAlive(1) == 0 then
MissionDefeat(1)
elseif GetNumTeamMembersAlive(3) == 0 then
ActivateRegion("escape")
SetTeamAsEnemy(1,2)
SetTeamAsEnemy(2,1)
ClearAIGoals(2)
AddAIGoal(2, "deathmatch", 100)
MapAddRegionMarker("escape", "hud_objective_icon1", 5, 1, "YELLOW", true, true, true)
end
end)

wincheck = OnEnterRegion(
function(region, character)
MissionVictory(1)
end,
"escape"
)

[/code]
IN ScriptInit[code]

SetTeamName (3, "target")
AddUnitClass (3, "cis_inf_droideka", 1)
SetUnitCount (3, 1)

SetTeamName (4, "citizens")
AddUnitClass (4, "rep_inf_ep3_rifleman", 10)
AddUnitClass (4, "rep_inf_ep3_rocketeer", 10)
AddUnitClass (4, "rep_inf_ep3_engineer", 10)
AddUnitClass (4, "rep_inf_ep3_sniper", 10)
AddUnitClass (4, "rep_inf_ep3_officer", 10)
SetUnitCount (4, 50)

SetupTeams{
rep = {
team = REP,
units = 20,
reinforcements = -1,
soldier = { "rep_inf_ep3_rifleman",0, 0},
assault = { "rep_inf_ep3_rocketeer",0, 0},
engineer = { "rep_inf_ep3_engineer",0, 0},
sniper = { "rep_inf_ep3_sniper",0, 0},
officer = {"rep_inf_ep3_officer",0, 0},
special = { "rep_inf_ep3_jettrooper",0, 0},

},
cis = {
team = CIS,
units = 10,
reinforcements = -1,
officer = {"cis_inf_officer",10, 10},
}
}
[/code]
Those are only the relevant parts of the lua. There are currently two things not working as intended. First, the AI goals have problems. Second, the objective markers show up as black squares on the minimap and the second marker doesn't show up normally at all (only on the minimap). The second error can probably be easily fixed.
User avatar
Kingpin
Jedi
Jedi
Posts: 1096
Joined: Fri Sep 13, 2013 7:09 pm
Projects :: The Sith Wars II
Location: Denver, CO
Contact:

Re: Mod Team Assemble!

Post by Kingpin »

Nice! Can't wait to see it in the end!
User avatar
Locutus
1st Lieutenant
1st Lieutenant
Posts: 420
Joined: Fri Jun 04, 2010 10:08 am
Projects :: Stargate Battlefront Pegasus
Location: Germany
Contact:

Re: Mod Team Assemble!

Post by Locutus »

Your AI goal issue is caused by this:
OnCharacterSpawn(
AddAIGoal()
)

You're adding a new AI goal every time a character spawns. The problem: The engine can only handle 20 AI goals at any given time. Having more won't crash the game but your log should be full of errors.
To update the AI goals on every character spawn simply use ClearAIGoals(team) before adding a new one. Then the "Defend" AI goal should work properly.
I do have some unnecessarily complicated AI goal stuff in my HQ script if you want to to take a look. But be advised the the code in the isn't ... good^^


The black squares indicate a missing texture. Try using "hud_objective_icon_circle" (with quotes).
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Mod Team Assemble!

Post by Noobasaurus »

Ah, I see. Thanks. I had a good laugh at 4 magnaguards sprinting as fast as they could to keep up with a droideka. It was pretty funny. Now I'll also probably make it so that if the target takes any sort of damage they try to run to a safe location.

YEP. Works great. Here's a video of it in a blank map. I try it three times. Whenever I damage the target he runs to a predefined safe location. Some guards follow him. This really makes me want to try it on Mos Eisley.

For some strange reason, Youtube doesn't want to process it.

EDIT: I adjusted some more things to make it better. Now, whenever an assassin hurts someone, the guards realize the target is in danger an they start firing at you. One guard escorts the target to a safe location. Now, when I saw this, I laughed. All of the guards except for one stand and shoot me. Off in the distance I see one running right next to the target. :P
User avatar
Kingpin
Jedi
Jedi
Posts: 1096
Joined: Fri Sep 13, 2013 7:09 pm
Projects :: The Sith Wars II
Location: Denver, CO
Contact:

Re: Mod Team Assemble!

Post by Kingpin »

Perfect! Nice job!
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Mod Team Assemble!

Post by Noobasaurus »

If you want to play it you can get it here. It shows up at the top of the list.

And here's an actual video that shows gameplay of it on Mos Eisley. Hopefully it will process this time. Unfortunately the guards did not run with the target this time. But this shows that it can easily work with any stock map. No modifications to the actual map required!

EDIT: Okay, so it wasn't just me. Youtube is broken today.
EDIT2: Video works now.
JAWSFreelao
First Lance Corporal
First Lance Corporal
Posts: 135
Joined: Wed May 25, 2011 6:00 pm
Projects :: Band
Games I'm Playing :: Halo
xbox live or psn: No gamertag set

Re: Mod Team Assemble!

Post by JAWSFreelao »

Tell you what, if you wish, I can contribute some textures and offer some suggestions to whoever ends up finishing the sides. I would also like whoever does the sides to show me how all of the coding works so I can learn to do this on my own.
Post Reply