AI Weapons Trading!

broken avatar :(
Created 557 days ago
by
0 Members and 1 Guest are viewing this topic.
1,205 views
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
User
Date Registered: N/A
Last active: N/A
Posts
N/A
Respect
Primary Group
Deleted Member
×
DeletedUser's Groups
DeletedUser's Contact & Social Links
Are there any scripts i could use that allow the player to trade weapons with AI Soldiers?

The only maps ive seen that allow weapon trading with AI is in UGX Cabin and AITest by nameless

If anyone has a script i could use, i would credit you in my map and would appreciate it!
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 49 days ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
Signature
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
These functions will handle the weapon swap but you will need to do extra stuff to ensure that the player is actually trying to swap weapons with the AI

/*
Sets the Ai's primary weapon to the weapon passed
<Required>: player- a player to swap weapons with the AI
<Required>: AI- an AI that will swap weapons with the Player
*/
doWeaponSwap( player, AI)
{
//save the weapons
AINewWeapon = player GetCurrentWeapon();
PlayerNewWeapon = ai.weapon;

//perform the swap
setAiWeapon(AINewWeapon);
swapPlayerCurrentWeapon(PlayerNewWeapon);
}

/*
Sets the Ai's primary weapon to the weapon passed
<Required>: self- an AI
<Required>: weapon - string representing the weapon that will be given to the Ai
*/
setAiWeapon( weapon )
{

self.primaryweapon = weapon;
self animscripts\init::initWeapon( weapon, "primary" );
self gun_switchto( weapon, "right" );
}


/*
Sets the player's primary weapon to the weapon passed
<Required>: self- a player
<Required>: weapon - string representing the weapon that will be given to the player
*/
swapPlayerCurrentWeapon(weapon)
{

oldWeapon = self GetCurrentWeapon();
self TakeWeapon(oldWeapon);
self GiveWeapon(weapon);
self SwitchToWeapon(weapon);
}


NOTE: I haven't tested this but it should work properly.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 66 days ago
Posts
6,879
Respect
Forum Rank
Immortal
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social Links[email protected]HarryBo21HarryBo000
Not tracking ammo so this will create a glitch that always refills your gun

Not checking if the gun swapping is the gun he has already

If using my perks that will breakvthe inventory
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
User
Date Registered: N/A
Last active: N/A
Posts
N/A
Respect
Primary Group
Deleted Member
×
DeletedUser's Groups
DeletedUser's Contact & Social Links
Not tracking ammo so this will create a glitch that always refills your gun

Not checking if the gun swapping is the gun he has already

If using my perks that will breakvthe inventory
Oh im not using your perks..i was but i changed my mind...im not gonna be adding perks to my map

Also im fine with the refilling ammo on guns glitch


Double Post Merge: May 07, 2018, 07:29:05 pm
These functions will handle the weapon swap but you will need to do extra stuff to ensure that the player is actually trying to swap weapons with the AI

/*
Sets the Ai's primary weapon to the weapon passed
<Required>: player- a player to swap weapons with the AI
<Required>: AI- an AI that will swap weapons with the Player
*/
doWeaponSwap( player, AI)
{
//save the weapons
AINewWeapon = player GetCurrentWeapon();
PlayerNewWeapon = ai.weapon;

//perform the swap
setAiWeapon(AINewWeapon);
swapPlayerCurrentWeapon(PlayerNewWeapon);
}

/*
Sets the Ai's primary weapon to the weapon passed
<Required>: self- an AI
<Required>: weapon - string representing the weapon that will be given to the Ai
*/
setAiWeapon( weapon )
{

self.primaryweapon = weapon;
self animscripts\init::initWeapon( weapon, "primary" );
self gun_switchto( weapon, "right" );
}


/*
Sets the player's primary weapon to the weapon passed
<Required>: self- a player
<Required>: weapon - string representing the weapon that will be given to the player
*/
swapPlayerCurrentWeapon(weapon)
{

oldWeapon = self GetCurrentWeapon();
self TakeWeapon(oldWeapon);
self GiveWeapon(weapon);
self SwitchToWeapon(weapon);
}


NOTE: I haven't tested this but it should work properly.
I am so lost on how to set this up Lmao. I'm not an expert on scripting
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 49 days ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
Not tracking ammo so this will create a glitch that always refills your gun

Not checking if the gun swapping is the gun he has already

If using my perks that will breakvthe inventory

The point was to give him the idea of how to do it, not write it line by line for him. There's a lot that it doesn't account for that it needs be checking.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 66 days ago
Posts
6,879
Respect
Forum Rank
Immortal
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social Links[email protected]HarryBo21HarryBo000
The point was to give him the idea of how to do it, not write it line by line for him. There's a lot that it doesn't account for that it needs be checking.
and my “point” was highlighting what’s not handled for him

Problem?
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
User
Date Registered: N/A
Last active: N/A
Posts
N/A
Respect
Primary Group
Deleted Member
×
DeletedUser's Groups
DeletedUser's Contact & Social Links
and my “point” was highlighting what’s not handled for him

Problem?
Ok first of all...can we not argue...2nd of all...why cant i get a working script that someone can teach how to do it? I mean this is a help forum after so why are you just giving me scripts that i have no idea what to do with?
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 66 days ago
Posts
6,879
Respect
Forum Rank
Immortal
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social Links[email protected]HarryBo21HarryBo000
yes how dare you provide him with "most" of the answer and not just do the entire thing "for him"

how dare you
broken avatar :(
  • DeletedUser
  • Deleted Member
×
broken avatar :(
DeletedUser
User
Date Registered: N/A
Last active: N/A
Posts
N/A
Respect
Primary Group
Deleted Member
×
DeletedUser's Groups
DeletedUser's Contact & Social Links
yes how dare you provide him with "most" of the answer and not just do the entire thing "for him"

how dare you
Ok...thats not what i meant...I don't need you're sarcasm. I can't making fucking scripts because i have no idea how to do so...and most importantly set the scripts up. All im asking is how to properly set it up so then i know how to do it in the future.
broken avatar :(
×
broken avatar :(
Location: 00MIA - Last seen at [REDACTED].
Date Registered: 10 February 2018
Last active: 190 days ago
Posts
87
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Eating Doritos and making maps. LEAVE ME ALONE!
Signature
From how you all blew something so small up, I can tell that you all are libtards.  Just worthless fucking libtards.
You went full retard man... never go full retard. :derp:
×
TGMKTheII's Groups
TGMKTheII's Contact & Social Linkshttps://steamcommunity.co
Lets not start arguing back and forth like children. Thanks.

 

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 Twitch
Loading ...