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

Swap suits in your map [Added v1.2 and a poll]

POLLHOT
broken avatar :(
Created 8 years ago
by MakeCents
0 Members and 1 Guest are viewing this topic.
13,722 views

Poll

Question: Which way is easier to understand how to add suits in script, the first way, or v1.1

The first way was easier
0 (0%)
v1.1 is easier
1 (100%)
They are the same really
0 (0%)

Total Members Voted: 1

broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
SWAP SUITS
script and prefabs, no models

This script allows you to add suits/player models you can grab off the wall, and take them off or swap them around. This does not come with models, or go over how to get viewmodels, or other models into your map, or how to rig player models. The body model used must be rigged for the player. The script has options to set view models and alternative huds per suit.

Included is instructions, script, and 4 different suit prefabs, with the player zombie models used as placeholders.


If you want to give a suit a feature, you can check player.suit var for the suit the player has on. For example, before doing damage to the player, add if(player.suit!="suit0") .... meaning this would only continue if they didn't have that suit on. Hit me up with any questions.


v1.1 - added functions for each suit
v1.2 - added a function for taking off suits, for normal suit
added character files you may need to use this script when setting model back to normal and taking off the suit. If you use different models than the default ones, make sure you edit them per character.
Last Edit: July 18, 2016, 03:55:26 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: kp
Date Registered: 29 July 2015
Last active: 5 years ago
Posts
435
Respect
Forum Rank
Perk Hacker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
children should not be playing call of duty
Signature
⠀⠀⠀⣴⣴⡤
⠀⣠⠀⢿⠇⡇⠀⠀⠀⠀⠀⠀⠀⢰⢷⡗
⠀⢶⢽⠿⣗⠀⠀⠀⠀⠀⠀⠀⠀⣼⡧⠂⠀⠀⣼⣷⡆
⠀⠀⣾⢶⠐⣱⠀⠀⠀⠀⠀⣤⣜⣻⣧⣲⣦⠤⣧⣿⠶
⠀⢀⣿⣿⣇⠀⠀⠀⠀⠀⠀⠛⠿⣿⣿⣷⣤⣄⡹⣿⣷
⠀⢸⣿⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⢿⣿⣿⣿⣿⣿
⠀⠿⠃⠈⠿⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⠿⠿⠿

⠀⢀⢀⡀⠀⢀⣤⠀⠀⠀⠀⠀⠀⠀⡀⡀
⠀⣿⡟⡇⠀⠭⡋⠅⠀⠀⠀⠀⠀⢰⣟⢿
⠀⣹⡌⠀⠀⣨⣾⣷⣄⠀⠀⠀⠀⢈⠔⠌
⠰⣷⣿⡀⢐⢿⣿⣿⢻⠀⠀⠀⢠⣿⡿⡤⣴⠄⢀⣀⡀
⠘⣿⣿⠂⠈⢸⣿⣿⣸⠀⠀⠀⢘⣿⣿⣀⡠⣠⣺⣿⣷
⠀⣿⣿⡆⠀⢸⣿⣿⣾⡇⠀⣿⣿⣿⣿⣿⣗⣻⡻⠿⠁
⠀⣿⣿⡇⠀⢸⣿⣿⡇⠀⠀⠉⠉⠉⠉⠉⠉⠁
×
Koan's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Oil Rig Beta Access
Oil Rig Beta Access
Koan's Contact & Social Linksh-r_Koan_my website
I didn't know I wanted this, but I do. Fantastic stuff, +1.  :D
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
I didn't know I wanted this, but I do. Fantastic stuff, +1.  :D

Cool. I'd love to see someone do a mech machine. I really wanted one in orbit for the center part.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 4 years ago
Posts
6,877
Respect
1,004Add +1
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
Another cool script man

It's nice your sharing the cool stuff from orbit :)
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Another cool script man

It's nice your sharing the cool stuff from orbit :)

Thanks

Well, I'm making a mod maybe, so I've been cleaning up and taking the "orbit" out of these scripts, so to speak. Everything will be shared when/if I release the mod, so I figured I would share them in the mean time, and fix any bugs that may get reported, and maybe someone would have new ideas, that I could make easier to incorporate then. Win win.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 4 years ago
Posts
6,877
Respect
1,004Add +1
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
Pretty much what I was doing with the bo2 thing till all my animated shit decided to break lol

Might have to pester you about that one day
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
I envy your ability to script so well. I could see myself doing something cool with a hazmat suit and a hud for an EE. Excellent work! +1

Lol, thank you sir. I already have like 3 or more ideas on how to improve this script with added vars to the arrays for functions to run after switching suits, and a few more isolated functions, and a better suit/viewarm showing function and ... lol.

I look forward to seeing what custom things you create with it!
Last Edit: June 24, 2016, 02:34:14 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 17 September 2014
Last active: 2 years ago
Posts
167
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
W.I.P Rise & Fall
×
Krazzyboy97's Groups
Krazzyboy97's Contact & Social Links76561198105783700Krazzyboyxxkrazzyboy97xx
SWAP SUITS
script and prefabs, no models

This script allows you to add suits/player models you can grab off the wall, and take them off or swap them around. This does not come with models, or go over how to get viewmodels, or other models into your map, or how to rig player models. The body model used must be rigged for the player. The script has options to set view models and alternative huds per suit.

Included is instructions, script, and 4 different suit prefabs, with the player zombie models used as placeholders.


If you want to give a suit a feature, you can check player.suit var for the suit the player has on. For example, before doing damage to the player, add if(player.suit!="suit0") .... meaning this would only continue if they didn't have that suit on. Hit me up with any questions.

I keep getting a bad syntax error when I says what view hands and model I want  It doesnt like the that line of code but I could be doing something wrong
broken avatar :(
×
broken avatar :(
OnionmanVere Bo21
Location: ieu dnt wnt 2 no
Date Registered: 27 September 2013
Last active: 1 year ago
Posts
1,864
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community 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
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
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
I keep getting a bad syntax error when I says what view hands and model I want  It doesnt like the that line of code but I could be doing something wrong

Can you show your modifications and the error?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
I keep getting a bad syntax error when I says what view hands and model I want  It doesnt like the that line of code but I could be doing something wrong

What Scobalula said.

And I can also send you a new script if you want, where I modified how you setup the viewmodels and hud, which may be easier. Now its just one line per type of suit instead of multiple, and I added functions that get called when you put the suit on, and tweaked some things.
Last Edit: June 27, 2016, 01:48:45 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 17 September 2014
Last active: 2 years ago
Posts
167
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
W.I.P Rise & Fall
×
Krazzyboy97's Groups
Krazzyboy97's Contact & Social Links76561198105783700Krazzyboyxxkrazzyboy97xx
What Scobalula said.

And I can also send you a new script if you want, where I modified how you setup the viewmodels and hud, which may be easier. Now its just one line per type of suit instead of multiple, and I added functions that get called when you put the suit on, and tweaked some things.

Okay just send me the newer version as its probably better to use that version :)
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Okay just send me the newer version as its probably better to use that version :)

Alright, I should be able to tonight. Its probably a simple fix though if you just post what you added in the script or maybe how its being called or something like that. Syntax errors are pretty easy. And the new script doesn't work any differently really, just listing vars horizontally in a call to a function instead of vertically populated the array.
Last Edit: June 28, 2016, 04:00:01 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 17 September 2014
Last active: 2 years ago
Posts
167
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
W.I.P Rise & Fall
×
Krazzyboy97's Groups
Krazzyboy97's Contact & Social Links76561198105783700Krazzyboyxxkrazzyboy97xx
Alright, I should be able to tonight. Its probably a simple fix though if you just post what you added in the script or maybe how its being called or something like that. Syntax errors are pretty easy. And the new script doesn't work any differently really, just listing vars horizontally in a call to a function instead of vertically populated the array.

Its in the spoiler :)
Spoiler: click to open...
init(){
   level.switchsuitsweapon = undefined;//"zombie_melee";//make undefined if no switching wanted
   suits = getentarray("suit", "targetname");
   level.suits = [];
   level.suits["normal"] = [];
   level.suits["normal"]["viewarms"] = "viewmodel_usa_marine_arms";
   level.suits["normal"]["hud"] = undefined;

   //1st suit
   *level.suits["suit0"]=[];
   *level.suits["suit0"]["viewarms"] = "viewmodel_zom_pressure_suit_arms"
   *level.suits["suit0"]["hud"] = undefined;//The shader for this suit

   //2nd suit
   level.suits["suit1"]=[];
   level.suits["suit1"]["viewarms"] = "viewmodel_zom_pressure_suit_arms"
   level.suits["suit1"]["hud"] = undefined;

   //3rd suit
   level.suits["suit2"]=[];
   level.suits["suit2"]["viewarms"] = "viewmodel_zom_pressure_suit_arms"
   level.suits["suit2"]["hud"] = undefined;//The shader for this suit

   //4th suit
   level.suits["suit3"]=[];
   level.suits["suit3"]["viewarms"] = "viewmodel_zom_pressure_suit_arms"
   level.suits["suit3"]["hud"] = undefined;
   
   //add more suits if you like:

   array_thread( suits,::PickMeUp );
}

