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

Scripting perks into pre-existing maps

HOT
broken avatar :(
Created 9 years ago
by jiggy22
0 Members and 1 Guest are viewing this topic.
16,154 views
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
respect the dead

donates greatly appreciated :) paypal.me/F3ARxReaper666
discord server:
https://discord.gg/tsGHW99
×
death_reaper0's Groups
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.
they can work yes, you would have to spawn the ent that does all that stuff, my script isnt really set up for that however, which is why ts not happening
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
Yeah, I'll have to figure out how to set that up! So what I've been working on next is porting Amm-O-Matic into Der Riese, and I was planning on having it give the buyer a max ammo and the bandolier perk after they purchase it. Would I have to script these functions in the zombiemode_weapons gsc? Because this is DEFINITELY incorrect!

Code Snippet
Plaintext
ammomatic_init()
{
flag_wait( "all_players_connected" );
players = get_players();
for ( i = 0; i < players.size; i++ )
players[i] thread ammomatic();
}
ammomatic()
{
self endon("disconnect");
while(1)
{
if(self HasPerk("specialty_bulletdamage"))
{
self setClientDvar( "perk_bandolier", 1 );
self SetMoveSpeedScale( 1 );
}
else
{
self SetMoveSpeedScale( 1 );
self setClientDvar( "perk_bandolier", 0 );
}

wait .1;
}
}

You can see that I was previously using the Stamin-Up functions as a placeholder. That one was pretty easy to get working properly, but when it comes to these functions for Amm-O-Matic, I'm pretty lost!
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
Still looking for help with the Amm-O-Matic functions if anybody knows :)
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
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.
i did reply to this, dont know what happened to that, but i can help with the ammo-matic script, but i need to know:
does it affect all players or just the user
just active gun or all guns in the effected player has

Code Snippet
Plaintext
self setClientDvar( "perk_bandolier", 1 );
also i dont think that will do anything
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
i did reply to this, dont know what happened to that, but i can help with the ammo-matic script, but i need to know:
does it affect all players or just the user
just active gun or all guns in the effected player has

Code Snippet
Plaintext
self setClientDvar( "perk_bandolier", 1 );
also i dont think that will do anything

Yeah, the perk_bandolier was just a placeholder. So it would only affect the person buying it, and it would increase reserve ammo for all weapons that the user has. I was also thinking of having it give the buyer max ammo, but what I was trying to do, "self setClientDvar( "give ammo" )", obviously wasn't going to do anything. Thank you so much!
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
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.
Code Snippet
Plaintext

give_ammo()
{
primaryWeapons = self GetWeaponsList();
for( x = 0; x < primaryWeapons.size; x++ )
{
self GiveMaxAmmo( primaryWeapons[x] );
}
}


call this script on the player like this
Code Snippet
Plaintext
self thread give_ammo();
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
So I tried that, and nothing changed. Shouldn't there be something that mentions something like "if(self HasPerk( "specialty_bulletdamage" ); or something like that? This is what I have for the function BTW:

Code Snippet
Plaintext
ammomatic_init()
{
flag_wait( "all_players_connected" );
players = get_players();
for ( i = 0; i < players.size; i++ )
self thread give_ammo();
}
give_ammo()
{
primaryWeapons = self GetWeaponsList();
for( x = 0; x < primaryWeapons.size; x++ )
{
self GiveMaxAmmo( primaryWeapons[x] );
}
}
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
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.
thats not how its going to work, if you set it up like that with the hasperk thing its gonna do it constantly, making the player have permanent max ammo. ammo-matic isnt a propper perk, its just something to give ammo, shouldnt even need to be in the perks script

Code Snippet
Plaintext

ammomatic_init()
{
ammomatic = GetEntarray( "ammomatic", "targetname" );
for(i=0;i<ammomatic.size;i++)
ammomatic[i] thread ammomatic();
}

