Difference between revisions of "Weapons"

From Voxel Turf Wiki
Jump to: navigation, search
m
(Added section on asset editing)
Line 22: Line 22:
 
* Be sure to be in the line of sight of one enemy at a time! Don't charge into rooms full of enemies, you'll get killed very quickly.
 
* Be sure to be in the line of sight of one enemy at a time! Don't charge into rooms full of enemies, you'll get killed very quickly.
  
==Modding==
+
==Modding Scripts==
 
Have a look at {{file|scripts/common/define_weapons.lua}}.
 
Have a look at {{file|scripts/common/define_weapons.lua}}.
 
It is recommended that you use the hook provided at the end of the file - the defineWeaponsUserCallback table.
 
It is recommended that you use the hook provided at the end of the file - the defineWeaponsUserCallback table.
Line 37: Line 37:
  
 
Be sure to define both your {{file|mods/MODNAME/scripts/server_scripts.lua}} and {{file|mods/MODNAME/scripts/client_scripts.lua}} to include your script file!
 
Be sure to define both your {{file|mods/MODNAME/scripts/server_scripts.lua}} and {{file|mods/MODNAME/scripts/client_scripts.lua}} to include your script file!
 +
 +
==Modding Textures and Models==
 +
This is an example on how to modify the rifle's object and texture.
 +
You can get a new model to appear in the game by exporting as a .obj file, and placing it in
 +
 +
{{file|/mods/YourModName/models/rifle.obj}}
 +
 +
And the texture in:
 +
 +
{{file|/mods/YourModName/textures/weapons/weapon12.EXT}} (for normal rifle)
 +
 +
{{file|/mods/YourModName/textures/weapons/weapon13.EXT}} (for silver rifle)
 +
 +
{{file|/mods/YourModName/textures/weapons/weapon14.EXT}} (for gold rifle)
 +
Where EXT is either .tga, .png or .jpg
 +
 +
 +
If you want weapon mods to work with the new model then that's a little more complicated:
 +
Weapon mods basically work by alpha-masking textures, and then the game combines several textures together to make the full weapon texture.
 +
You'll have to make the model have all the attachments (eg. scope, silencer) and have the parts of the texture for the attachments be *transparent*. Then create the textures for each component in {{file|/weapons/mods/}} - for example mod46.tga is the texture for the Scope for a Rifle. Also note that all pixels apart from the scope are transparent. Again tga, png and jpg are all supported.
  
 
==External Links==
 
==External Links==

Revision as of 04:44, 8 March 2018

This article is a Stub. You can help by expanding it

This article may be out of date. It was last updated for 1.0.28.

Small Arms

There are 5 kinds of small arms and 3 tiers (black, silver, gold). Higher tier weapons can only be taken from Bandit Bases.

BasicWeapons.png

Stats

Weapon Mods

Up to two weapon mods can be applied to a weapon at a time. There is no way to remove them from an attached weapon, so be careful!

Rocket Launchers

There are 4 rocket launchers in the game.

Grenades

There is currently one kind of grenade in the game.

Combat Strategy

  • Aim for the head - some weapons (such as the Assault Rifle and the Rifle) do significantly more damage for head shots.
  • Crouch! This not only reduces your hitbox size, but it reduces the chance of Bandits hearing your footsteps.
  • Be sure to be in the line of sight of one enemy at a time! Don't charge into rooms full of enemies, you'll get killed very quickly.

Modding Scripts

Have a look at scripts/common/define_weapons.lua . It is recommended that you use the hook provided at the end of the file - the defineWeaponsUserCallback table.

function myWeaponMod (BlockTypes, ItemTypes)
	-- Your code here
end


if (defineWeaponsUserCallback == nil) then defineWeaponsUserCallback = {} end
defineWeaponsUserCallback[#defineWeaponsUserCallback+1] = { "myWeaponMod name | my description ", myWeaponMod };

Be sure to define both your mods/MODNAME/scripts/server_scripts.lua

and mods/MODNAME/scripts/client_scripts.lua
to include your script file!

Modding Textures and Models

This is an example on how to modify the rifle's object and texture. You can get a new model to appear in the game by exporting as a .obj file, and placing it in

/mods/YourModName/models/rifle.obj


And the texture in:

/mods/YourModName/textures/weapons/weapon12.EXT

(for normal rifle)

/mods/YourModName/textures/weapons/weapon13.EXT

(for silver rifle)

/mods/YourModName/textures/weapons/weapon14.EXT

(for gold rifle)

Where EXT is either .tga, .png or .jpg


If you want weapon mods to work with the new model then that's a little more complicated: Weapon mods basically work by alpha-masking textures, and then the game combines several textures together to make the full weapon texture. You'll have to make the model have all the attachments (eg. scope, silencer) and have the parts of the texture for the attachments be *transparent*. Then create the textures for each component in /weapons/mods/

- for example mod46.tga is the texture for the Scope for a Rifle. Also note that all pixels apart from the scope are transparent. Again tga, png and jpg are all supported. 

External Links

Dev Diary 3: Weapons Part 1: Small Arms and Weapon Mods

Dev Diary 4: Rockets, Explosives and Blast Resistance