PickMeUp(){
   self.active = 1;
   self SetCursorHint( "HINT_NOICON" );
   while(1){
      self FixTrigger();

      self waittill("trigger", player);
      if(!isdefined(player.suit)){
         player.suit = "normal";
      }
      player PlayLocalSound( "deny" );
      if(player.suit =="normal" & self.script_noteworthy=="normal") continue;
      
      player notify("suit_change");
      
      player PutOnSuit(self);
      pieces = getentarray(self.target, "targetname");
      for(i=0;i<pieces.size;i++){
         pieces thread RackSuit(player, player.suit);
      }   
      suit = player.suit;
      player.suit = self.script_noteworthy;
      self.script_noteworthy = suit;
      wait(.01);
   }
}
FixTrigger(){
   self sethintstring("");
   wait(2);
   if(self.script_noteworthy == "normal"){
      self sethintstring("Press &&1 to rack suit.");
   }else{
      self sethintstring("Press &&1 to take Suit.");
   }
}
RackSuit(player, suit){

   if(self.script_noteworthy=="head"){
      
      if(player.rackhead!=player.currenthead & player.headModel!=player.rackhead) player detach(player.rackhead);
      self setmodel(player.rackhead);
   }
   if(self.script_noteworthy=="body"){
      self setmodel(player.rackbody);
   }
   level notify("suit_change");
}
PutOnSuit(suit){
   if(!IsDefined( self.currenthead )) self.currenthead = "tag_origin";
   else self detach(self.currenthead , "", true);
   if(!IsDefined( self.currentbody )) self.currentbody = "tag_origin";

   if(isdefined(self.hatModel)) self detach(self.hatModel, "", true);

   if(IsDefined( self.headModel )) self detach(self.headModel, "");

   pieces = GetEntArray( suit.target,"targetname" );
   doHead = 0;
   swapHead = undefined;
   for( i=0;i<pieces.size;i++ ){
      if(pieces.script_noteworthy=="head"){
         if(pieces.model=="tag_origin" &  isdefined(self.headModel)) {
            if(suit.script_noteworthy=="normal"){
               doHead = 1;
            }
            self.rackhead = self.currenthead;
            self.currenthead = "tag_origin";
            
         }else{
            swapHead = pieces.model;
            self.rackhead = self.currenthead;
            self.currenthead = pieces.model;
         }
      }
      if(pieces.script_noteworthy=="body"){
         if(pieces.model=="tag_origin" &  isdefined(self.bodyModel)) {
            if(suit.script_noteworthy=="normal"){
               self setModel(self.bodyModel);
            }
            self.rackbody = self.currentbody;
            self.currentbody = "tag_origin";
         }else{
            self setmodel(pieces.model);
            self.rackbody = self.currentbody;
            self.currentbody = pieces.model;
            
         }
      }
   }
   //moved down here so the head doesn't get attached before the body is swapped
   if(doHead){
      if(IsDefined( self.headModel )) self attach(self.headModel, "", true);
      if(isdefined(self.hatModel)) self attach(self.hatModel, "", true);
   }
   if(IsDefined(swapHead)) self attach(swapHead);
   //set viewarms
   if(IsDefined( self.viewmodel ) & suit.script_noteworthy == "normal") self SetViewModel( self.viewmodel);
   else if(IsDefined( level.suits[suit.script_noteworthy]["viewarms"] )) self SetViewModel( level.suits[suit.script_noteworthy]["viewarms"]);
   //add hud for suit for remove
   self thread MakeHud(level.suits[suit.script_noteworthy]["hud"]);
   //give affect for swaping
   self thread ChangeSleeves();
}


