Page 1 of 1

Rally Squad Weapon? (LUA)

Posted: Sat Apr 25, 2009 5:40 pm
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.

Re: Rally Squad Weapon? (LUA)

Posted: Sat Apr 25, 2009 5:43 pm
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.

Re: Rally Squad Weapon? (LUA)

Posted: Sat Apr 25, 2009 6:42 pm
by DarthD.U.C.K.
there is a follow aigoal, it should work online too

Re: Rally Squad Weapon? (LUA)

Posted: Sun Apr 26, 2009 12:50 pm
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.

Re: Rally Squad Weapon? (LUA)

Posted: Sun Apr 26, 2009 4:30 pm
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?

Re: Rally Squad Weapon? (LUA)

Posted: Sun Apr 26, 2009 9:39 pm
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.

Re: Rally Squad Weapon? (LUA)

Posted: Sun Apr 26, 2009 11:45 pm
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.

Re: Rally Squad Weapon? (LUA)

Posted: Mon Apr 27, 2009 9:12 am
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."

Re: Rally Squad Weapon? (LUA)

Posted: Mon Apr 27, 2009 12:20 pm
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.

Re: Rally Squad Weapon? (LUA)

Posted: Mon Apr 27, 2009 1:24 pm
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.