Objective marker problem

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
nobody3
Rebel Sergeant
Rebel Sergeant
Posts: 188
Joined: Wed Jun 15, 2011 8:30 am

Objective marker problem

Post by nobody3 »

problem I have is the marker does not work for multiple classes... I put 3 of them together (like in coruscant campaign jed masters) like so:

MapAddClassMarker("rxz_inf_scout", "hud_objective_icon_circle", 3.5, ATT, "YELLOW", true)
MapAddClassMarker("rxz_inf_jug", "hud_objective_icon_circle", 3.5, ATT, "YELLOW", true)
MapAddClassMarker("sda_inf_war", "hud_objective_icon_circle", 3.5, ATT, "YELLOW", true)

But everytime I do so, only the first unit has the marker working! I dont know whats wrong, maybe the team is wrong? I tried change "ATT" to "DEF" but still problem remains... please help :( thanks
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Objective marker problem

Post by AQT »

Where are these lines in your lua? Try assigning each of them a different variable like:

Code: Select all

variable1 = MapAddClassMarker("rxz_inf_scout", "hud_objective_icon_circle", 3.5, ATT, "YELLOW", true)
And so on.
nobody3
Rebel Sergeant
Rebel Sergeant
Posts: 188
Joined: Wed Jun 15, 2011 8:30 am

Re: Objective marker problem

Post by nobody3 »

AQT wrote:Where are these lines in your lua?
Under "function ScriptPostLoad()" (I also tried moving them around with no effect)
AQT wrote:Try assigning each of them a different variable like:

Code: Select all

variable1 = MapAddClassMarker("rxz_inf_scout", "hud_objective_icon_circle", 3.5, ATT, "YELLOW", true)
And so on.
Hmm that didnt seem to have any effect...

I think my problem only happens when I try to put markers on 2 different teams... because on 1 team it works as it should but on other team, the marker(s) work for different units than I specified...

When I change the "ATT" with "DEF" it works on opposite team... is there a way to make it work for both teams? Thanks

Code: Select all

MapAddClassMarker("rxz_inf_scout", "hud_objective_icon_circle", 3.5, ATT, "YELLOW", true)
what does the "ATT" refer to? Is it the team that sees the marker or is the team that has the marker on their head?
AQT
Gametoast Staff
Gametoast Staff
Posts: 4910
Joined: Sat Nov 03, 2007 4:55 pm
Location: SoCal, USA

Re: Objective marker problem

Post by AQT »

nobody3 wrote:

Code: Select all

MapAddClassMarker("rxz_inf_scout", "hud_objective_icon_circle", 3.5, ATT, "YELLOW", true)
what does the "ATT" refer to? Is it the team that sees the marker or is the team that has the marker on their head?
Most likely the team that sees the marker. If that's the case, then try adding this line twice, once for ATT, and the second time for DEF.
nobody3
Rebel Sergeant
Rebel Sergeant
Posts: 188
Joined: Wed Jun 15, 2011 8:30 am

Re: Objective marker problem

Post by nobody3 »

AQT wrote:
nobody3 wrote:

Code: Select all

MapAddClassMarker("rxz_inf_scout", "hud_objective_icon_circle", 3.5, ATT, "YELLOW", true)
what does the "ATT" refer to? Is it the team that sees the marker or is the team that has the marker on their head?
Most likely the team that sees the marker. If that's the case, then try adding this line twice, once for ATT, and the second time for DEF.
Oh stupid me... I didn't quit the game when testing the new .lvls ... I just restarted the map and that's why the changes didn't refresh lol...

Anyway I think I know what is causing the original error now... I have the markers on bunch of units now and I think its limited to 7 or 8 or so units and then it ignores them I guess but idk Ill have to test more to be sure

Weird bug when I play the markers show now but when the next map starts they stop working until I restart swbf2 game...

and now its crashing the game right when the last soldier is killed and map is supposed to end... I made bfront log but couldnt find anything with severity 3 in 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: Objective marker problem

Post by [RDH]Zerted »

MapAddClassMarker() might only add markers to entities that are alive at the moment you call it. Since that's not working, I'd recommend using MapAddEntityMarker() on all the entities you want marked. If you want all the units marked, use MapAddEntityMarker() in an OnCharacterSpawn() and MapRemoveEntityMarker() when the unit dies.

Markers are only added to one team at a time, so if you want them visible on both teams you need to add them for both teams.

Examples:
MapAddEntityMarker(self.flag, self.flagIcon, self.flagIconScale, team, "YELLOW", true, false, true, true)
MapAddEntityMarker(self.flag, "hud_target_flag_onscreen", 3, ATT, "YELLOW", true, false, true, true)
MapAddEntityMarker(GetCharacterUnit(player), "hud_target_flag_onscreen", 3, DEF, "YELLOW", true, false, true, true)
MapRemoveEntityMarker(self.flag)
MapRemoveEntityMarker(GetCharacterUnit(player))

I forget what all the trues and falses mean. Play around with them and search through the other script files to see how the official scripts use them. If the game is limiting how many markers are shown, it might be a memory pool issue.

MapRemoveClassMarker()
MapAddClassMarker()
MapRemoveEntityMarker()
MapAddEntityMarker()
MapRemoveRegionMarker()
MapAddRegionMarker()
nobody3
Rebel Sergeant
Rebel Sergeant
Posts: 188
Joined: Wed Jun 15, 2011 8:30 am

Re: Objective marker problem

Post by nobody3 »

[RDH]Zerted wrote:MapAddClassMarker() might only add markers to entities that are alive at the moment you call it. Since that's not working, I'd recommend using MapAddEntityMarker() on all the entities you want marked. If you want all the units marked, use MapAddEntityMarker() in an OnCharacterSpawn() and MapRemoveEntityMarker() when the unit dies.

Markers are only added to one team at a time, so if you want them visible on both teams you need to add them for both teams.

Examples:
MapAddEntityMarker(self.flag, self.flagIcon, self.flagIconScale, team, "YELLOW", true, false, true, true)
MapAddEntityMarker(self.flag, "hud_target_flag_onscreen", 3, ATT, "YELLOW", true, false, true, true)
MapAddEntityMarker(GetCharacterUnit(player), "hud_target_flag_onscreen", 3, DEF, "YELLOW", true, false, true, true)
MapRemoveEntityMarker(self.flag)
MapRemoveEntityMarker(GetCharacterUnit(player))

I forget what all the trues and falses mean. Play around with them and search through the other script files to see how the official scripts use them. If the game is limiting how many markers are shown, it might be a memory pool issue.

MapRemoveClassMarker()
MapAddClassMarker()
MapRemoveEntityMarker()
MapAddEntityMarker()
MapRemoveRegionMarker()
MapAddRegionMarker()
Ok I'll try your suggestions. And will this also fix the problem that I described through the PM? (It only working for first map I play)
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: Objective marker problem

Post by [RDH]Zerted »

It only working the first time you play a map doesn't make sense. My only guess for that is the marker field doesn't get removed properly at the end of the game and when the next game starts, SWBF2 somehow thinks everything already has a marker.

Anyway, get it working for the map first and hopefully it'll magically fix the re-playability issue.
nobody3
Rebel Sergeant
Rebel Sergeant
Posts: 188
Joined: Wed Jun 15, 2011 8:30 am

Re: Objective marker problem

Post by nobody3 »

[RDH]Zerted wrote:It only working the first time you play a map doesn't make sense. My only guess for that is the marker field doesn't get removed properly at the end of the game and when the next game starts, SWBF2 somehow thinks everything already has a marker.

Anyway, get it working for the map first and hopefully it'll magically fix the re-playability issue.
You know you might be right... I did not include "remove" code as well...

Could you give me an example of a remove code? I'm not very good at creating new scripts/function things but Im guessing is it would include something like OnObjectiveEnd (Thats completely made up function by the way)
Post Reply