ChangeSleeves(){
   self endon( "disconnect" );
   time = .6;
   self.suithud["transistion"] = NewClientHudelem( self );
   self.suithud["transistion"].horzAlign = "fullscreen";
   self.suithud["transistion"].vertAlign = "fullscreen";
   self.suithud["transistion"] SetShader( "black", 640, 480 );
   self.suithud["transistion"].alpha = 1;
   if(IsDefined( level.switchsuitsweapon )){
      self DisableWeaponCycling(  );
        self GiveWeapon( level.switchsuitsweapon );
        self switchToWeapon(level.switchsuitsweapon);
   }
   self.suithud["transistion"] fadeOverTime( time );
     self.suithud["transistion"].alpha = 0;
     wait(.5);
     if(IsDefined( level.switchsuitsweapon )){
        self takeWeapon( level.switchsuitsweapon );
        self enableWeaponCycling(  );
        self switchToWeapon(self GetWeaponsListPrimaries()[0]);
     }
     wait(time-.5);
     self.suithud["transistion"] destroy();
     self.suithud["transistion"] = undefined;     
     
}
MakeHud(shader){
   self endon( "disconnect" );
   if(!isdefined(shader)){
      if(isdefined(self.suithud["suits"])) self.suithud["suits"] destroy();
      return;
   }
   if(isdefined(self.suithud["suits"])) self.suithud["suits"] destroy();
   self.suithud["suits"] = create_simple_hud(self);

   self.suithud["suits"].y = 0;
   self.suithud["suits"].x = 0;
   self.suithud["suits"].alpha = 1;
   self.suithud["suits"].horzAlign = "fullscreen";
   self.suithud["suits"].vertAlign = "fullscreen";
   self.suithud["suits"].foreground = false;

   self.suithud["suits"] SetShader( shader, 640, 480 );
}

