Prevent One Class From Picking Up the Flag? [Solved]

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
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Prevent One Class From Picking Up the Flag? [Solved]

Post by jedimoose32 »

Hi everyone.

My question is pretty much just what the title says. Anyone know how to prevent one specific class from picking up a flag? I've searched through the documentation and the LUA Callbacks list and can't find anything there. Looked through the odf parameters list as well. It's worth mentioning that this class is playable by humans, so I can't use the AllowAIPickup odf parameter. And this needs to be multiplayer compatible so I can't use AllowTeamPickup either. :runaway:
Last edited by jedimoose32 on Thu Jul 30, 2015 1:43 am, edited 1 time in total.
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Prevent One Class From Picking Up the Flag?

Post by Noobasaurus »

There's the thing where a droideka needs to deploy from ball mode the pickup flag (I think), so that could be useful. Same with vehicles.
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: Prevent One Class From Picking Up the Flag?

Post by jedimoose32 »

Do you know the parameter off hand? I haven't been able to find anything related to that.
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Prevent One Class From Picking Up the Flag?

Post by Noobasaurus »

I don't believe that there is one, but you could try using the ClassLabel "walkerdroid".

Or perhaps this:

Code: Select all

TEMP_Type           = "0"
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: Prevent One Class From Picking Up the Flag?

Post by jedimoose32 »

What does TEMP_Type 0 do?

Edit: Seems to be related to walker animations. So no, unfortunately I don't think anything droideka-related will help. My current plan is not as... elegant... but should do the trick - I'll just teleport characters of this specific class backward about .5 m if they get within 1 m of the flag. :P
Noobasaurus
Droid Pilot Assassin
Droid Pilot Assassin
Posts: 2006
Joined: Tue Aug 17, 2010 5:56 pm

Re: Prevent One Class From Picking Up the Flag?

Post by Noobasaurus »

Hmm, I thought that it might be related to whether it could pick it up (ball mode or not). I was thinking TEMP_Type 1 might disable the unit from picking it up, but I suppose from your findings it doesn't.

There's also these two:

Code: Select all

CanCharacterInteractWithFlag(lua_State *aState);
GetFlagCarrier(lua_State *aState);
If the unit spawns as a certain class, you set the first one to false. The second one might be useful if a unit is carrying the flag which you don't want to, and in that case kill them or something. :P
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: Prevent One Class From Picking Up the Flag?

Post by jedimoose32 »

I'm pretty sure CanCharacterInteractWithFlag() is for returning a Boolean only, it doesn't set the value for the character. At least, that's the only way I've seen it used in the shipped game code. But I'll try using it.
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: Prevent One Class From Picking Up the Flag?

Post by [RDH]Zerted »

jedimoose32 wrote:I'll just teleport characters of this specific class backward about .5 m if they get within 1 m of the flag. :P
Sounds like a good way to case wall hacks. You can also kill anyone who picks up the flag as that specific class. You should put a message at the start of the mission about the class not being able to get the flag.

Can you move the units (including human players) of the class on to a 3rd and 4th team and prevent those teams from being able to pick up the flag using AllowTeamPickup? It may or may not work depending on how you want the normal teams to interact with the flag, but I didn't think AllowTeamPickup by itself causes issues in MP.

There isn't much else you can do from the Lua side. Your best bet is an ODF parameter if one exists.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Prevent One Class From Picking Up the Flag?

Post by Maveritchell »

It really depends on what you want to do with the flag. It might be easier to simply test which classes are picking up the flag, and if the wrong class picks it up, kill the flag and respawn it.
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: Prevent One Class From Picking Up the Flag?

Post by jedimoose32 »

I want the flag to stay put... I really don't want it to reset to its spawn position when this class tries to pick it up (e.g. if someone else is running with it and drops it, then this class tries to pick it up, it should stay on the first player's dead body). So maybe I'll get the flag's matrix every time it's dropped and then kill the class that tries to pick it up, and also teleport the flag to the matrix where it was dropped.
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Prevent One Class From Picking Up the Flag?

Post by Maveritchell »

jedimoose32 wrote:I want the flag to stay put... I really don't want it to reset to its spawn position when this class tries to pick it up (e.g. if someone else is running with it and drops it, then this class tries to pick it up, it should stay on the first player's dead body). So maybe I'll get the flag's matrix every time it's dropped and then kill the class that tries to pick it up, and also teleport the flag to the matrix where it was dropped.
Why are you killing anyone? Why all the violence?

You don't need to kill whoever picks it up just to make sure only your approved classes pick it up. What I meant was that you should kill the flag once it's picked up and then respawn it back at its picked-up location. Like you said, you already know how to test for its location matrix when it's picked up or dropped, so just respawn the flag there if a non-approved class picks it up. It should be a relatively fluid and seamless experience for the class, too, which is not what you'll get with a force kill-and-respawn (of a unit).
jedimoose32
Field Commander
Field Commander
Posts: 938
Joined: Thu Jan 24, 2008 12:41 am
Projects :: Engineering Degree
Location: The Flatlands of Canada

Re: Prevent One Class From Picking Up the Flag?

Post by jedimoose32 »

Mm, good point. I guess that's way simpler. Thanks!
Post Reply