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

buy maximum ammo

broken avatar :(
Created 5 months ago
by Дмитрий78
0 Members and 1 Guest are viewing this topic.
1,738 views
broken avatar :(
×
broken avatar :(
Location: ru
Date Registered: 19 March 2021
Last active: 2 months ago
Posts
30
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
https://www.ugx-mods.com/forum/scripting/87/how-to-add-buyable-max-ammo/13279/msg140567#msg140567I followed his guide and the same error was caused by 'zm_score::minus_to_player_score' and I tried.I wrote #using scripts\zm\_zm_score; and at the end of gsc files mapname and at the beginning, but because of this an error occurred, what's wrong?help please
Last Edit: November 18, 2023, 03:30:44 am by Дмитрий78
Marked as best answer by Дмитрий78 5 months ago
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 16 April 2022
Last active: 6 days ago
Posts
11
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
ReubenUKGB's Groups
ReubenUKGB's Contact & Social Links
You don't need to include anything extra in your GSC file to deduct points, assuming the rest of your code works (buyable max ammo function) try the following instead:
Code Snippet
Plaintext
player maps\_zombiemode_score::minus_to_player_score(trigger1cost);

Make sure you also have the following at the top of your GSC file:
Code Snippet
Plaintext
#include common_scripts\utility;
#include maps\_utility;
#include maps\_zombiemode_utility;

If that doesn't work because of the structure of your mod, use the Tom FastFile Extractor to get a copy of _zombiemode_score.gsc from common_zombie_patch.ff and use that GSC file in your mod, the same way you'd use others.
Last Edit: December 03, 2023, 09:33:26 pm by ReubenUKGB
broken avatar :(
×
broken avatar :(
Location: ru
Date Registered: 19 March 2021
Last active: 2 months ago
Posts
30
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
 
 

Double Post Merge: December 06, 2023, 10:24:19 am

You don't need to include anything extra in your GSC file to deduct points, assuming the rest of your code works (buyable max ammo function) try the following instead:
Code Snippet
Plaintext
player maps\_zombiemode_score::minus_to_player_score(trigger1cost);

Make sure you also have the following at the top of your GSC file:
Code Snippet
Plaintext
#include common_scripts\utility;
#include maps\_utility;
#include maps\_zombiemode_utility;

If that doesn't work because of the structure of your mod, use the Tom FastFile Extractor to get a copy of _zombiemode_score.gsc from common_zombie_patch.ff and use that GSC file in your mod, the same way you'd use others.

thank you very much!it works, I replaced the line with the one you wrote,(player cards \ _zombie mode_score::minus_to_player_score (trigger1cost);)
I'll even record a video guide for buying the maximum amount of ammunition for the BO1
but how do I made that there is some kind of sound when buying?I buy ammunition, but at this time there is no sound, silence
Last Edit: December 06, 2023, 10:33:43 am by Дмитрий78
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 16 April 2022
Last active: 6 days ago
Posts
11
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
ReubenUKGB's Groups
ReubenUKGB's Contact & Social Links


 

Double Post Merge: December 06, 2023, 10:24:19 am


thank you very much!it works, I replaced the line with the one you wrote,(player cards \ _zombie mode_score::minus_to_player_score (trigger1cost);)
I'll even record a video guide for buying the maximum amount of ammunition for the BO1
but how do I made that there is some kind of sound when buying?I buy ammunition, but at this time there is no sound, silence

You can add the following to introduce sound to your buy function:
Code Snippet
Plaintext
if (player.score >= trigger1cost)
{
    player maps\_zombiemode_score::minus_to_player_score(trigger1cost);
    play_sound_at_pos("purchase", self.origin);
}
else
{
    play_sound_at_pos("no_purchase", self.origin);
}
This plays predone sounds in the game's soundalias at the position of self.origin, exactly the way Treyarch does it if you look at their source files, you can customise which origin it plays at but in this code it plays from self's origin. You can also customise the sound that's played by editing your own soundalias in your mod, using purchase and no_purchase as a base and replacing it with something else (make sure to edit the custom sound to work in-engine if you go this route).
Last Edit: December 06, 2023, 03:01:47 pm by ReubenUKGB
broken avatar :(
×
broken avatar :(
Location: ru
Date Registered: 19 March 2021
Last active: 2 months ago
Posts
30
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
 
 
I added this code, or rather replaced it, but it resulted in bad syntax

​​
You can add the following to introduce sound to your buy function:
Code Snippet
Plaintext
if (player.score >= trigger1cost)
{
    player maps\_zombiemode_score::minus_to_player_score(trigger1cost);
    play_sound_at_pos("purchase", self.origin);
}
else
{
    play_sound_at_pos("no_purchase", self.origin);
}
This plays predone sounds in the game's soundalias at the position of self.origin, exactly the way Treyarch does it if you look at their source files, you can customise which origin it plays at but in this code it plays from self's origin. You can also customise the sound that's played by editing your own soundalias in your mod, using purchase and no_purchase as a base and replacing it with something else (make sure to edit the custom sound to work in-engine if you go this route).
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 16 April 2022
Last active: 6 days ago
Posts
11
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
ReubenUKGB's Groups
ReubenUKGB's Contact & Social Links


 
I added this code, or rather replaced it, but it resulted in bad syntax(Image removed from quote.)
 

That was example code, please only replace your trigger PlayLocalSound lines with:
Code Snippet
Plaintext
play_sound_at_pos("my_soundalias_name_i_want_to_use", trigger.origin);

Have a look at Treyarch's source files for more info, you might be missing some things, you could also use:
Code Snippet
Plaintext
playsoundatposition("my_soundalias_name_i_want_to_use", trigger.origin);

or:
Code Snippet
Plaintext
trigger play_sound_on_ent("my_soundalias_name_i_want_to_use");

or:
Code Snippet
Plaintext
trigger PlaySound("my_soundalias_name_i_want_to_use");

Assuming the soundalias name is valid, such as purchase and no_purchase.
Last Edit: December 06, 2023, 04:25:41 pm by ReubenUKGB
broken avatar :(
×
broken avatar :(
Location: ru
Date Registered: 19 March 2021
Last active: 2 months ago
Posts
30
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
​​
That was example code, please only replace your trigger PlayLocalSound lines with:
Code Snippet
Plaintext
play_sound_at_pos("my_soundalias_name_i_want_to_use", trigger.origin);

Have a look at Treyarch's source files for more info, you might be missing some things, you could also use:
Code Snippet
Plaintext
playsoundatposition("my_soundalias_name_i_want_to_use", trigger.origin);

or:
Code Snippet
Plaintext
trigger play_sound_on_ent("my_soundalias_name_i_want_to_use");

or:
Code Snippet
Plaintext
trigger PlaySound("my_soundalias_name_i_want_to_use");

Assuming the soundalias name is valid, such as purchase and no_purchase.
I don't understand, where should I look?you're talking about Treyarch, which Treyarch source files are you talking about?
 

Double Post Merge: December 06, 2023, 05:04:11 pm


​​
That was example code, please only replace your trigger PlayLocalSound lines with:
Code Snippet
Plaintext
play_sound_at_pos("my_soundalias_name_i_want_to_use", trigger.origin);

Have a look at Treyarch's source files for more info, you might be missing some things, you could also use:
Code Snippet
Plaintext
playsoundatposition("my_soundalias_name_i_want_to_use", trigger.origin);

or:
Code Snippet
Plaintext
trigger play_sound_on_ent("my_soundalias_name_i_want_to_use");

or:
Code Snippet
Plaintext
trigger PlaySound("my_soundalias_name_i_want_to_use");

Assuming the soundalias name is valid, such as purchase and no_purchase.
that's it, I did it, I added two lines-play_sound_at_pos( "purchase", player.origin ); and play_sound_at_pos( "no_purchase", player.origin );
I don't understand what the treyarch source files had to do with it
 
 
Last Edit: December 06, 2023, 05:50:22 pm by Дмитрий78
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 16 April 2022
Last active: 6 days ago
Posts
11
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
ReubenUKGB's Groups
ReubenUKGB's Contact & Social Links
I don't understand, where should I look?you're talking about Treyarch, which Treyarch source files are you talking about?
 

Double Post Merge: December 06, 2023, 05:04:11 pm

that's it, I did it, I added two lines-play_sound_at_pos( "purchase", player.origin ); and play_sound_at_pos( "no_purchase", player.origin );
I don't understand what the treyarch source files had to do with it
I was suggesting to have a look at the default .gsc files for reference.
 
I wouldn't play the sound on the player, I'd play the sound on the entity being interacted with, so in this case it would be trigger.origin.

 
Loading ...