Used developer 1 to find out what was causing the error and the lines with a * are what kept appearing in the error
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Its in the spoiler :)

Used developer 1 to find out what was causing the error and the lines with a * are what kept appearing in the error

Your just missing the ; at the end of each of these lines:
Code Snippet
Plaintext
level.suits["suit0"]["viewarms"] = "viewmodel_zom_pressure_suit_arms"

Edit: also, you only need to do one suit type. I gave 4 possibly different types of suits in prefabs, and I can see how that could be confusing, but you can copy just the suit0 prefab 3 more times and don't need to do anything to suits 1, 2, or 3 unless your adding more types of suits.

In the video I use three of each prefab, suit0, suit1, suit2 and suit3, each three times. Each suit# represents a type of suit.

So edit a prefab for the suit, like spacesuit, suit0, if you make another suit type like the gas mask guy, suit1, another type like halo, suit2 and so on. Then copy the prefabs in radiant (select and press space) as many times as you like.

In this case you would only need this:
Code Snippet
Plaintext
init(){
   level.switchsuitsweapon = undefined;//"zombie_melee";//make undefined if no switching wanted
   suits = getentarray("suit", "targetname");
   level.suits = [];
   level.suits["normal"] = [];
   level.suits["normal"]["viewarms"] = "viewmodel_usa_marine_arms";
   level.suits["normal"]["hud"] = undefined;

   //1st suit type
   level.suits["suit0"]=[];
   level.suits["suit0"]["viewarms"] = "viewmodel_zom_pressure_suit_arms";
   level.suits["suit0"]["hud"] = undefined;//The shader for this suit

   //add more suits if you like:

   array_thread( suits,::PickMeUp );
}

