MissionVictory triggered by death of VIP?
Moderator: Moderators
- Whyioughta
- Recruit Womprat Killer
- Posts: 9
- Joined: Sun Jul 15, 2007 9:26 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
MissionVictory triggered by death of VIP?
Just wondering if anyone has a quick way of scripting a MissionVictory when a particular class dies?
Working on a rescue gametype (a la Team Fortress Classic - fatman w/ umbrella) and I want MissionVictory when the attackers kill (for example) all_hero_leia.
I've looked at poaching the singleplayer Naboo script (killing the queen) but it's based on a non-playable third team.
Thanks.
Working on a rescue gametype (a la Team Fortress Classic - fatman w/ umbrella) and I want MissionVictory when the attackers kill (for example) all_hero_leia.
I've looked at poaching the singleplayer Naboo script (killing the queen) but it's based on a non-playable third team.
Thanks.
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
*Edit* Welcome to Gametoast, Whyioughta.
Hmm, maybe something like this?
If you can't find out a mission ender function, you could use
SetReinforcementCount (2, 0) --Team 2 to 0 reinforcments (rebs lose)
instead.
Geez...I can't believe I never though of that last bit before...
Anyway I hope this works...or that someone elaborates on it. I'm unsure if this is what the 'Class' filter is for.
Hmm, maybe something like this?
Code: Select all
OnCharacterDeathClass(
function(player, killer)
"The Function that ends the game in favour of IMPS-yeah, no one ever told me what that was...." *
end
end,
"all_inf_leigha"
)
SetReinforcementCount (2, 0) --Team 2 to 0 reinforcments (rebs lose)
instead.
Geez...I can't believe I never though of that last bit before...
Anyway I hope this works...or that someone elaborates on it. I'm unsure if this is what the 'Class' filter is for.
- Whyioughta
- Recruit Womprat Killer
- Posts: 9
- Joined: Sun Jul 15, 2007 9:26 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Whyioughta
- Recruit Womprat Killer
- Posts: 9
- Joined: Sun Jul 15, 2007 9:26 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
- Whyioughta
- Recruit Womprat Killer
- Posts: 9
- Joined: Sun Jul 15, 2007 9:26 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Perhaps Zerted, but I just don't know how to script it properly in the lua. My capacity for trial-and-error is waning although it far outweighs my capacity to learn how to programme this stuff.
I'd appreciate it if you'd spell it out.
Also, I thought "Character" related to the human player, not the "class" they are playing as.
(shrug)
I'd appreciate it if you'd spell it out.
Also, I thought "Character" related to the human player, not the "class" they are playing as.
(shrug)
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Well, as I understood from Zerted/Thedocks, putting [Class] filter on the end of the event line there tells the game to look for the ["dsfsdfh"]line under the [end,]
and not just ignore it and treat it like a filterless [end)]
Character AFAIK refres to any spawned unit. Just like Object refers to objects etc.
and not just ignore it and treat it like a filterless [end)]
Character AFAIK refres to any spawned unit. Just like Object refers to objects etc.
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
I can write the code for you, but I want more details. Is your Leia always a human or a bot or could be both? Is it on a team by itself? Could it be on a team by itself? Which side wins when Leia dies or do you want whatever team that killed her to win? What happens if she never dies? Do you have another objective running (CP, CTF, Hunt, Assualt, Eli, etc...)?
A player is nothing the game understands.
A unit is what you see running around on the battlefront. After you spawn, you control a unit. When it dies, it is gone forever. A unit is an object. All object functions (and thus all entity functions) work on it.
A character is you. It is you when you are controlling a unit. It is you when your unit dies. It is you when you are deciding what unit to select. You are always it, and it is always you. The only way to not be a character is to not pick a side when you join (but then you can't play). A character is not an object. Only character functions work on characters. Some character functions are in the scripting doc, the others are hidden throughout the game code.
Entity is defined in the Battlefront2_scripting_system.doc.
*As far as I've noticed
A player is nothing the game understands.
A unit is what you see running around on the battlefront. After you spawn, you control a unit. When it dies, it is gone forever. A unit is an object. All object functions (and thus all entity functions) work on it.
A character is you. It is you when you are controlling a unit. It is you when your unit dies. It is you when you are deciding what unit to select. You are always it, and it is always you. The only way to not be a character is to not pick a side when you join (but then you can't play). A character is not an object. Only character functions work on characters. Some character functions are in the scripting doc, the others are hidden throughout the game code.
Entity is defined in the Battlefront2_scripting_system.doc.
*As far as I've noticed
- Whyioughta
- Recruit Womprat Killer
- Posts: 9
- Joined: Sun Jul 15, 2007 9:26 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Aha, that makes a lot of sense. Thanks for taking the time to put it so eloquently.
I'll have another go at it myself, but just in case the inevitable happens, I'll answer your questions.
The premise of the gametype is VIP + Bodyguards vs Bounty Hunters, where the VIP has to get to a region for her and the BG's to win and the BH's have to kill the VIP to win.
Sounds simple now I hear myself type it.
I don't think there's any need to have another objective running although it would add some ambience if there was a battle going on between bot rebs and imps who will mostly ignore you.
Leia needs to be a human playable class which would need to be on the bodyguard team (cause you can only have 2 playable teams(?)) I realise this whole thing would be easier is she's just a bot on her own team (like the Queen in Naboo single player)
What happens if she never dies? Everyone dies, friend.
I'll have another go at it myself, but just in case the inevitable happens, I'll answer your questions.
The premise of the gametype is VIP + Bodyguards vs Bounty Hunters, where the VIP has to get to a region for her and the BG's to win and the BH's have to kill the VIP to win.
Sounds simple now I hear myself type it.
I don't think there's any need to have another objective running although it would add some ambience if there was a battle going on between bot rebs and imps who will mostly ignore you.
Leia needs to be a human playable class which would need to be on the bodyguard team (cause you can only have 2 playable teams(?)) I realise this whole thing would be easier is she's just a bot on her own team (like the Queen in Naboo single player)
What happens if she never dies? Everyone dies, friend.
-
Ace_Azzameen_5
- Jedi

- Posts: 1119
- Joined: Sat Apr 23, 2005 8:52 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
My Code
My Bf Log
Baahahahaha WIth the knowledge I've gained from you master, I have become more powerful, powerful enough to insult you with the Bfront2/log! No offense intended.
I never spawned as CIS (team 2), and the Bf log listed the message about 20 times - the CIS unit count. My hypothesis is that either charcters = units, or more likely, the game adds the UnitCount number of AI players, these as well with the human players are characters. So when "unit 362" dies,"unit 362" respawns, creating a new unit.
However the displayed names may be random and not follow the AI characters.
btw. thats part of my code for enforcing unit count on human players for the CIS at a certain point in the campaign wherein minimal CIS troops should be around.
Code: Select all
OnCharacterSpawnTeam(
function(player)
print(" ")
print("Message Severity: 7")
print("Zerted was wrong!!?!!?!?")
print("Apparently charcters aren't joined human players but indeed ingame units-or in game AI? ")
NumCisSpawnedTroops = NumCisSpawnedTroops + 1
CountEnforcementSpawn()
end,
"2"
)
Code: Select all
Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\FLEffect.cpp(427)
Attach: model '' [ddf82d1c] has no hardpoint '' [845f8034]
Message Severity: 7
Zerted was wrong!!?!!?!?
Apparently charcters aren't joined human players but indeed ingame units-or in game AI? X 20
I never spawned as CIS (team 2), and the Bf log listed the message about 20 times - the CIS unit count. My hypothesis is that either charcters = units, or more likely, the game adds the UnitCount number of AI players, these as well with the human players are characters. So when "unit 362" dies,"unit 362" respawns, creating a new unit.
However the displayed names may be random and not follow the AI characters.
btw. thats part of my code for enforcing unit count on human players for the CIS at a certain point in the campaign wherein minimal CIS troops should be around.
- Whyioughta
- Recruit Womprat Killer
- Posts: 9
- Joined: Sun Jul 15, 2007 9:26 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
I really am getting nowhere with this - I've tried a lot of workarounds but can't get it to single out a particular class. It's likely to just be my grasp on syntax etc so has anyone got any ideas?
This has totally scuttled the map idea so I'm glad I haven't spent much time on the units/environment.
This has totally scuttled the map idea so I'm glad I haven't spent much time on the units/environment.
- Whyioughta
- Recruit Womprat Killer
- Posts: 9
- Joined: Sun Jul 15, 2007 9:26 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Re: MissionVictory triggered by death of VIP?
Sorted it.
It's a bit messy because I inserted this halfway down ObjectiveTDM.lua
Character 0 is the first selectable unit ie. normally soldier class.
It's a bit messy because I inserted this halfway down ObjectiveTDM.lua
Code: Select all
local victimTeam = GetCharacterTeam(character)
local victimCharacter = GetCharacterClass(character)
if victimCharacter == 0
and victimTeam == 1
then
ShowMessageText("game.vip.deadatt", DEF)
ShowMessageText("game.vip.deaddef", ATT)
MissionVictory(2)Character 0 is the first selectable unit ie. normally soldier class.
