Author Topic: How would you make it so you can switch to a different datablock by pressing the  (Read 2233 times)

How would you make it so you can switch to a different datablock by pressing the "brick" key.

How would you make it so that if you pressed the "R" key the code would switch to a different .cs file?
I can't quite figure it out. :(
« Last Edit: December 01, 2010, 09:06:14 PM by Sgt. A Walter »

That makes no sense. What are you trying to accomplish with this?

That makes no sense. What are you trying to accomplish with this?
I would like to find out how to make a code in the .cs so you can make to actually transfer to another .cs file.
« Last Edit: November 30, 2010, 02:17:35 PM by Sgt. A Walter »

That makes no sense. What are you trying to accomplish with this?


Secondary fire, you should try looking into other weapons witch have a similar function.

Secondary fire, you should try looking into other weapons witch have a similar function.
Like what.


Like the G36, and the DnR MP7.
Thanks, but do you have anymore examples the G36 and Mp7 were blender made in blender (blender wacks out on my computer.) :(
« Last Edit: November 30, 2010, 03:57:39 PM by Sgt. A Walter »

What you want is a weapon that toggles between doing different things when you press a button? You can swap the model, or do something fancy with image states based on the loaded and ammo image flags, or you could find a better way to accomplish what you want, like directly responding to triggers and servercmds without changing how the weapon works.

What you want is a weapon that toggles between doing different things when you press a button? You can swap the model, or do something fancy with image states based on the loaded and ammo image flags, or you could find a better way to accomplish what you want, like directly responding to triggers and servercmds without changing how the weapon works.
Yes I wan't it to switch from blablabla.cs to yadayada.cs when I click the R key, what I am trying to find out is the actual script.
« Last Edit: November 30, 2010, 05:31:49 PM by Sgt. A Walter »

You can't. The datablock is defined the first time the file is run, and then it doesn't matter what file created the datablock, it's still the datablock for a weapon. Furthermore, altering the datablock would change it for everyone using the gun at the moment, if the engine will even allow you to alter it.

You could just give the player an identical looking image with a different datablock(that is modified to do something different when it fires), but I suspect that there is a better way to do what you intend it to do.

Also, you cannot make something serverside controlled by a specific key for the clients, you can only make it respond to keys they already use, like the light key, or the paint key, or jumping, crouching, jetting, etc.. Or a /command, or a client add-on that adds a new key that the server can respond to.

You can't. The datablock is defined the first time the file is run, and then it doesn't matter what file created the datablock, it's still the datablock for a weapon. Furthermore, altering the datablock would change it for everyone using the gun at the moment, if the engine will even allow you to alter it.

You could just give the player an identical looking image with a different datablock(that is modified to do something different when it fires), but I suspect that there is a better way to do what you intend it to do.

Also, you cannot make something serverside controlled by a specific key for the clients, you can only make it respond to keys they already use, like the light key, or the paint key, or jumping, crouching, jetting, etc.. Or a /command, or a client add-on that adds a new key that the server can respond to.
So similar code to the sight stuff I get it, but how do I make it three ir even four way? And what do i change from sights scripts to make it say... the brick key?
« Last Edit: November 30, 2010, 06:16:30 PM by Sgt. A Walter »

i don't think you can do it by a key, as that would be client sided, which means you'd have to use another input, like /light, which is by default keybound

You could change the weapon to a different weapon all together. I know thats possible. But is it possible to keep the same mounted model and only change the weapon that it is referring to?