CTF AI Spawning problems

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
YaNkFaN
Field Commander
Field Commander
Posts: 943
Joined: Sat Dec 13, 2008 8:17 am

CTF AI Spawning problems

Post by YaNkFaN »

So i tried changing the default flag to the kamino dna flag

and this is what happened
Hidden/Spoiler:
Image
here's the .odf of the flag
Hidden/Spoiler:
[code][GameObjectClass]

ClassLabel = "flag"
GeometryName = "kam_bldg_embryo.msh"

[Properties]

Lighting = "Dynamic"

IconTexture = ""
MapTexture = ""
MapScale = ""

GeometryName = "kam_bldg_embryo"

CarriedGeometryName = "kam_icon_embryo_carried"
SoldierAttachBone = "bone_pelvis"

PickupSound = "health_recharge defer"
DropSound = ""
AmbientSound = ""

LifeSpan = 50.0

LightODF = "flaglight"

[InstanceProperties]

[/code]
and the important part of my .lua
Hidden/Spoiler:
[code] -- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;


function ScriptPostLoad()

SoundEvent_SetupTeams( REP, 'rep', CIS, 'cis' )





--This is all the actual ctf objective setup
ctf = ObjectiveCTF:New{teamATT = REP, teamDEF = CIS, captureLimit = 5, textATT = "game.modes.ctf", textDEF = "game.modes.ctf2", hideCPs = true, multiplayerRules = true}
ctf:AddFlag{name = "flag1", homeRegion = "team1_capture", captureRegion = "team2_capture",
capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0,
icon = "", mapIcon = "flag_icon", mapIconScale = 3.0}
ctf:AddFlag{name = "flag2", homeRegion = "team2_capture", captureRegion = "team1_capture",
capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0,
icon = "", mapIcon = "flag_icon", mapIconScale = 3.0}

ctf:Start()
[/code]
any ideas how to fix this? so it attaches where it should? and doesn't look weird like that
Last edited by YaNkFaN on Sat Mar 21, 2009 3:40 pm, edited 1 time in total.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: CTF Flag Problems

Post by Teancum »

That's hilarious! A bubble head! Seriously though I'd say the model is going to need to be offset somehow.
YaNkFaN
Field Commander
Field Commander
Posts: 943
Joined: Sat Dec 13, 2008 8:17 am

Re: CTF Flag Problems

Post by YaNkFaN »

yea i thought it was funny too but in mygeeto campaign the model shrinks and fits on the unit's hip now i figured this

SoldierAttachBone = "bone_pelvis"

would do the trick but it didn't and also it didn't shrink the model either

Edit: stupid me i forgot to put this .msh of the carried flag in the msh folder so it just reverted to the non carried geometry it works fine now also another question is there a way to stop units from crowding around their own flag in ctf like right now some reps go and get the cis flag and vice versa but majority of both teams stand around the flag like they're trying to capture it i was thinking changing the goals to deathmatch but i don't know if that involves editing the objective_ctf script or what not.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: CTF Flag Problems

Post by Maveritchell »

Read psych0fred's "AI Goals" document; it covers almost exactly what you want to do with the examples he uses.
YaNkFaN
Field Commander
Field Commander
Posts: 943
Joined: Sat Dec 13, 2008 8:17 am

Re: CTF Flag Problems

Post by YaNkFaN »

yes it does now i assume this goes in scriptpostload right? not scriptinit?
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: CTF Flag Problems

Post by Maveritchell »

Yes.
YaNkFaN
Field Commander
Field Commander
Posts: 943
Joined: Sat Dec 13, 2008 8:17 am

Re: CTF Flag Problems

Post by YaNkFaN »

Edit the level works but no AI spawn the debug log gave me this error

Message Severity: 3
.\Source\LuaHelper.cpp(312)
CallProc failed: bad argument #4 to `AddAIGoal' (string expected, got nil)
stack traceback:
[C]: in function `AddAIGoal'
(none): in function `ScriptPostLoad'

and this is the relavent part of the .lua
Hidden/Spoiler:
[code]function ScriptPostLoad()

SoundEvent_SetupTeams( REP, 'rep', CIS, 'cis' )






