UGX-Mods 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 Facebook
Sign In with Twitch

Adding a weapon to the box after Soul Chest is completed

broken avatar :(
Created 6 years ago
by EmpGeneral
0 Members and 1 Guest are viewing this topic.
984 views
broken avatar :(
×
broken avatar :(
Location: br
Date Registered: 7 May 2015
Last active: 1 month ago
Posts
312
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Signature
×
EmpGeneral's Groups
EmpGeneral's Contact & Social LinksldraweEletricStorm
As the title says,I want to add a weapon to the box after the soul chest is completed,maybe adding something to this 2 functions:

Code Snippet
Plaintext
treasure_chest_ChooseRandomWeapon()

Code Snippet
Plaintext
treasure_chest_ChooseWeightedRandomWeapon()
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
This should work, not tested though so if you get an error let me know..


First, if you want it to be limted to one player, set this ( in _zombiemode_weapons ):

Code Snippet
Plaintext
	add_limited_weapon( "tesla_gun", 1);


You should setup the weapon to be included in the box in dlc3_code like a normal gun.
Next, in both functions you named. Look for this:


Code Snippet
Plaintext
	for( i = 0; i < keys.size; i++ )
{
if( !get_is_in_box( keys[i] ) )
{
continue;
}

if( player has_weapon_or_upgrade( keys[i] ) )
{
continue;
}

if( !IsDefined( keys[i] ) )
{
continue;
}



And under it add: ( do that in both functions )
Code Snippet
Plaintext
		// If the chests are not completed or the reward is still in the map, do not add the weapon to the box
if( level.chest_active && keys[i] == "tesla_gun" || keys[i] == "tesla_gun" && !level.chest_active && !chest_reward_picked_up() )
{
continue;
}




Then add this new function to the file:
Code Snippet
Plaintext
chest_reward_picked_up()
{
reward_picked_up = false;

players = get_players();
for( i=0 ; i<players.size ; i++ )
{
if( players[i].free_ray_gun )
{
reward_picked_up = true;
break;
}
}

return reward_picked_up;
}
   


broken avatar :(
×
broken avatar :(
Location: br
Date Registered: 7 May 2015
Last active: 1 month ago
Posts
312
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
EmpGeneral's Groups
EmpGeneral's Contact & Social LinksldraweEletricStorm
Thanks for your help Blunt!I will test it and see if it works!

 
Loading ...