Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Release Pointstreaks
#1
Rainbow 
I made this about a week ago. whenever I saw the idea of pointstreaks in MW3 I tought that would be kinda nice to have in a game where nobody plays the objective.

I tought it would be really hard to do and stuff, but after looking tru alot of stuff its actually only 1 simple function... lol.

C++ Code
  1. #include common_scripts\utility;
  2. #include maps\mp\_utility;
  3.  
  4. init()
  5. {
  6. // the player will recieve a 'point' on one of these events
  7. level.pointstreak = array( "capture",
  8. "kill_carrier",
  9. "plant",
  10. "defuse",
  11. "destroyer" );
  12.  
  13. // this will make the script run
  14. level.onPlayerScore = :<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />treakCheck;
  15. }
  16.  
  17. streakCheck( event, player, victim );
  18. {
  19. if ( !isKillStreaksEnabled() )
  20. return;
  21.  
  22. if( !level.teamBased )
  23. return;
  24.  
  25. // this runs on every EVENT, which means also on a kill, suicide, and every other
  26. // time the 'givePlayerScore' function gets called. it only gives a point if it is a valid event
  27. isValidPointstreak = false;
  28.  
  29. for( i = 0; i < level.pointstreak.size; i++ )
  30. if( event == level.pointstreak[i] )
  31. isValidPointstreak = true;
  32.  
  33. // give the point if its valid
  34. if( isValidPointstreak )
  35. {
  36. player.pers[ "cur_kill_streak" ]++;
  37. player thread maps\mp\gametypes\_hardpoints::giveKillstreakForStreak();
  38. }
  39.  
  40. // default onPlayerScore stuff
  41. maps\mp\gametypes\_globallogic_score::default_onPlayerScore( event, player, victim );
  42. }


just call it on _load.gsc or something
Code:
maps\mp\WHATEVER_YOU_NAMED_IT::init();

Its still untested but I do not have blops installed anymore so I dont feel like installing it just to test, I'm pretty sure it works anyway.

You can add more events to the array, the ones that exist in the game are these:
Code:
capture // captured a: dom point, flag, headquarters
kill // killed someone
headshot // made a headshot
suicide // suicided
kill_carrier // killed the flagcarrier=
destroyer // destroyed a bombsite
defuse // defused a bomb
plant // planted a bomb
pickup // picked up a ctf flag
assault // killed a flag/headquarters defender
defend // defended your flag/headquarters
melee_kill // melee kill, used in wager matches
hatchet_kill // hatchet kill, used in wager matches
other_kill // unknown .. used in wager matches
death // you died
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#2
Looks good, y u no create mod?
Reply

#3
(10-23-2011, 03:35)jariz Wrote: Looks good, y u no create mod?

coz me no have idea, now test it bitch.
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#4
Nice code, everything seems like it would work, but I can't test it :X
You never restore the killstreak if they die? or does it not reset?

and here's a slight optimization but is my preference only

(10-23-2011, 03:24)iAegle Wrote:
C++ Code
  1. level.onPlayerScore_old = level.onPlayerScore;
  2. level.onPlayerScore = :<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />treakCheck;
  3.  
  4. //replace maps\mp\gametypes\_globallogic_score::default_onPlayerScore( event, player, victim );
  5. //with
  6. thread [[level.onPlayerScore_old]](event, player, victim);
  7. //just incase level.onPlayerScore is modified and points to somewhere other than globallogic_score
[Image: b_560_95_1.png]
Reply

#5
(10-23-2011, 04:04)Nukem Wrote: Nice code, everything seems like it would work, but I can't test it :X
You never restore the killstreak if they die? or does it not reset?

and here's a slight optimization but is my preference only

(10-23-2011, 03:24)iAegle Wrote:
C++ Code
  1. level.onPlayerScore_old = level.onPlayerScore;
  2. level.onPlayerScore = :<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />treakCheck;
  3.  
  4. //replace maps\mp\gametypes\_globallogic_score::default_onPlayerScore( event, player, victim );
  5. //with
  6. thread [[level.onPlayerScore_old]](event, player, victim);
  7. //just incase level.onPlayerScore is modified and points to somewhere other than globallogic_score
