• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help How to force end game for a player?
#1
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?
  Reply
#2
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.
[-] The following 1 user says Thank You to Rendflex for this post:
  • Ra3shed
  Reply
#3
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
“It’s not what happens that counts... It’s how you react.”
[-] The following 2 users say Thank You to Siilwyn for this post:
  • Ra3shed, Rendflex
  Reply
#4
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 :/
  Reply
#5
(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 it wasn't clear. It all depends on what you're actually trying to achieve.
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Change Player Score Xaedrus 8 1,400 04-07-2015, 18:06
Last Post: Nekochan
  Help No "Load Game" Button MW2 Liberation? CoDChaoz 0 940 11-28-2014, 19:12
Last Post: CoDChaoz
  Help playing mp player anims zurasaur 5 1,260 09-16-2014, 21:15
Last Post: Yamato
  Spawning player on Snd Cation 3 790 08-02-2014, 08:09
Last Post: Cation
Question Help Gradually move player to a position zurasaur 7 1,446 07-03-2014, 23:34
Last Post: zurasaur
  Is there a way to write a script that waits for in-game text commands? ex: !kick akillj 1 816 11-30-2013, 14:34
Last Post: Nekochan

Forum Jump:


Users browsing this thread: 1 Guest(s)