PickMeUp(){
   self.active = 1;
   self SetCursorHint( "HINT_NOICON" );
   while(1){
      self FixTrigger();

      self waittill("trigger", player);
      if(!isdefined(player.suit)){
         player.suit = "normal";
      }
      player PlayLocalSound( "deny" );
      if(player.suit =="normal" & self.script_noteworthy=="normal") continue;
     
      player notify("suit_change");
     
      player PutOnSuit(self);
      pieces = getentarray(self.target, "targetname");
      for(i=0;i<pieces.size;i++){
         pieces thread RackSuit(player, player.suit);
      }   
      suit = player.suit;
      player.suit = self.script_noteworthy;
      self.script_noteworthy = suit;
      wait(.01);
   }
}
FixTrigger(){
   self sethintstring("");
   wait(2);
   if(self.script_noteworthy == "normal"){
      self sethintstring("Press &&1 to rack suit.");
   }else{
      self sethintstring("Press &&1 to take Suit.");
   }
}
RackSuit(player, suit){

   if(self.script_noteworthy=="head"){
     
      if(player.rackhead!=player.currenthead & player.headModel!=player.rackhead) player detach(player.rackhead);
      self setmodel(player.rackhead);
   }
   if(self.script_noteworthy=="body"){
      self setmodel(player.rackbody);
   }
   level notify("suit_change");
}
PutOnSuit(suit){
   if(!IsDefined( self.currenthead )) self.currenthead = "tag_origin";
   else self detach(self.currenthead , "", true);
   if(!IsDefined( self.currentbody )) self.currentbody = "tag_origin";

   if(isdefined(self.hatModel)) self detach(self.hatModel, "", true);

   if(IsDefined( self.headModel )) self detach(self.headModel, "");

   pieces = GetEntArray( suit.target,"targetname" );
   doHead = 0;
   swapHead = undefined;
   for( i=0;i<pieces.size;i++ ){
      if(pieces.script_noteworthy=="head"){
         if(pieces.model=="tag_origin" &  isdefined(self.headModel)) {
            if(suit.script_noteworthy=="normal"){
               doHead = 1;
            }
            self.rackhead = self.currenthead;
            self.currenthead = "tag_origin";
             
         }else{
            swapHead = pieces.model;
            self.rackhead = self.currenthead;
            self.currenthead = pieces.model;
         }
      }
      if(pieces.script_noteworthy=="body"){
         if(pieces.model=="tag_origin" &  isdefined(self.bodyModel)) {
            if(suit.script_noteworthy=="normal"){
               self setModel(self.bodyModel);
            }
            self.rackbody = self.currentbody;
            self.currentbody = "tag_origin";
         }else{
            self setmodel(pieces.model);
            self.rackbody = self.currentbody;
            self.currentbody = pieces.model;
           
         }
      }
   }
   //moved down here so the head doesn't get attached before the body is swapped
   if(doHead){
      if(IsDefined( self.headModel )) self attach(self.headModel, "", true);
      if(isdefined(self.hatModel)) self attach(self.hatModel, "", true);
   }
   if(IsDefined(swapHead)) self attach(swapHead);
   //set viewarms
   if(IsDefined( self.viewmodel ) & suit.script_noteworthy == "normal") self SetViewModel( self.viewmodel);
   else if(IsDefined( level.suits[suit.script_noteworthy]["viewarms"] )) self SetViewModel( level.suits[suit.script_noteworthy]["viewarms"]);
   //add hud for suit for remove
   self thread MakeHud(level.suits[suit.script_noteworthy]["hud"]);
   //give affect for swaping
   self thread ChangeSleeves();
}


ChangeSleeves(){
   self endon( "disconnect" );
   time = .6;
   self.suithud["transistion"] = NewClientHudelem( self );
   self.suithud["transistion"].horzAlign = "fullscreen";
   self.suithud["transistion"].vertAlign = "fullscreen";
   self.suithud["transistion"] SetShader( "black", 640, 480 );
   self.suithud["transistion"].alpha = 1;
   if(IsDefined( level.switchsuitsweapon )){
      self DisableWeaponCycling(  );
        self GiveWeapon( level.switchsuitsweapon );
        self switchToWeapon(level.switchsuitsweapon);
   }
   self.suithud["transistion"] fadeOverTime( time );
     self.suithud["transistion"].alpha = 0;
     wait(.5);
     if(IsDefined( level.switchsuitsweapon )){
        self takeWeapon( level.switchsuitsweapon );
        self enableWeaponCycling(  );
        self switchToWeapon(self GetWeaponsListPrimaries()[0]);
     }
     wait(time-.5);
     self.suithud["transistion"] destroy();
     self.suithud["transistion"] = undefined;     
     
}
MakeHud(shader){
   self endon( "disconnect" );
   if(!isdefined(shader)){
      if(isdefined(self.suithud["suits"])) self.suithud["suits"] destroy();
      return;
   }
   if(isdefined(self.suithud["suits"])) self.suithud["suits"] destroy();
   self.suithud["suits"] = create_simple_hud(self);

   self.suithud["suits"].y = 0;
   self.suithud["suits"].x = 0;
   self.suithud["suits"].alpha = 1;
   self.suithud["suits"].horzAlign = "fullscreen";
   self.suithud["suits"].vertAlign = "fullscreen";
   self.suithud["suits"].foreground = false;

   self.suithud["suits"] SetShader( shader, 640, 480 );
}