Ieagle uses player.pers[ "cur_kill_streak" ]++ which is already used by the default killstreak system so it should reset when you die.
You still need to put the player.pers[ "cur_kill_streak" ]++ out of player_killed() in globallogic_player.gsc though so that you won't get a killstreak point for both a kill and score (unless you want that of course). Just watch out that you don't have both player.pers[ "cur_kill_streak" ]++ in player_killed() and kill in the array or you'll get two killstreak points for one kill. Tongue
Would like to make a donation? Click here
Reply

#6

Quote:Ieagle

[Image: eaglecl.jpg]
[Image: eagle2g.jpg]

REQUESTING IEAGLE'S NICK CHANGE

Ontopic : Sounds cool, anybody tested it ?
[Image: lQDUjba.jpg]
Reply

#7
(10-23-2011, 09:06)Cyborgking Wrote:
(10-23-2011, 04:04)Nukem Wrote: Nice code, everything seems like it would work, but I can't test it :X
You never restore the killstreak if they die? or does it not reset?

and here's a slight optimization but is my preference only

(10-23-2011, 03:24)iAegle Wrote:
C++ Code
  1. level.onPlayerScore_old = level.onPlayerScore;
  2. level.onPlayerScore = :<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />treakCheck;
  3.  
  4. //replace maps\mp\gametypes\_globallogic_score::default_onPlayerScore( event, player, victim );
  5. //with
  6. thread [[level.onPlayerScore_old]](event, player, victim);
  7. //just incase level.onPlayerScore is modified and points to somewhere other than globallogic_score
Ieagle uses player.pers[ "cur_kill_streak" ]++ which is already used by the default killstreak system so it should reset when you die.
You still need to put the player.pers[ "cur_kill_streak" ]++ out of player_killed() in globallogic_player.gsc though so that you won't get a killstreak point for both a kill and score (unless you want that of course). Just watch out that you don't have both player.pers[ "cur_kill_streak" ]++ in player_killed() and kill in the array or you'll get two killstreak points for one kill. Tongue

But you still get a 'point' in mw3 when you kill someone right?

edit:
Just because its nukem and the function will not give any XP/popup when th event is not valid, here's a new one:
C++ Code
  1. #include common_scripts\utility;
  2. #include maps\mp\_utility;
  3.  
  4. init()
  5. {
  6. level.pointstreak = array( "capture", "kill_carrier", "plant", "defuse", "destroyer" );
  7. level.onPlayerScore_old = level.onPlayerScore;
  8. level.onPlayerScore = :<img src="https://www.itsmods.com/forum/images/smilies/confused.gif" alt="Confused" title="Confused" class="smilie smilie_13" />treakCheck;
  9. }
  10.  
  11. streakCheck( event, player, victim )
  12. {
  13. thread [[level.onPlayerScore_old]]( event, player, victim );
  14.  
  15. if( !isKillStreaksEnabled() )
  16. return;
  17.  
  18. if( !level.teamBased )
  19. return;
  20.  
  21. isValidPointstreak = false;
  22.  
  23. for( i = 0; i < level.pointstreak.size; i++ )
  24. if( event == level.pointstreak[i] )
  25. isValidPointstreak = true;
  26.  
  27. if( isValidPointstreak )
  28. {
  29. player.pers[ "cur_kill_streak" ]++;
  30. player thread maps\mp\gametypes\_hardpoints::giveKillstreakForStreak();
  31. }
  32. }
(08-10-2011, 12:58)Pozzuh Wrote:
Se7en Wrote:Stealed, from cod4 mod ...
look who's talking

[Release] Old School Mod v2.2
[Release] Scroll menu

Reply

#8
How do this when you want to give self.money to a player, when he does this:

level.pointstreak = array( "capture", "plant", "defuse", "destroyer" );
Black Ops Mods:

RPG(rocket launcher) mod
Get the Specials

Old aliasses:

eliteCVDelite
CVD

Reply



Forum Jump:


Users browsing this thread:
4 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.