ammomatic()
{
cost = 10000;
self SetHintString( "Press & Hold &&1 For Ammo [Cost: " + cost + "]" );
self setCursorHint( "HINT_NOICON" );
self UseTriggerRequireLookAt();
while(1)
{
self waittill("trigger", player);
player thread give_ammo();
}
}

give_ammo()
{
primaryWeapons = self GetWeaponsList();
for( x = 0; x < primaryWeapons.size; x++ )
{
self GiveMaxAmmo( primaryWeapons[x] );
}
}

call this from somewhere in an init or main of any script, and in radiant make a trigger use with the targetname of ammomatic, you can have multiple
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
Yeah, but I'm not doing anything in Radiant since this is being ported into a mod of an already existing map.  Any way to add the bandolier function though, since that's what I'd prefer to have if the max ammo function isn't possible. Thanks again, I really appreciate the help as always!
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
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.
Yeah, but I'm not doing anything in Radiant since this is being ported into a mod of an already existing map.  Any way to add the bandolier function though, since that's what I'd prefer to have if the max ammo function isn't possible. Thanks again, I really appreciate the help as always!

just because its not in radiant doesnt mean its not possible, just needs to be done another way, as for bandolier, theres no actual way of increasing the players ammo, except increasing the clipsize, however that will only work for host, and it'll affect everyone.

Double Post Merge: February 06, 2017, 03:26:53 am
thats not how its going to work, if you set it up like that with the hasperk thing its gonna do it constantly, making the player have permanent max ammo. ammo-matic isnt a propper perk, its just something to give ammo, shouldnt even need to be in the perks script

Code Snippet
Plaintext

ammomatic_init()
{
ammomatic = GetEntarray( "ammomatic", "targetname" );
for(i=0;i<ammomatic.size;i++)
ammomatic[i] thread ammomatic();
}

ammomatic()
{
cost = 10000;
self SetHintString( "Press & Hold &&1 For Ammo [Cost: " + cost + "]" );
self setCursorHint( "HINT_NOICON" );
self UseTriggerRequireLookAt();
while(1)
{
self waittill("trigger", player);
player thread give_ammo();
}
}

give_ammo()
{
primaryWeapons = self GetWeaponsList();
for( x = 0; x < primaryWeapons.size; x++ )
{
self GiveMaxAmmo( primaryWeapons[x] );
}
}

call this from somewhere in an init or main of any script, and in radiant make a trigger use with the targetname of ammomatic, you can have multiple

do this like i said, bur also add this

Code Snippet
Plaintext
spawn_ammomatic(origin, angle)
{
gumball = Spawn( "script_origin", origin + (0 , 0, 50), 0, 60, 90 );
gumball.angles = angle;
gumball.targetname = "ammomatic";

machine = Spawn( "script_model", origin );
machine.angles = angle;
machine setModel( "AMMOMATIC_MODEL_NAME" );
machine thread maps\_zombiemode_perks::perk_fx( "doubletap_light" );
}

and change

Code Snippet
Plaintext
ammomatic()
{
cost = 10000;
self SetHintString( "Press & Hold &&1 For Ammo [Cost: " + cost + "]" );
self setCursorHint( "HINT_NOICON" );
self UseTriggerRequireLookAt();
while(1)
{
self waittill("trigger", player);
player thread give_ammo();
}
}

to

Code Snippet
Plaintext

ammomatic()
{
cost = 10000;
self SetHintString( "Press & Hold &&1 For Ammo [Cost: " + cost + "]" );
self setCursorHint( "HINT_NOICON" );
self UseTriggerRequireLookAt();
while(1)
{
self waittill("trigger", player);
if(player.score >= cost && player usebuttonpressed())
{
player maps\_zombiemode_score::minus_to_player_score( cost );
player thread give_ammo();
}
}
}

(i also forgot to check the price, derp :P )

Double Post Merge: February 06, 2017, 03:28:16 am
oh i forgot, this should be in the mapname and you should call

Code Snippet
Plaintext
level thread spawn_ammomatic(origin, angle);

