Adding Parts To Weapons

Discussion in 'Modeling & Skinning' started by loeri, Jun 19, 2013.

  1. loeri spearhead-info.be

    Contributions:
    63
    Specialties:
    Mapper, Scripting, Programming, Support
    Processing:
    Graphics:
    PREMIUM
    I Donated
    I ve asked this some years ago how to remove parts, and i found that its +nodraw for the shaders but i didnt find how to add a part from an other weapon to an other weapon?

    Like the silencer from silenced pistol to a sniper?

    This is an example: kar sniper without scope with the lens, serverside :)

    [​IMG]
  2. Herr Klugscheisser No longer supporting WarGaming

    Contributions:
    370
    Specialties:
    Scripting, Support
    Processing:
    Graphics:
    PREMIUM
    I Donated
    More of a scripting question then.

    [​IMG]
    [​IMG]
    [​IMG]

    If you can turn surfaces off (the correct ones anyway), then you are in luck.The attach it to the model using the available tags.

    Example: The Browning

    Code:
    local.random = randomint 999999
    
    self attachmodel models/vehicles/jeep_30cal.tik "origin" 0.8 ("attachedPortablem1919" + local.random) 1 -1 -1 -1 -1 (13.8 -1 48)
    $("attachedPortablem1919" + local.random) surface mount "+nodraw"
    $("attachedPortablem1919" + local.random) show    //surface globe "-nodraw"
    $("attachedPortablem1919" + local.random) angles "180 181 0"    //not needed for carryable
    
    self attachmodel models/statweapons/it_w_breda_bipod.tik "tag_barrel" 0.7 ("attachedbipod" + local.random) 1 -1 -1 -1 -1 ( -2.0 0.55 10.0 )
    $("attachedbipod" + local.random) angles "180 180 0"
    
    self attachmodel models/weapons/kar98.tik "origin" 1.0 ("attachedkar98" + local.random) 1 -1 -1 -1 -1 ( 2 -0.12 -2.75)
    $("attachedkar98" + local.random) surface KAR981 "+nodraw"
    $("attachedkar98" + local.random) surface material7 "+nodraw"
    $("attachedkar98" + local.random) surface material8 "+nodraw"
    $("attachedkar98" + local.random) angles "-8 0.0 -1"
    
  3. loeri spearhead-info.be

    Contributions:
    63
    Specialties:
    Mapper, Scripting, Programming, Support
    Processing:
    Graphics:
    PREMIUM
    I Donated
    Thx :) I will look into this!
  4. loeri spearhead-info.be

    Contributions:
    63
    Specialties:
    Mapper, Scripting, Programming, Support
    Processing:
    Graphics:
    PREMIUM
    I Donated
    Where should this code be putted in?
    Im just detecting when a player spawns and do a take all, but then the browning seems to be attached to the feet.. :)
    And you cant shoot with it.
  5. Herr Klugscheisser No longer supporting WarGaming

    Contributions:
    370
    Specialties:
    Scripting, Support
    Processing:
    Graphics:
    PREMIUM
    I Donated
    Well in my example you would execute a script from the raise state. Detect what weapon the player is holding and then attach what you want to the appropriate tags for the model if it's the correct weapon. My example is attaching the 3 items to the BAR.
    LeBabouin likes this.
  6. Ldr.Therm0 Private First Class

    Contributions:
    0
    Processing:
    Graphics:
    Intressting screenshot's Herr, But we wonderd how u are able to add the gewehrgranate part on the silencedpistol.
    Coud u be so kind to share the script.

    The script above is easy to add tik files but we need to know how to switch shaders.

    I have tried this in the weapons tiki but it woudnt load. and 2 paths in the server setup isnt able aswell.

    Anyway we are struggeling to find a solution to add diffrent shaders as for example i want the handle of a BAR, with a barrel of a Uk_enfield with a scope from a springfield, or what ever basicly switch parts of each gun and place them on any other gun.

    But when i add the pistol shader i can not find it because there is no path. so if i change paths (path models/weapons/enfieldsniper to path models/weapons/highstandard) it will just change the weapons.so enfield disappears and it holds a pistol but the player is in the rifle position.
    When i try both paths it conflicts and it doest work at all.

    Ive managed to switch sounds, but thats only client side to...Bummer..

    There for i think we get alot smarter if u coud share that script.

    Thx ahead Therm0
  7. Herr Klugscheisser No longer supporting WarGaming

    Contributions:
    370
    Specialties:
    Scripting, Support
    Processing:
    Graphics:
    PREMIUM
    I Donated
    I don't do it in the tik files. The problem is it may not work the way you want if you can't turn off the right parts because of the surface names. If you look closely at the Browning the wood stock from the Kar98 still have the back end of the barrel assembly (whatever it's called). Some stuff you can hide within others.

    The cup from the gewehrgranate worked because the gun has a seperate surface that can be turned off and then attaching the whole gun (with hidden stock) to the silenced pistol which I used for Rookie_One's Portal mod. Just trying to make a unique looking weapon there.
  8. loeri spearhead-info.be

    Contributions:
    63
    Specialties:
    Mapper, Scripting, Programming, Support
    Processing:
    Graphics:
    PREMIUM
    I Donated
    I have tried it like you said with a weapon checker but still it shows the cal at the player its feet:

    [​IMG]

    Code:
    Code:
    aitframe
    local.n = randomint 99999
    self weaponcommand dual targetname ("w" + local.n)
    local.weap = $("w" + local.n).model
     
    if(self.dmteam == "allies")
        {
                switch(local.weap)
                      {
    case "models/weapons/m1_garand.tik" :
                                        waitframe 
                                        break
    case "models/weapons/thompsonsmg.tik" :
                                        waitframe
                                        break
    case "models/weapons/sten.tik" :
                                        waitframe 
                                        break
    case "models/weapons/ppsh_smg.tik" :
                                        waitframe 
                                        break
    case "models/weapons/bar.tik" :
                                        waitframe 
                                     
                                        local.random = randomint 999999
     
    self attachmodel models/vehicles/jeep_30cal.tik "origin" 0.8 ("attachedPortablem1919" + local.random) 1 -1 -1 -1 -1 (13.8 -1 48)
    $("attachedPortablem1919" + local.random) surface mount "+nodraw"
    $("attachedPortablem1919" + local.random) show    //surface globe "-nodraw"
    $("attachedPortablem1919" + local.random) angles "180 181 0"    //not needed for carryable
     
    self attachmodel models/statweapons/it_w_breda_bipod.tik "tag_barrel" 0.7 ("attachedbipod" + local.random) 1 -1 -1 -1 -1 ( -2.0 0.55 10.0 )
    $("attachedbipod" + local.random) angles "180 180 0"
     
    self attachmodel models/weapons/kar98.tik "origin" 1.0 ("attachedkar98" + local.random) 1 -1 -1 -1 -1 ( 2 -0.12 -2.75)
    $("attachedkar98" + local.random) surface KAR981 "+nodraw"
    $("attachedkar98" + local.random) surface material7 "+nodraw"
    $("attachedkar98" + local.random) surface material8 "+nodraw"
    $("attachedkar98" + local.random) angles "-8 0.0 -1"
                                     
                                        break
    case "models/weapons/bazooka.tik" :
                                        waitframe 
                                        break
    case "models/weapons/svt_rifle.tik" :
                                        waitframe 
                                        break
    case "models/weapons/shotgun.tik" :
                                        waitframe 
                                        break
                    }
          }
     
    else
     
          {
          switch(local.weap)
                  {
    case "models/weapons/g43.tik" :
                                        waitframe 
                                        break
    case "models/weapons/mp40.tik" :
                                        waitframe 
                                        break
    case "models/weapons/mp44.tik" :
                                        waitframe
                                        break
    case "models/weapons/panzerschreck.tik" :
                                        waitframe 
                                        break
    case "models/weapons/shotgun.tik" :
                                        waitframe 
                                        break
            }
      }
     
    end
    EDIT:

    I ve changed the coords of the parts and seems to be on the good height now but seems not attached to the bar..

    [​IMG]
  9. Herr Klugscheisser No longer supporting WarGaming

    Contributions:
    370
    Specialties:
    Scripting, Support
    Processing:
    Graphics:
    PREMIUM
    I Donated
    That's because self in your example is the player. In my example self is the weapon.

    Try:

    Code:
    case "models/weapons/bar.tik" :
              self weaponcommand mainhand waitthread setup_bar
                    break
    
    then have a thread

    Code:
    setup_bar:
    
    
    self surface all "+nodraw"   //hide the BAR
    self name "Browning M1919A6"
     self clipsize 150
     
    local.random = randomint 999999
     
    self attachmodel models/vehicles/jeep_30cal.tik "origin" 0.8 ("attachedPortablem1919" + local.random) 1 -1 -1 -1 -1 (13.8 -1 48)
    $("attachedPortablem1919" + local.random) surface mount "+nodraw"
    $("attachedPortablem1919" + local.random) show   
    $("attachedPortablem1919" + local.random) angles "180 181 0"    
     
    self attachmodel models/statweapons/it_w_breda_bipod.tik "tag_barrel" 0.7 ("attachedbipod" + local.random) 1 -1 -1 -1 -1 ( -2.0 0.55 10.0 )
    $("attachedbipod" + local.random) angles "180 180 0"
     
    self attachmodel models/weapons/kar98.tik "origin" 1.0 ("attachedkar98" + local.random) 1 -1 -1 -1 -1 ( 2 -0.12 -2.75)
    $("attachedkar98" + local.random) surface KAR981 "+nodraw"
    $("attachedkar98" + local.random) surface material7 "+nodraw"
    $("attachedkar98" + local.random) surface material8 "+nodraw"
    $("attachedkar98" + local.random) angles "-8 0.0 -1"
    
    end
     
    
    Mind you the bipod is from BT
    loeri likes this.
  10. Ldr.Therm0 Private First Class

    Contributions:
    0
    Processing:
    Graphics:
    ok so the pistol u made the same way as the showed in script of the browning u linked.

    Ive seen a Sniper rifle with a mounted silencer on working serverside" and was aiming for the same goal
    Unfortually that person is to "Swearsalotatthispart" to tell us how he did it.

    So i will focus on your info ,and go into a search of a static.tik that looks like a silencer so i can add that to guns like u did.+
    the fire on the bottle is that an working animation? i mean can u add everything this way? from static to miscobj....most important is that it works serverside..

    the link of the script is the whole .scr file? if not plz upload it so we have a steady base to start with, we tried to run the script before but it sticked on the floor and was not able to use.

    Thx Therm0
  11. Herr Klugscheisser No longer supporting WarGaming

    Contributions:
    370
    Specialties:
    Scripting, Support
    Processing:
    Graphics:
    PREMIUM
    I Donated
    I'm just showing how it's possible. I haven't really tinkered with this kind of stuff in 4 years to be honest. I don't have stand alone mods as everything I did was pretty well integrated with I was doing personally at the time. Most of it was never finished/used/tested properly.

    You can attach any model that way, even ones with animations as seen by the fire and I only was interested in server side mods regardless.



    Those are just models attached to other projectiles (so they behave like projectiles). The snowball is really a globe from a street light with the surface for the street light turned off and scaled down (I was just lucky it worked that way).

    So was the silencer really a silencer or something else that looked like one? It's all just smoke and mirrors.
  12. Herr Klugscheisser No longer supporting WarGaming

    Contributions:
    370
    Specialties:
    Scripting, Support
    Processing:
    Graphics:
    PREMIUM
    I Donated
    Jethro did it differently than I did (isn't modding great, more than one solution) for his molotov mod and attachs models directly from the tik file. This might be easier to follow and understand.

    Server Side Molotovs
    loeri likes this.
  13. Ldr.Therm0 Private First Class

    Contributions:
    0
    Processing:
    Graphics:
    U mean lucky it worked serverside?
    was the snowball also using the same script as u showed for the browning?



    Yea ive been thinking the same thing.. guess ill be working with the lod_spawnlist lately it seems... :p
    i found alot of site wich showed lots of tik commands ..but ist there the same with pictures so u can see what they are?
    woud save me alot of time :p meanwhile im starting allready to spawn tiks and find me a nice silencer look a like..

    we havend found what we needed but we did got a bit smarter.. so thx for the info

    Feel free to sign up @ http://1manarmyfans.webs.com
  14. Herr Klugscheisser No longer supporting WarGaming

    Contributions:
    370
    Specialties:
    Scripting, Support
    Processing:
    Graphics:
    PREMIUM
    I Donated
    Lucky in the sense that I found an in game model I could use to get the desired effect so it all could be serverside. There was more to it, but basically it's just one model attached to another to give the look I wanted.

Share This Page