Page 1 of 1
MissionVictory triggered by death of VIP?
Posted: Sun Jul 15, 2007 9:52 pm
by Whyioughta
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.
Posted: Sun Jul 15, 2007 10:33 pm
by Ace_Azzameen_5
*Edit* Welcome to Gametoast, Whyioughta.
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"
)
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.
Posted: Sun Jul 15, 2007 10:46 pm
by Whyioughta
Thanks. I'll give it a shot later tonight (New Zealand time)
Posted: Sun Jul 15, 2007 11:51 pm
by Ace_Azzameen_5
K. I'll check in tomorrow (Sleep time) and maybe look around the assets, cause I could use this code too.
Posted: Mon Jul 16, 2007 6:36 pm
by Whyioughta
Nope, I didn't get anywhere with that. btw, MissionVictory(1) works fine for ending the game.
Any more ideas? I have a super long way round but that involves fudging the CTF gametype beyond recognition.
Posted: Mon Jul 16, 2007 9:05 pm
by [RDH]Zerted
Why do you not want to use MissionVictory() inside an OnCharacterDeath()? Doesn't it do exactly what you want?
Posted: Mon Jul 16, 2007 9:46 pm
by Whyioughta
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)
Posted: Tue Jul 17, 2007 3:12 pm
by Ace_Azzameen_5
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.
Posted: Tue Jul 17, 2007 9:06 pm
by [RDH]Zerted
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
Posted: Tue Jul 17, 2007 11:09 pm
by Whyioughta
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.
Posted: Wed Jul 18, 2007 12:17 pm
by Ace_Azzameen_5
My Code
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"
)
My Bf Log
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
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.
Posted: Fri Aug 03, 2007 7:41 pm
by Whyioughta
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.
Re: MissionVictory triggered by death of VIP?
Posted: Sat Feb 02, 2008 10:53 pm
by Whyioughta
Sorted it.
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.