UGX-Mods

Call of Duty 5: World at War => Tutorial Desk => Scripting => Topic started by: scriptz on November 07, 2016, 05:39:21 am

Title: Random Amount of Change Found Under Perk Machines
Post by: scriptz on November 07, 2016, 05:39:21 am
Hello, i do apologize i have not uploaded anything for a while , i been busy working on stuff, i am now going through and preparing a lot of finished codes for release, I will be releasing bigger more complex codes soon however i want to get some of the smaller ones uploaded first, This is a simple code i wrote to randomize the amount of points found by player when going prone in front of perk machines , as oppose to always being 25 points.

STEP 1:

open your dlc3_code.gsc (located in mods/mapname/maps/) and search for this function:

           
Code Snippet
Plaintext
check_for_change()

STEP 2:

replace the function with this one (or adjust yours to look like this):

Code Snippet
Plaintext
check_for_change()
{

while (1)
{

self waittill( "trigger", player );

if ( player GetStance() == "prone" )
{

level thread randomize_change_found();
player maps\_zombiemode_score::add_to_player_score( level.random_change_found );
play_sound_at_pos( "purchase", player.origin );
break;

}

}

}
STEP 3:

now paste this function under that function or at the bottom of the script:

Code Snippet
Plaintext
randomize_change_found()
{

level.random_change_found = undefined;
random_change_amount = randomintrange(1,8);
switch(random_change_amount)
{

case 1:
level.random_change_found = 25;
break;

case 2:
level.random_change_found = 50;
break;

case 3:
level.random_change_found = 100;
break;

case 4:
level.random_change_found = 200;
break;

case 5:
level.random_change_found = 250;
break;

case 6:
level.random_change_found = 500;
break;

case 7:
level.random_change_found = 750;
break;

case 8:
level.random_change_found = 1000;
break;

}

}

STEP 4:

save & close, then open launcher (check on dlc3_code.gsc in the list if it's not already) & build your mod.


NOTES:

- if you do not have dlc3_code.gsc in your mods/mapname/maps/ folder then copy it from raw/maps/
- the value of level.random_change_found in each case is one of the possible points player recieves, you may of course          adjust them to your liking.
Title: Re: Random Amount of Change Found Under Perk Machines
Post by: sevengpluke on November 07, 2016, 05:45:54 am
Please use the code tags next time. Thanks!
Title: Re: Random Amount of Change Found Under Perk Machines
Post by: scriptz on November 07, 2016, 06:03:36 am
sorry about that, will do, btw thank for adding them in
Title: Re: Random Amount of Change Found Under Perk Machines
Post by: pwman123 on December 24, 2016, 12:49:49 pm
harrybo21 perks completely screwed me over on this but luckily, I figured it out  ;D
Title: Re: Random Amount of Change Found Under Perk Machines
Post by: EmpGeneral on February 07, 2017, 11:22:37 pm
harrybo21 perks completely screwed me over on this but luckily, I figured it out  ;D

What did you do??
Title: Re: Random Amount of Change Found Under Perk Machines
Post by: pwman123 on February 07, 2017, 11:55:07 pm
What did you do??
I don't remember because I completely wiped out the scripts. I will add this eventually.