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

Soul Chest Reward Issue

broken avatar :(
Created 10 years ago
by RichGaming
0 Members and 1 Guest are viewing this topic.
2,074 views
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 9 November 2013
Last active: 5 years ago
Posts
502
Respect
Forum Rank
Zombie Enslaver
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Custom Zombies Videos: YouTube.com/RichGaming
Signature
YouTube: YouTube.com/RichGaming
Twitter: Twitter.com/RichGaming

×
RichGaming's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Mapper Has released one or more maps to the UGX-Mods community.
RichGaming's Contact & Social LinksRich_Gamingrichgaming1RichGamingRichGaming1
So within my map, I am using Bluntstuffy's Soul Chest. They all work perfectly until I get to the reward. For my map I have added a custom weapon as the soul chest reward and to add it I replaced all mentions of ray_gun in the _soul_chest.gsc as well as replaced the model name for the model that appears. The custom reward works perfectly and can be picked up once all soul chests are completed. The only issue is that when you pick up the reward, you cant get rid of it. If you hit the box or buy a wall weapon and try to replace that gun it wont work and will instead just give you an extra weapon. You can keep doing this with every single weapon and it won't replace it. You just keep getting more and more weapons. I have tried to look at the issue but knowing me, it is most likely an error on my behalf. I may be wrong but it appears that the issue may be caused by this section of the script (I have replaced the custom weapon name with "WEAPON" to keep it secret):

Spoiler: click to open...
Code Snippet
Plaintext
reward_trigger( )
{
player = undefined;

WEAPON = Spawn( "script_model", self.origin );
WEAPON.angles = (-30,0,-30);
WEAPON setmodel( "WEAPON_MODEL" );
self thread WEAPON_rotate( WEAPON );

playfxontag (level._effect["powerup_on"], WEAPON, "tag_origin");

self setCursorHint("HINT_NOICON");
self UseTriggerRequireLookAt();
self setHintString( "Press and hold &&1 to take your free Weapon." );

while(1)
{
self waittill( "trigger", player );
player.has_gun = false;
player.has_gun_upgr = false;

if( player.free_WEAPON == false)
{
player.free_WEAPON = true;
old_gun = player getcurrentweapon();

weaplist = player GetWeaponsListPrimaries();
for(i=0;i<weaplist.size;i++)
{
if( weaplist[i] == "WEAPON" )
{
player.has_gun = true;
}
else if ( weaplist[i] == "WEAPON_upgraded" )
{
player.has_gun_upgr = true;
}
}

if( player.has_gun == true )
{
player switchtoweapon( "WEAPON" );
player givemaxammo( "WEAPON" );
player playsound( "ammo_pickup" );
self notify( "took_gun" );
WEAPON delete();
self delete();
break;
}

else if( player.has_gun_upgr == true )
{
player switchtoweapon( "WEAPON_upgraded" );
player givemaxammo( "WEAPON_upgraded" );
player playsound( "ammo_pickup" );
self notify( "took_gun" );
WEAPON delete();
self delete();
break;
}

else if( weaplist.size <= 1 )
{
player giveweapon( "WEAPON" );
player switchtoweapon( "WEAPON" );
player playsound( "weap_pickup_plr" );
self notify( "took_gun" );
WEAPON delete();
self delete();
break;
}

else if( weaplist.size >= 2 )
{
player takeweapon( old_gun );
player giveweapon( "WEAPON" );
player switchtoweapon( "WEAPON" );
player playsound( "weap_pickup_plr" );
self notify( "took_gun" );
WEAPON delete();
self delete();
break;
}
}

else if( player.WEAPON == true )
{
iprintlnbold( "This one is not for you..!" );
}
wait 0.1;
}
}

If anyone can help to debug this issue then it would be greatly appreciated. I have tried to fix it but being the dumbass I am, I have had no luck. Thanks in advance. :D
Marked as best answer by RichGaming 10 years ago
broken avatar :(
×
broken avatar :(
OnionmanVere Bo21
Location: ieu dnt wnt 2 no
Date Registered: 27 September 2013
Last active: 4 months ago
Posts
1,863
Respect
Forum Rank
Zombie Destroyer
Primary Group
Mapper
My Groups
More
Personal Quote
ok
Signature
Aye mate you don't know me so y don't you shut tf up ok buddy :)

×
Scobalula's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Box Mappers Elite
Box Mappers Elite
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Scobalula's Contact & Social Links
So within my map, I am using Bluntstuffy's Soul Chest. They all work perfectly until I get to the reward. For my map I have added a custom weapon as the soul chest reward and to add it I replaced all mentions of ray_gun in the _soul_chest.gsc as well as replaced the model name for the model that appears. The custom reward works perfectly and can be picked up once all soul chests are completed. The only issue is that when you pick up the reward, you cant get rid of it. If you hit the box or buy a wall weapon and try to replace that gun it wont work and will instead just give you an extra weapon. You can keep doing this with every single weapon and it won't replace it. You just keep getting more and more weapons. I have tried to look at the issue but knowing me, it is most likely an error on my behalf. I may be wrong but it appears that the issue may be caused by this section of the script (I have replaced the custom weapon name with "WEAPON" to keep it secret):

Spoiler: click to open...
Code Snippet
Plaintext
reward_trigger( )
{
player = undefined;

WEAPON = Spawn( "script_model", self.origin );
WEAPON.angles = (-30,0,-30);
WEAPON setmodel( "WEAPON_MODEL" );
self thread WEAPON_rotate( WEAPON );

playfxontag (level._effect["powerup_on"], WEAPON, "tag_origin");

self setCursorHint("HINT_NOICON");
self UseTriggerRequireLookAt();
self setHintString( "Press and hold &&1 to take your free Weapon." );

while(1)
{
self waittill( "trigger", player );
player.has_gun = false;
player.has_gun_upgr = false;

if( player.free_WEAPON == false)
{
player.free_WEAPON = true;
old_gun = player getcurrentweapon();

weaplist = player GetWeaponsListPrimaries();
for(i=0;i<weaplist.size;i++)
{
if( weaplist[i] == "WEAPON" )
{
player.has_gun = true;
}
else if ( weaplist[i] == "WEAPON_upgraded" )
{
player.has_gun_upgr = true;
}
}

if( player.has_gun == true )
{
player switchtoweapon( "WEAPON" );
player givemaxammo( "WEAPON" );
player playsound( "ammo_pickup" );
self notify( "took_gun" );
WEAPON delete();
self delete();
break;
}

else if( player.has_gun_upgr == true )
{
player switchtoweapon( "WEAPON_upgraded" );
player givemaxammo( "WEAPON_upgraded" );
player playsound( "ammo_pickup" );
self notify( "took_gun" );
WEAPON delete();
self delete();
break;
}

else if( weaplist.size <= 1 )
{
player giveweapon( "WEAPON" );
player switchtoweapon( "WEAPON" );
player playsound( "weap_pickup_plr" );
self notify( "took_gun" );
WEAPON delete();
self delete();
break;
}

else if( weaplist.size >= 2 )
{
player takeweapon( old_gun );
player giveweapon( "WEAPON" );
player switchtoweapon( "WEAPON" );
player playsound( "weap_pickup_plr" );
self notify( "took_gun" );
WEAPON delete();
self delete();
break;
}
}

else if( player.WEAPON == true )
{
iprintlnbold( "This one is not for you..!" );
}
wait 0.1;
}
}

If anyone can help to debug this issue then it would be greatly appreciated. I have tried to fix it but being the dumbass I am, I have had no luck. Thanks in advance. :D

Are you using Harry's Perks? If so normal giveweapon won't work, you need to use his give weapon function.

Add this to the top of stuffy's soulchest gsc:

Code Snippet
Plaintext
#include maps\_harrybo21_utilities;

and Replace all of these:

Code Snippet
Plaintext
giveweapon(gun) //gun = your gun, so you can do for example find/replace giveweapon("raygun"), etc.

with this:

Code Snippet
Plaintext
harrybo21_give_gun( gun ) // same as above, when replacing replace gun with your weapon name (or variable that stores the weapon name)

If you're not then giveweapon should work.



Last Edit: March 05, 2016, 11:24:43 pm by Scobalula
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 9 November 2013
Last active: 5 years ago
Posts
502
Respect
Forum Rank
Zombie Enslaver
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Custom Zombies Videos: YouTube.com/RichGaming
×
RichGaming's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Mapper Has released one or more maps to the UGX-Mods community.
RichGaming's Contact & Social LinksRich_Gamingrichgaming1RichGamingRichGaming1
Are you using Harry's Perks? If so normal giveweapon won't work, you need to use his give weapon function.

Add this to the top of stuffy's soulchest gsc:

Code Snippet
Plaintext
#include maps\_harrybo21_utilities;

and Replace all of these:

Code Snippet
Plaintext
giveweapon(gun) //gun = your gun, so you can do for example find/replace giveweapon("raygun"), etc.

with this:

Code Snippet
Plaintext
harrybo21_give_gun( gun ) // same as above, when replacing replace gun with your weapon name (or variable that stores the weapon name)

If you're not then giveweapon should work.

Thanks! Will try it out and see if it works. Probably should have thought of this xD

Double Post Merge: March 06, 2016, 10:45:19 am
Thanks! Will try it out and see if it works. Probably should have thought of this xD

Edit: fixed, thanks for the help! :D
Last Edit: March 06, 2016, 11:04:22 am by RichGaming

 
Loading ...