I think I will update with the new script though as soon as I give it a final coop test, because I think the new method clears that up more.
Last Edit: June 28, 2016, 04:53:47 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 17 September 2014
Last active: 2 years ago
Posts
167
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Personal Quote
W.I.P Rise & Fall
×
Krazzyboy97's Groups
Krazzyboy97's Contact & Social Links76561198105783700Krazzyboyxxkrazzyboy97xx
Your just missing the ; at the end of each of these lines:
Code Snippet
Plaintext
level.suits["suit0"]["viewarms"] = "viewmodel_zom_pressure_suit_arms"

Edit: also, you only need to do one suit. I gave 4 possibly different suits in prefabs, and I can see how that could be confusing, but you can copy just the suit0 prefab 3 more times and don't need to do anything to suits 1, 2, or 3 unless your adding more types of suits.

So spacesuit, suit0, if you make another suit type like the gas mask guy, suit1, another type like halo, suit2 and so on. Then copy the prefabs as many times as you like.

In this case:
Code Snippet
Plaintext
init(){
   level.switchsuitsweapon = undefined;//"zombie_melee";//make undefined if no switching wanted
   suits = getentarray("suit", "targetname");
   level.suits = [];
   level.suits["normal"] = [];
   level.suits["normal"]["viewarms"] = "viewmodel_usa_marine_arms";
   level.suits["normal"]["hud"] = undefined;

   //1st suit
   level.suits["suit0"]=[];
   level.suits["suit0"]["viewarms"] = "viewmodel_zom_pressure_suit_arms";
   level.suits["suit0"]["hud"] = undefined;//The shader for this suit

   //2nd suit
   level.suits["suit1"]=[];
   level.suits["suit1"]["viewarms"] = undefined;
   level.suits["suit1"]["hud"] = undefined;

   //3rd suit
   level.suits["suit2"]=[];
   level.suits["suit2"]["viewarms"] = undefined;
   level.suits["suit2"]["hud"] = undefined;//The shader for this suit

   //4th suit
   level.suits["suit3"]=[];
   level.suits["suit3"]["viewarms"] = undefined;
   level.suits["suit3"]["hud"] = undefined;
   
   //add more suits if you like:

   array_thread( suits,::PickMeUp );
}

