[Tutorial] Deduct points as you get the perk (Original Perk Buying)

broken avatar :(
Created 975 days ago
by pvtseacow
0 Members and 1 Guest are viewing this topic.
2,943 views
broken avatar :(
×
broken avatar :(
Location: usNew Jersey, USA
Date Registered: 8 July 2013
Last active: 159 days ago
Posts
31
Respect
Forum Rank
Legless Crawler
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Mapping Beginner
Signature
My First Map, Zombie Help[WIP]: http://ugx-mods.com/forum/index.php?topic=1422.0
×
pvtseacow's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
So, I heard you got down right inbetween that weird time frame of you buying the perk but you don't have it yet. And now you're raging and probably even left the game.
Now if it was Original? World At War, it would deduct points AFTER you got it, not as you hold "Use".
Well boi, and/or gurl (I don't judge), do I have a tutorial for you.

- Step 0:
-- Find "_zm_perks.gsc" within "ROOT\shared\raw\scripts\zm"
- Step 0.5:
-- Copy to your mod/map scripts folder. For Example: "ROOT\maps\zm_mapname\scripts\zm"
- Step 1:
-- Open the file and goto line ~577. And replace:
sound = "evt_bottle_dispense";
playsoundatposition(sound, self.origin);
player zm_score::minus_to_player_score( current_cost );
perkHash = -1;
if (isDefined(level._custom_perks[ perk ]) && isDefined(level._custom_perks[ perk ].hash_id))
{
perkHash = level._custom_perks[ perk ].hash_id;
}
player RecordMapEvent(ZM_MAP_EVENT_PERK_MACHINE_USED, GetTime(), self.origin, level.round_number, perkHash);

player.perk_purchased = perk;
player notify( "perk_purchased", perk );

self thread zm_audio::sndPerksJingles_Player(1);
self thread vending_trigger_post_think( player, perk );
-- with:
sound = "evt_bottle_dispense";
playsoundatposition(sound, self.origin);
perkHash = -1;
if (isDefined(level._custom_perks[ perk ]) && isDefined(level._custom_perks[ perk ].hash_id))
{
perkHash = level._custom_perks[ perk ].hash_id;
}
player RecordMapEvent(ZM_MAP_EVENT_PERK_MACHINE_USED, GetTime(), self.origin, level.round_number, perkHash);

player.perk_purchased = perk;
player notify( "perk_purchased", perk );

self thread zm_audio::sndPerksJingles_Player(1);
self thread vending_trigger_post_think( player, perk );
player waittill("burp");
player zm_score::minus_to_player_score( current_cost );
- Step 1.5:
-- If you didn't already, put "scriptparsetree,scripts/zm/_zm_perks.gsc" within your zone file so the game knows about the file.

Now for the less important stuff:
- Why?
-- Because I really liked that why and I figured maybe classic fans (or new ones) would like it too.
- What does this do?
-- So basically instead of the player buying the perk right away, it waits til the player burps (aka gets the perk) then issues the deduction of points.
Last Edit: January 17, 2017, 11:49:17 pm by pvtseacow
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 8 January 2014
Last active: 469 days ago
Posts
840
Respect
Forum Rank
The Decider
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Embers are the new lens flares
×
chromastone10's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
chromastone10's Contact & Social Linkschromastone10chromastone1chromastone10
I think they removed this in world at war because you could buy the perk and before your points were taken you could walk over and purchase something else for example an electric trap then have your points taken from buying the perk and go into negative points, example being on verrukt you could have 2000 points exactly, buy double tap then quickly go purchase the electric trap and then have your 2000 taken from buying double tap to get into the negative points
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 8 days ago
Posts
6,879
Respect
Forum Rank
Immortal
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social Links[email protected]HarryBo21HarryBo000
This was "never" the case

The points have always been deducted the moment you hit the trigger -> then the bottle anim

So getting downed while still drinking, regardless of holding buttons you still get charged
Last Edit: January 17, 2017, 12:16:59 pm by Harry Bo21
broken avatar :(
×
broken avatar :(
Location: usNew Jersey, USA
Date Registered: 8 July 2013
Last active: 159 days ago
Posts
31
Respect
Forum Rank
Legless Crawler
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Mapping Beginner
×
pvtseacow's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
I think they removed this in world at war because you could buy the perk and before your points were taken you could walk over and purchase something else for example an electric trap then have your points taken from buying the perk and go into negative points, example being on verrukt you could have 2000 points exactly, buy double tap then quickly go purchase the electric trap and then have your 2000 taken from buying double tap to get into the negative points
Luckily, Treyarch possible thought about this because you can't buy anything while doing the perk anims (At least for me because I tried buying the box while buying Jugg on DE)

This was "never" the case

The points have always been deducted the moment you hit the trigger -> then the bottle anim

So getting downed while still drinking, regardless of holding buttons you still get charged
As Chromastone10 said, this was the case in an earlier version of World At War, But I didn't realize/remember them updating the game so its as you use the trigger, my bad.

PS: I also kinda posted this while I was half-asleep so I was bound to derp somewhere
Last Edit: January 17, 2017, 06:06:40 pm by pvtseacow
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 8 days ago
Posts
6,879
Respect
Forum Rank
Immortal
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social Links[email protected]HarryBo21HarryBo000
No it's "never" been the case

We've had every copy of the scripts in waw

broken avatar :(
×
broken avatar :(
Location: usNew Jersey, USA
Date Registered: 8 July 2013
Last active: 159 days ago
Posts
31
Respect
Forum Rank
Legless Crawler
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Mapping Beginner
×
pvtseacow's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
¯\_(ツ)_/¯
broken avatar :(
×
broken avatar :(
Location: usNUKETOWN
Date Registered: 19 February 2014
Last active: 908 days ago
Posts
177
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Zombie Specialist
Signature
×
thezombieproject's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Oil Rig Beta Access
Oil Rig Beta Access
if player goes into laststand during drink process player waittill("burp"); will NOT be notified.
if you go into laststand im pretty sure it returns before player notify("burp");
may cause issues with re buying perk.
SEE: function vending_trigger_post_think( player, perk )


You could always add player zm_score::minus_to_player_score( the perk cost here );
in function vending_trigger_post_think( player, perk ) before player notify("burp");
this should work the same and you dont need player waittill("burp"); where you have it now.


OR   

you could make it so it just gives points back if player goes down during drink process
add a small code in mapname.gsc this way you dont need to edit perk script.
something like this...
EXAMPLE:
function watchPlayersPerks()
{
level flag::wait_till( "initial_blackscreen_passed" );
players = GetPlayers();
for ( i = 0; i < players.size; i++ )
{
players[i] thread watchPerksBought();
}
}

function watchPerksBought()
{ self endon( "disconnect" );
self endon( "end_game" );
        // self is player
while(1)
{
self waittill( "perk_purchased", perk ); wait 0.1;
while(isdefined(self.perk_purchased))
{ IPrintLnBold("player is drinking"); // remove later
wait 0.01;
} // after perk is purchased see if player is down.
if ( self laststand::player_is_in_laststand())
{
if ( isdefined( level._custom_perks[ perk ] ) && isdefined( level._custom_perks[ perk ].cost ) )
{
cost = level._custom_perks[ perk ].cost;
self zm_score::add_to_player_score(cost);
}
}
}
}

 

Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Twitch
Loading ...