with your perk spawning stuff
Last Edit: February 06, 2017, 03:28:16 am by death_reaper0
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
Thanks again for the help. I'm really just planning on having Amm-O-Matic as an actual perk, so I'm now thinking of just changing the functions of it entirely. Maybe something like the Blood Bullets perk where a bullet regenerates every 10 seconds? I'm looking at the perk functions for Blood Bullets in your perks gsc in your fortress mod, and it's looking something like this:

Code Snippet
Plaintext
blood()
{
flag_wait( "all_players_connected" );
players = get_players();
for ( i = 0; i < players.size; i++ )
players[i] blood_bullets();
}

blood_bullets()
{
while(1)
{
if(self hasperk("specialty_specialgrenade"))
{
weapon = self GetCurrentWeapon();
if(weapon == "rayzorback_waff" ||
 weapon == "rayzorback_upgraded_waff" ||
 weapon == "rayzorback" ||
 weapon == "rayzorback_upgraded"
 )
{}//do nothing
else
{
current = self GetWeaponAmmoStock( weapon );
clip = WeaponClipSize( weapon );
clip_add = int( clip / 10 );
if (clip_add < 1)
clip_add = 1;
self SetWeaponAmmoStock( weapon, current + clip_add );
wait int(clip_add/2);
}
}
wait 2;
}
}

So to get it to work for my Amm-O-Matic perk, can I just change it to:

Code Snippet
Plaintext
ammomatic_init()
{
flag_wait( "all_players_connected" );
players = get_players();
for ( i = 0; i < players.size; i++ )
players[i] ammomatic();
}

ammomatic()
{
while(1)
{
if(self hasperk("specialty_bulletdamage"))
{
weapon = self GetCurrentWeapon();
if(weapon == "bazooka" ||
 weapon == "bazooka_upgraded" ||
 weapon == "tesla_gun" ||
 weapon == "tesla_gun_upgraded" ||
 weapon == "bo2_colt_upgraded" ||
 weapon == "m7_launcher_zombie" ||
 weapon == "m7_launcher_zombie_upgraded" ||
 weapon == "panzerschreck" ||
 weapon == "panzerschreck_upgraded"
 )
{}//do nothing
else
{
current = self GetWeaponAmmoStock( weapon );
clip = WeaponClipSize( weapon );
clip_add = int( clip / 10 );
if (clip_add < 1)
clip_add = 1;
self SetWeaponAmmoStock( weapon, current + clip_add );
wait int(clip_add/2);
}
}
wait 2;
}
}

Or would that require more additional scripting? BTW, who was the original creator of Blood Bullets? Because I'd definitely have to give them credit for the functions. Thanks!
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
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.
you really should not take someones script without permission  :-\
blood bullets is my creation (although i think zct was the original to have a bullet regen perk, not sure)
Last Edit: February 06, 2017, 07:09:28 am by death_reaper0
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
Crap, I'm really sorry about that! :(  I'm currently thinking of some other function to give it at the moment, so I think I'm just gonna leave Amm-O-Matic be for the time being.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2016
Last active: 5 months ago
Posts
229
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
My Contact & Social Links
More
×
jiggy22's Groups
jiggy22's Contact & Social Linksjiggy22archdukesquidlylll
Okay, so how about this. After buying the perk, every kill you get regenerates one bullet in your current gun. Is that do-able? Thanks :)
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 5 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
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.
Okay, so how about this. After buying the perk, every kill you get regenerates one bullet in your current gun. Is that do-able? Thanks :)

Code Snippet
Plaintext

ammomatic_init()
{
flag_wait( "all_players_connected" );
players = get_players();
for ( i = 0; i < players.size; i++ )
players[i] ammomatic();
}

ammomatic()
{
while(1)
{
self waittill("zom_kill");
if(self hasperk("specialty_specialgrenade"))
{
weapon = self GetCurrentWeapon();
current = self GetWeaponAmmoStock( weapon );
self SetWeaponAmmoStock( weapon, current + 1 );
}
}
}


 
Loading ...