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

Give player gun trigger

HOT
broken avatar :(
Created 10 years ago
by pashan
0 Members and 1 Guest are viewing this topic.
4,862 views
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
I am a bit new to coding but i added a new line (because i want it to be a hidden easter egg)

Code Snippet
Plaintext
gun_give_trig()
{
trigger = getent("gun_trig", "targetname");
trigger sethintstring("");
trigger setCursorHint( "HINT_NOICON" );

players = get_players();
trigger waittill("trigger", players);
current_weapon = players getCurrentWeapon();

if(isdefined(current_weapon) )
{
players TakeWeapon( current_weapon );
}

players GiveWeapon( "ray_gun" );
players SwitchToWeapon( "ray_gun" );
trigger delete();
}

Post Merge: March 28, 2014, 05:42:03 pm
The player would always have 2 weapons:

you start out with colt = 1 weapon

the player then buys a second weapon because the colt sucks = 2 weapons

then the player will get the ray gun which will replace his current weapon he is holding  = 2 weapons

do you get what i am trying to say.

and also the trigger is in the 3rd room and the player wouldn't be able to get their with only the colt.

- Pashan
anyways the code leaves option for leaving a player qith 1 weap. so the code might work for you but, in a more open environment the code must be as i said....also you didnt mentioned your map set up so one makes code which works in every stage not just your map.
besides the    
Code Snippet
Plaintext
if(isdefined(current_weapon) )
{
players TakeWeapon( current_weapon );
}

if statement was completly useless and the players = get_players(); was just there for "yolo" reasons lol
Last Edit: March 29, 2014, 12:13:43 am by jjbradman
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 10 October 2013
Last active: 4 months ago
Posts
541
Respect
Forum Rank
Zombie Enslaver
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
ProGamerzFTW's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
If you don't want your weapon replaced when having a single gun like jj had earlier.

Untested.

Code Snippet
Plaintext
gun_give_trig()
{
trigger = getent("gun_trig", "targetname");
trigger sethintstring("");
trigger setCursorHint( "HINT_NOICON" );

trigger waittill("trigger", players);
current_weapon = players getCurrentWeapon();
weapon_list = players GetWeaponsListPrimaries();

if(isdefined(current_weapon) && weapon_list.size > 1)
{
players TakeWeapon( current_weapon );
}

players GiveWeapon( "ray_gun" );
players SwitchToWeapon( "ray_gun" );
trigger delete();
}
Last Edit: March 29, 2014, 09:21:00 am by ProGamerzFTW
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 11 July 2014
Last active: 10 years ago
Posts
3
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
My Contact & Social Links
More
×
SadBoyPro's Groups
SadBoyPro's Contact & Social Linkshttps://www.youtube.com/c
Hey guys this may have been answered here but i am a bit new so here's with the question.

Am I right in thinking this will allow one to only let a specific player activate the trigger?

The reason I ask is that I am looking for some help in creating a piece of code which says that;

If player = "player name" trigger = false

so essentially the play cannot purchase the gun unless the player name is one i have defined.
broken avatar :(
×
broken avatar :(
The Voice in your Eyes
Location: deBavaria
Date Registered: 26 June 2013
Last active: 2 years ago
Posts
830
Respect
Forum Rank
The Decider
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Breton boys do what Breton boys do.
×
Alerion's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Please create a new topic next time where you say which topic you are referring to.
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 11 July 2014
Last active: 10 years ago
Posts
3
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
My Contact & Social Links
More
×
SadBoyPro's Groups
SadBoyPro's Contact & Social Linkshttps://www.youtube.com/c
Oh I have  :) I was just inquiring in this thread to get clarification that the code that was posted performed that function. I'm clearly new and don't quite understand it hence my question was directed actually at this post :)
broken avatar :(
×
broken avatar :(
Location: usSD
Date Registered: 30 May 2013
Last active: 2 years ago
Posts
44
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
epicduck97's Groups
epicduck97's Contact & Social Links
quick question, which script can we add the code to? I've done this stuff in non UGX maps, and they go in youmapname.gsc in root raw map folder. With ugx we dont have that, in that folder.. We have it in yourmapname.iwd in the root mods folder. I've tried it there and it doesnt work. The ugx install wiki says to put code "within ugx_mod.iwd and ugxm_guns.iwd" I did it in zombiemode.gsc, in ugx_mod.iwd, and It didnt work.. Where can I put it? sorry im a noob lol
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 14 October 2013
Last active: 4 years ago
Posts
2
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
djobdam's Groups
djobdam's Contact & Social Links
one question, if u want to get the raygun without pressing a trigger what kind of code do I need?

Double Post Merge: September 06, 2014, 07:39:40 pm
I've got this script

Code Snippet
Plaintext
//Secret_Easter_Egg
Secret_trigger_1()
{
   trig1 = getEnt("secret_trigger","targetname");
   trig1 waittill("trigger", player );
   trig1 delete();
   trig1 SetCursorHint( "HINT_NOICON" );
   
self.secret_trigger_num = self.secret_trigger_num + 1;

thread secret_weapon();
}

secret_trigger_2()
{
   trig2 = getEnt("secret_trigger2","targetname");
   trig2 waittill("trigger", player );
   trig2 delete();
   trig2 SetCursorHint( "HINT_NOICON" );

self.secret_trigger_num = self.secret_trigger_num + 1;

thread secret_weapon();
}

secret_trigger_3()
{
   trig3 = getEnt("secret_trigger3","targetname");
   trig3 waittill("trigger", player );
   trig3 delete();
   trig3 SetCursorHint( "HINT_NOICON" );

self.secret_trigger_num = self.secret_trigger_num + 1;

secret_weapon()
{
door = getEnt("secret_door","targetname");
if(self.secret_trigger_num == 2)
{
door movez(-500, 25);
wait 8;
door delete();
}
}

and instead of a door that opens I want to get a gun, how do I do that?
Last Edit: September 06, 2014, 07:39:40 pm by djobdam

 
Loading ...