ItsMods

Full Version: How to force end game for a player?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to end the game for a player (letting him win), forcing the game to show the final kills of that player as a killcam?
I might not recall correctly, but I think there's a part in the file that handles player deaths that defines which death is the final killcam. You'd have to change that there, depending on how you're going to implement the rest.

As for ending the game, I'm pretty sure there's a function for that. Check the different gametypes. Free for all or team deathmatch might be easier since they're the most simple gametypes. The winning player is the one who has the highest score, so the easiest thing to do would be to give the player you want to win a bunch of extra score. There's of course other ways you could do it, but this is the easiest way I can think of right now.


So:

1. Make a new thread for this whole function.

2. Define the player you want to win.

3. Link the end game from that thread.

4. Find and edit the player deaths code, and force the game winning killcam to be the kill of the player you want to win, by using what you did in step 2.
Hey there how did you solve it and what are you working on? I'm curious.

I'm ending the game like this:
https://github.com/Siilwyn/iw4-checkmate...r.gsc#L335
Siilwyn,
Does your code work for all game modes? Does it work for you every time?
And does it apply in FFA?
Edit: Oh wait, now I noticed this is in war.gsc
Edit 2: So I can just use the player.finalKill value?
Edit 3: Nope, doesn't work for me :/
(10-27-2016, 17:49)Ra3shed Wrote: [ -> ]Siilwyn,
Does your code work for all game modes? Does it work for you every time?
And does it apply in FFA?
Edit: Oh wait, now I noticed this is in war.gsc
Edit 2: So I can just use the player.finalKill value?
Edit 3: Nope, doesn't work for me :/

Yes, it should work for all gametypes.

This is the important part in @Siilwyn 's code
Code:
if(self.role == "king")
  {
    attacker.finalKill = true;
    level thread maps\mp\gametypes\_gamelogic::endGame("axis", "The king has died.");
    return;
  }

You're gonna have to change the self.role to react on something else, if itwasn't clear. It all depends on what you're actually trying to achieve.