--This is all the actual ctf objective setup
ctf = ObjectiveCTF:New{teamATT = REP, teamDEF = CIS, captureLimit = 5, textATT = "game.modes.ctf", textDEF = "game.modes.ctf2", hideCPs = false, multiplayerRules = true}
ctf:AddFlag{name = "flag1", homeRegion = "team1_capture", captureRegion = "team2_capture",
capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0,
icon = "", mapIcon = "flag_icon", mapIconScale = 3.0}
ctf:AddFlag{name = "flag2", homeRegion = "team2_capture", captureRegion = "team1_capture",
capRegionMarker = "hud_objective_icon_circle", capRegionMarkerScale = 3.0,
icon = "", mapIcon = "flag_icon", mapIconScale = 3.0}

ClearAIGoals( 1 );
AddAIGoal( 1, "CTFOffense", 50, team2_capture );
AddAIGoal( 1, "CTFDefense", 5 );
AddAIGoal( 1, "Deathmatch", 45);
ClearAIGoals( 2 );
AddAIGoal( 2, "CTFOffense", 50, team1_capture );
AddAIGoal( 2, "CTFDefense", 5 );
AddAIGoal(2, "Deathmatch", 45);

ctf:Start()[/code]
any ideas?

Edit i've narrowed it down to this function

AddAIGoal( 1, "CTFOffense", 50, team2_capture );
AddAIGoal( 2, "CTFOffense", 50, team1_capture );

so that's the problem but i don't know how to fix it.

also these errors are right above the severity: 3
Message Severity: 2

.\Source\LuaCallbacks_Mission.cpp(635)
Entity "team1_capture" not found
updating markers for flag: flag2
no carrier

Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(635)
Entity "team2_capture" not found
updating markers for flag: flag1
no carrier

but in ZE the regions exist..
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: CTF AI Spawning problems

Post by Frisbeetarian »

Maybe this will help; it's how the Kashyyyk ctf Lua was set up. Many other Lua scripts did it somewhat like what you did, judt they put it directly after the ctf:Start() or whatever other start it was using. Another thing is that after looking through a bunch of scripts, none of them cleared the AI goals, and while I know it should work, you can try it without that line.

Code: Select all

    ctf.OnStart = function(self)
    	ctf.goal1 = AddAIGoal(REP, "Defend", 30, "gatepanel")
		ctf.goal2 = AddAIGoal(CIS, "Destroy", 30, "gatepanel")
		ctf.goal3 = AddAIGoal(CIS, "Destroy", 10, "woodl")
		ctf.goal4 = AddAIGoal(CIS, "Destroy", 10, "woodc")
		ctf.goal5 = AddAIGoal(CIS, "Destroy", 10, "woodr")
		ctf.goal6 = AddAIGoal(REP, "Defend", 10, "woodl")
		ctf.goal7 = AddAIGoal(REP, "Defend", 10, "woodc")
		ctf.goal8 = AddAIGoal(REP, "Defend", 10, "woodr")
	end
    ctf:Start()
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: CTF AI Spawning problems

Post by Maveritchell »

Add in, above your AI goals:

Code: Select all

ActivateRegion("team1_capture")
ActivateRegion("team2_capture")
I wouldn't think that's necessary but it's worth a try.
YaNkFaN
Field Commander
Field Commander
Posts: 943
Joined: Sat Dec 13, 2008 8:17 am

Re: CTF AI Spawning problems

Post by YaNkFaN »

hmm i did try the kash way and it was an interesting effect
the CTFOffense again when added didn't spawn units but the deathmatch and ctf defense worked quite nicely i'm assuming that ctf offense is already in the default ctf objective so calling it twice called the error possibly i'll try adding the activate region lines and then adding the ctfoffense objective to see what happenes
Jaspo
Command Sergeant Major
Command Sergeant Major
Posts: 282
Joined: Sun Mar 01, 2009 4:34 am
Projects :: AotC DoW+++Boonta Eve Classic
Games I'm Playing :: WoT MBWBVC Robocraft
xbox live or psn: No gamertag set
Contact:

Re: CTF AI Spawning problems

Post by Jaspo »

Lol, that first pic needs to be made into a PotD. Funny captions, anyone?
Post Reply