Rally Squad Weapon? (LUA)

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
Sky_216
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2086
Joined: Mon Feb 13, 2006 3:28 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Rally Squad Weapon? (LUA)

Post by Sky_216 »

Thought about this for a while...would it be realistically possible to give command units (ie clone captains, OOM droids, etc) a "Rally Squad" weapon....ie a weapon that works like a buff, but gets a few allies to follow the unit who used it around (so some AI work in squads). Way I thought of doing it is:
Use "on hit by last weapon" (or whatever its called) code.
If team is same as user (ie team 1 or 2) then set those hit by it to follow the user (not sure what the code for this is but since it's in fakeconsole assume there is one).

Other question is 'would this cause online crashing?'

Anyway thanks to anyone who can shed light on this.
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Rally Squad Weapon? (LUA)

Post by Fiodis »

You're a better coder than I; but if it counts for anything my opinion is the same as yours, that it should be possible. GetObjectLastHitWeaponClass or something, then check the team and set an AI goal, I think it is.

I'm guessing it won't work online since that "Follow me" command doesn't work online. Or...does it? I think I've checked before, but I've forgotten the results of that test.
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Rally Squad Weapon? (LUA)

Post by DarthD.U.C.K. »

there is a follow aigoal, it should work online too
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: Rally Squad Weapon? (LUA)

Post by [RDH]Zerted »

The "Follow Me" command works fine online if you are the server host. Like others mention, it messes with the AI goals. There is a limit to the number of AI goals. If you go over the limit (check the limits topic), the game crashes.
User avatar
Sky_216
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2086
Joined: Mon Feb 13, 2006 3:28 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: Rally Squad Weapon? (LUA)

Post by Sky_216 »

Ah, okay. Can the folllow me AI goal be applied to a select few units or will it be applied to the whole team of units?
User avatar
vampire_lord
Rebel Sergeant
Rebel Sergeant
Posts: 216
Joined: Thu Mar 20, 2008 7:02 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: Mexico City
Contact:

Re: Rally Squad Weapon? (LUA)

Post by vampire_lord »

Fiodis wrote:I'm guessing it won't work online since that "Follow me" command doesn't work online. Or...does it? I think I've checked before, but I've forgotten the results of that test.
It doesn't display the order but you can command up to 2 bots with F4 as if you were doing it offline, lag comes into play though you might see them loafing around sometimes as if you were idle with them too much time.
User avatar
trainmaster611
Sith Lord
Sith Lord
Posts: 1779
Joined: Thu Aug 24, 2006 5:22 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: Building a railway to Coruscant
Contact:

Re: Rally Squad Weapon? (LUA)

Post by trainmaster611 »

I don't know if this helps but I know AI will follow you in CTF if you have the flag. I looked at the ObjectiveCTF script but nothing in particular stood out that would explain why they do that. I dunno if its just the same idea behind the "follow me" command though.
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: Rally Squad Weapon? (LUA)

Post by Frisbeetarian »

Skyhammer_216 wrote:Ah, okay. Can the folllow me AI goal be applied to a select few units or will it be applied to the whole team of units?
What DarthD.U.C.K. was referring to was the "Follow" AI goal, which, just like the other ones ("Deathmatch" "Defend" "Destroy" etc.), apply to the whole team. You can use weights however to apply it to a certain number (approximately), but you can specify which will do it (I'm not sure how the game chooses which AI follow that goal). However, the "Follow" goal seems to be only applicable to a Game Object, and not a Character Index, thus you might want to use "Defend."
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: Rally Squad Weapon? (LUA)

Post by [RDH]Zerted »

Frisbeetarian wrote:You can use weights however to apply it to a certain number (approximately), but you can specify which will do it (I'm not sure how the game chooses which AI follow that goal). However, the "Follow" goal seems to be only applicable to a Game Object, and not a Character Index, thus you might want to use "Defend."
Your first sentence is a little messed up. AI goals have weights. The percentage of a goal's weight from the total defined AI goal weights is about the percentage of AI bots that will attempt to do that goal. You cannot control exactly which bot follows what AI goal.

I thought you could use character indexes with the Follow goal, but its been a while... If you can't, then use the goal on the character's unit. Don't forget to delete the AI goal after the unit dies. Too many AI goals will crash the game.

If only one player on a team will be able to use this weapon, setup an allied local team for each main team (ATT and DEF). Setup all your CPs to allow allied unit spawning. When a player uses the weapon, add the follow AI goal to the local team representing that player's main team. When that player dies, delete the AI goal. When a team has a goal, its bots will spawn. When a team has no goals, its bots stop spawning.
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: Rally Squad Weapon? (LUA)

Post by Frisbeetarian »

[RDH]Zerted wrote:You cannot control exactly which bot follows what AI goal.
That's exactly what I meant to say, I just got a little messed up thinking about something else.

I haven't checked the character indices myself, I got my information from one of Psych0fred's docs.
Post Reply