PickMeUp(){
   self.active = 1;
   self SetCursorHint( "HINT_NOICON" );
   while(1){
      self FixTrigger();

      self waittill("trigger", player);
      if(!isdefined(player.suit)){
         player.suit = "normal";
      }
      player PlayLocalSound( "deny" );
      if(player.suit =="normal" & self.script_noteworthy=="normal") continue;
     
      player notify("suit_change");
     
      player PutOnSuit(self);
      pieces = getentarray(self.target, "targetname");
      for(i=0;i<pieces.size;i++){
         pieces thread RackSuit(player, player.suit);
      }   
      suit = player.suit;
      player.suit = self.script_noteworthy;
      self.script_noteworthy = suit;
      wait(.01);
   }
}
FixTrigger(){
   self sethintstring("");
   wait(2);
   if(self.script_noteworthy == "normal"){
      self sethintstring("Press &&1 to rack suit.");
   }else{
      self sethintstring("Press &&1 to take Suit.");
   }
}
RackSuit(player, suit){

   if(self.script_noteworthy=="head"){
     
      if(player.rackhead!=player.currenthead & player.headModel!=player.rackhead) player detach(player.rackhead);
      self setmodel(player.rackhead);
   }
   if(self.script_noteworthy=="body"){
      self setmodel(player.rackbody);
   }
   level notify("suit_change");
}
PutOnSuit(suit){
   if(!IsDefined( self.currenthead )) self.currenthead = "tag_origin";
   else self detach(self.currenthead , "", true);
   if(!IsDefined( self.currentbody )) self.currentbody = "tag_origin";

   if(isdefined(self.hatModel)) self detach(self.hatModel, "", true);

   if(IsDefined( self.headModel )) self detach(self.headModel, "");

   pieces = GetEntArray( suit.target,"targetname" );
   doHead = 0;
   swapHead = undefined;
   for( i=0;i<pieces.size;i++ ){
      if(pieces.script_noteworthy=="head"){
         if(pieces.model=="tag_origin" &  isdefined(self.headModel)) {
            if(suit.script_noteworthy=="normal"){
               doHead = 1;
            }
            self.rackhead = self.currenthead;
            self.currenthead = "tag_origin";
             
         }else{
            swapHead = pieces.model;
            self.rackhead = self.currenthead;
            self.currenthead = pieces.model;
         }
      }
      if(pieces.script_noteworthy=="body"){
         if(pieces.model=="tag_origin" &  isdefined(self.bodyModel)) {
            if(suit.script_noteworthy=="normal"){
               self setModel(self.bodyModel);
            }
            self.rackbody = self.currentbody;
            self.currentbody = "tag_origin";
         }else{
            self setmodel(pieces.model);
            self.rackbody = self.currentbody;
            self.currentbody = pieces.model;
           
         }
      }
   }
   //moved down here so the head doesn't get attached before the body is swapped
   if(doHead){
      if(IsDefined( self.headModel )) self attach(self.headModel, "", true);
      if(isdefined(self.hatModel)) self attach(self.hatModel, "", true);
   }
   if(IsDefined(swapHead)) self attach(swapHead);
   //set viewarms
   if(IsDefined( self.viewmodel ) & suit.script_noteworthy == "normal") self SetViewModel( self.viewmodel);
   else if(IsDefined( level.suits[suit.script_noteworthy]["viewarms"] )) self SetViewModel( level.suits[suit.script_noteworthy]["viewarms"]);
   //add hud for suit for remove
   self thread MakeHud(level.suits[suit.script_noteworthy]["hud"]);
   //give affect for swaping
   self thread ChangeSleeves();
}


ChangeSleeves(){
   self endon( "disconnect" );
   time = .6;
   self.suithud["transistion"] = NewClientHudelem( self );
   self.suithud["transistion"].horzAlign = "fullscreen";
   self.suithud["transistion"].vertAlign = "fullscreen";
   self.suithud["transistion"] SetShader( "black", 640, 480 );
   self.suithud["transistion"].alpha = 1;
   if(IsDefined( level.switchsuitsweapon )){
      self DisableWeaponCycling(  );
        self GiveWeapon( level.switchsuitsweapon );
        self switchToWeapon(level.switchsuitsweapon);
   }
   self.suithud["transistion"] fadeOverTime( time );
     self.suithud["transistion"].alpha = 0;
     wait(.5);
     if(IsDefined( level.switchsuitsweapon )){
        self takeWeapon( level.switchsuitsweapon );
        self enableWeaponCycling(  );
        self switchToWeapon(self GetWeaponsListPrimaries()[0]);
     }
     wait(time-.5);
     self.suithud["transistion"] destroy();
     self.suithud["transistion"] = undefined;     
     
}
MakeHud(shader){
   self endon( "disconnect" );
   if(!isdefined(shader)){
      if(isdefined(self.suithud["suits"])) self.suithud["suits"] destroy();
      return;
   }
   if(isdefined(self.suithud["suits"])) self.suithud["suits"] destroy();
   self.suithud["suits"] = create_simple_hud(self);

   self.suithud["suits"].y = 0;
   self.suithud["suits"].x = 0;
   self.suithud["suits"].alpha = 1;
   self.suithud["suits"].horzAlign = "fullscreen";
   self.suithud["suits"].vertAlign = "fullscreen";
   self.suithud["suits"].foreground = false;

   self.suithud["suits"] SetShader( shader, 640, 480 );
}

Thank you for the quick response :) Works fine now :)

 
Loading ...