INSTALLATION
1. Unzip archive, move 4 folders into your CS2D main folder with overwrite (overwriting server.lua and servertransfer.lst)
2. Start the game, enable mp_luamap 1 in server settings (actually needs only for buttons from map editor)
FEATURES
Creating custom weapon with new sounds, sprites and stats
Custom weapon may damage players, npcs, buildings, env_breakable (optional ugly function)
Custom weapons works at all CS2D modes (Standard, TDM, Zombies), does not conflict with default weapons and works very similar
Easy configs and spawning through the map editor, buying through menu that works similar to default B menu
Laser sights (optional)
10 new guns (SCAR, AK-12, Sawn-off shotgun and others)
Fingergun
QUICK GUIDE
Spoiler
1. HOW TO ADD NEW WEAPON
1.1 Open sys/lua/2gen weapons/storage.lua with Notepad++ or just Notepad
1.2 Scroll a little down and find a table weapons_data
1.3 Look at the example weapons and add something new at the end of table (I mean copy-paste a table of the first ([1]= {...}, )weapon inside weapons_data table), id (table key (number in [ ] )) should be the next in numerical order
2. HOW TO BUY NEW WEAPON
2.1 Press "X" key
2.2 Choose weapon (X buy menu works like a classic B menu)
3. HOW TO SHOOT (not a joke, this script uses hotkeys (key binds) and it is not recommended to change the default controls)
3.1 Press "LMB" key a.k.a. Left Mouse Button
4. HOW TO RELOAD
4.1 Press "R" key
5. HOW TO LASER
5.1 Press "MMB" key a.k.a. Middle Mouse Button, actually this is mouse wheel, I don't know why it was so hard to understand for some people when we played on beta test server
6. HOW TO COLOR MY LAZER
6.1 Press "H" key to change the color of your laser sight
7. HOW TO DROP MY GUN
7.1 Press "G"
1.1 Open sys/lua/2gen weapons/storage.lua with Notepad++ or just Notepad
1.2 Scroll a little down and find a table weapons_data
1.3 Look at the example weapons and add something new at the end of table (I mean copy-paste a table of the first ([1]= {...}, )weapon inside weapons_data table), id (table key (number in [ ] )) should be the next in numerical order
2. HOW TO BUY NEW WEAPON
2.1 Press "X" key
2.2 Choose weapon (X buy menu works like a classic B menu)
3. HOW TO SHOOT (not a joke, this script uses hotkeys (key binds) and it is not recommended to change the default controls)
3.1 Press "LMB" key a.k.a. Left Mouse Button
4. HOW TO RELOAD
4.1 Press "R" key
5. HOW TO LASER
5.1 Press "MMB" key a.k.a. Middle Mouse Button, actually this is mouse wheel, I don't know why it was so hard to understand for some people when we played on beta test server
6. HOW TO COLOR MY LAZER
6.1 Press "H" key to change the color of your laser sight
7. HOW TO DROP MY GUN
7.1 Press "G"
WARNINGS and REQUIREMENTS
1. Don't change the default CS2D key controls
2. Don't change mp_hudscale (must be 0)
3*. Enable mp_luamap in server settings
LONG GUIDE
Spoiler
*All configs placed to the storage.lua
1. Configurable values
2. Weapon creating
3. Console commands
4. Map editor
5. Using in Lua scripts
1. Configurable values
Spoiler
recoil - true or false | enable or disable recoil for all custom weapons, hax
blood_effects_value - number | amount of blood partics while bullet hit npc/player
sparkles_effect_value - number | amount of sparkles while shooting in the walls
smoke_effects - true or false | enable or disable smoke effect while shooting
gunfire_sprite_effect - true or false | enable or disable a gunfire effect while shooting, represents in sprite sheet
laser_sights - 2 or 1 or 0 | enable for all weapons or enable only for custom weapons or disable laser sights
custom_buy_menu - true or false | enable or disable custom buy menu for custom weapons, works like a default B buymenu
info_messages - true or false | enable or disable info messages for each player at spawn
ammo_hudtxt_position - 2 or 1 | classic position for ammo hud or position at center of the screen next to the player
ammo_hudtxt_color - RGB code | color of ammo hud
explode_breakables - true or false | enable or disable spawning explosions while shooting with custom weapons in the Env_Breakable, as the only way to inflict damage to it
buy_menu_always - true or false | enable or disable custom buy menu anywhere regardless of buytime, zone etc, hax
--v1.1 update
npc_hitbox - number | distance in pixels between bullet and NPCs to deal damage
player_hitbox - number | same, for players
--v1.2 update
laser_hotkey - key | hot key for laser sight
laser_color_hotkey - same, for laser color
buy_menu_hotkey - same, for custom buy menu
--v1.3 update
bullet_line_sprite_effect - true or false | enable or disable sprites of bullets lines while shooting
blood_effects_value - number | amount of blood partics while bullet hit npc/player
sparkles_effect_value - number | amount of sparkles while shooting in the walls
smoke_effects - true or false | enable or disable smoke effect while shooting
gunfire_sprite_effect - true or false | enable or disable a gunfire effect while shooting, represents in sprite sheet
laser_sights - 2 or 1 or 0 | enable for all weapons or enable only for custom weapons or disable laser sights
custom_buy_menu - true or false | enable or disable custom buy menu for custom weapons, works like a default B buymenu
info_messages - true or false | enable or disable info messages for each player at spawn
ammo_hudtxt_position - 2 or 1 | classic position for ammo hud or position at center of the screen next to the player
ammo_hudtxt_color - RGB code | color of ammo hud
explode_breakables - true or false | enable or disable spawning explosions while shooting with custom weapons in the Env_Breakable, as the only way to inflict damage to it
buy_menu_always - true or false | enable or disable custom buy menu anywhere regardless of buytime, zone etc, hax
--v1.1 update
npc_hitbox - number | distance in pixels between bullet and NPCs to deal damage
player_hitbox - number | same, for players
--v1.2 update
laser_hotkey - key | hot key for laser sight
laser_color_hotkey - same, for laser color
buy_menu_hotkey - same, for custom buy menu
--v1.3 update
bullet_line_sprite_effect - true or false | enable or disable sprites of bullets lines while shooting
2. Weapon creating
Spoiler
*All weapons are stored in storage.lua, in numbered tables in main weapon_data table
| [1] | - id of weapon (table key)
| name = "AK-12" | - name of your weapon, for killing massages and dropped weapon
| path_e | - top-down image sprite for equipped weapon
| e_scale1 | and | e_scale2 | -scale modifier for equipped image, 1 - width and 2 - height
| path_d | - drop image (on the floor), side view
| d_scale1 | and | d_scale1 | - same, as e_scale but for dropped image
| sounds | - table with weapon sounds, 1 or more files
| type = "rifle" | - type of weapon, affects on the equipment slot (2 slot for "pistol" and 1 for another ones), movement speed and reloading speed, actually a base of default weapon
*possible types: rifle, pistol, smg, machine gun, sniper 1x scope, sniper 2x scope, shotgun
**actually rifle is 30 real id (ak47), pistol is 4, smg 21, machine gun 40, sniper 1x scope 33, sniper 2x scope 35. This DOES NOT mean that you can not use these default cs2d weapons, it is just a basis taken for convenience and imitation of classic reloading.
| ammo_mag | - amount of ammo in magazine
| ammo_bag | - amount of additional carried ammo
| fire_rate_timer | - delay between shots in milliseconds (lower value = higher rate of fire)
| damage | - weapon raw damage, final damage depends on damagefactor, zombiedmg, kevlar, armor
| recoil_force | - range of bullets dispersion in degrees
| silence = false | - "true" will disable gunfire and bullet lines effects for this weapon (invisible shooting)
| cost = 9999 | - price of weapon in custom buymenu, set to "-1" to disable buying
| scope1x_damage_multiplier | - damage bonus while shooting through scope 1- default value, 1.5- +50%, 0.5 - -50%, necessary only for weapons "sniper 1x scope" and "sniper 2x scope"
| scope1x_damage_multiplier | - damage bonus while shooting through scope 2 (smallest scope), necessary only for "sniper 2x scope"
--v1.1 update
| range | - fire range (bullets flying range) in pixels
| hitbox_modifier | - optional value, the number in pixels to which the hitbox will increased (hight values can make the weapon shoot through walls)
| [1] | - id of weapon (table key)
| name = "AK-12" | - name of your weapon, for killing massages and dropped weapon
| path_e | - top-down image sprite for equipped weapon
| e_scale1 | and | e_scale2 | -scale modifier for equipped image, 1 - width and 2 - height
| path_d | - drop image (on the floor), side view
| d_scale1 | and | d_scale1 | - same, as e_scale but for dropped image
| sounds | - table with weapon sounds, 1 or more files
| type = "rifle" | - type of weapon, affects on the equipment slot (2 slot for "pistol" and 1 for another ones), movement speed and reloading speed, actually a base of default weapon
*possible types: rifle, pistol, smg, machine gun, sniper 1x scope, sniper 2x scope, shotgun
**actually rifle is 30 real id (ak47), pistol is 4, smg 21, machine gun 40, sniper 1x scope 33, sniper 2x scope 35. This DOES NOT mean that you can not use these default cs2d weapons, it is just a basis taken for convenience and imitation of classic reloading.
| ammo_mag | - amount of ammo in magazine
| ammo_bag | - amount of additional carried ammo
| fire_rate_timer | - delay between shots in milliseconds (lower value = higher rate of fire)
| damage | - weapon raw damage, final damage depends on damagefactor, zombiedmg, kevlar, armor
| recoil_force | - range of bullets dispersion in degrees
| silence = false | - "true" will disable gunfire and bullet lines effects for this weapon (invisible shooting)
| cost = 9999 | - price of weapon in custom buymenu, set to "-1" to disable buying
| scope1x_damage_multiplier | - damage bonus while shooting through scope 1- default value, 1.5- +50%, 0.5 - -50%, necessary only for weapons "sniper 1x scope" and "sniper 2x scope"
| scope1x_damage_multiplier | - damage bonus while shooting through scope 2 (smallest scope), necessary only for "sniper 2x scope"
--v1.1 update
| range | - fire range (bullets flying range) in pixels
| hitbox_modifier | - optional value, the number in pixels to which the hitbox will increased (hight values can make the weapon shoot through walls)
3. Console commands
Spoiler
3.1 New console commands:
wequip id weaponid | wequip 1 2 | equip custom weapon with id 2 (Colt Python) for player with id 1
wstrip id weaponid | strip weapon
wspawn weaponid tilex tilley | wspawn 1 5 6 | spawn a custom weapon with id 1 (ak12) at map position in tiles x 5 and y 6
3.2 Default console commands, which will affect on custom weapon
mp_damagefactor
mp_kevlar
mp_zombiedmg
mp_infammo
mp_deathdrop
mp_weaponfadeout
mp_buytime
sv_friendlyfire
wequip id weaponid | wequip 1 2 | equip custom weapon with id 2 (Colt Python) for player with id 1
wstrip id weaponid | strip weapon
wspawn weaponid tilex tilley | wspawn 1 5 6 | spawn a custom weapon with id 1 (ak12) at map position in tiles x 5 and y 6
3.2 Default console commands, which will affect on custom weapon
mp_damagefactor
mp_kevlar
mp_zombiedmg
mp_infammo
mp_deathdrop
mp_weaponfadeout
mp_buytime
sv_friendlyfire
4. Map editor
Spoiler
4.1 Placing a custom weapon on your map
Place "Env_Item" entity and set name and trigger strings:
name: swpn
trigger: 1
spawn: 1 (spawn one weapon) or 2 (infinite spawn) or 3 (every X sec)
*put any number in trigger, this is id of custom weapon, 1 will spawn ak12
4.2 Placing a button with shop
Place "Trigger_Use" and set trigger string:
trigger: wshop
*you can enable or disable this shop by enabling/disabling this button
4.3 Placing a trigger which will spawn a weapon after any condition
Place "Trigger_If", set any name, set Condition string:
Condition: parse("wspawn 1 10 13")
*after trigger activation weapon with id 1 will be spawned at tiles position x 10 y 13
4.4 Disabling "X" buymenu for map
Place Info_NoBuying entity. This will disable the custom weapons shop, even if it was activated in the script config.
Place "Env_Item" entity and set name and trigger strings:
name: swpn
trigger: 1
spawn: 1 (spawn one weapon) or 2 (infinite spawn) or 3 (every X sec)
*put any number in trigger, this is id of custom weapon, 1 will spawn ak12
4.2 Placing a button with shop
Place "Trigger_Use" and set trigger string:
trigger: wshop
*you can enable or disable this shop by enabling/disabling this button
4.3 Placing a trigger which will spawn a weapon after any condition
Place "Trigger_If", set any name, set Condition string:
Condition: parse("wspawn 1 10 13")
*after trigger activation weapon with id 1 will be spawned at tiles position x 10 y 13
4.4 Disabling "X" buymenu for map
Place Info_NoBuying entity. This will disable the custom weapons shop, even if it was activated in the script config.
5. Using in Lua scripts
Spoiler
Call for this custom weapons functions in your script function
swpn_equip_new_weapon(id,wid)
swpn_strip_new_weapon(id,wid)
swpn_spawn_new_weapon(wid,tx,ty)
*id- player id, wid- weapon id, tx- tile x position, ty - tile y
swpn_equip_new_weapon(id,wid)
swpn_strip_new_weapon(id,wid)
swpn_spawn_new_weapon(wid,tx,ty)
*id- player id, wid- weapon id, tx- tile x position, ty - tile y
Dev Info
Spoiler
It has no relation to the Engin33r Custom Weapons script, and no any code was taken from it (actually too confusing for my scripting level, if I even wanted to edit it, I would not be able to do it).
Two functions were taken from my favorite NPC Mod by Starkkz (freeline and related) and maybe a couple of strings from Tibia RPG Mod by weiwen (related with automatic menu creating)
What I will not do:
- Adding custom melee weapon(useless)
- Adding more of weapons of existing type (so don't tell me to add something like Barret M82 or AR-15 or even VSS Vintorez, you can do it yourself, this script was created for this purpose)
Stats:
- Script was tested for 3 days.
- 30+ stable rounds in CTF mode, 8 players
- A lot of rounds in Zombie mode, 12 players + 8 bots
- Several days at 24/7 server with a lot of people
- Development time: 10 days
Two functions were taken from my favorite NPC Mod by Starkkz (freeline and related) and maybe a couple of strings from Tibia RPG Mod by weiwen (related with automatic menu creating)
What I will not do:
- Adding custom melee weapon(useless)
- Adding more of weapons of existing type (so don't tell me to add something like Barret M82 or AR-15 or even VSS Vintorez, you can do it yourself, this script was created for this purpose)
Stats:
- Script was tested for 3 days.
- 30+ stable rounds in CTF mode, 8 players
- A lot of rounds in Zombie mode, 12 players + 8 bots
- Several days at 24/7 server with a lot of people
- Development time: 10 days
Changelogs
Spoiler
v 1.0
- Release
v 1.1
Added:
- Configurable hitbox value for NPCs
- Configurable hitbox value for Players
- "Hitbox modifier" stat for weapons, will further increase hitboxes when you shoot from a specific weapon
Changed:
- Configurable "Range" stat for each weapons instead of one general value
v 1.2
Added:
- Configurable hot keys for custom buy menu, laser sight and laser color
Changed:
- Method of loading config.lua from 'require' to 'dofile' to prevent a possible bug with file path on some systems
Fixed:
- Critical bug, when player was able to shoot with custom and default weapon in same time after picking up ammo with pressed attack button while reloading
- Bug in damage calculating for stealth suit armor
- Bug with stacking custom and default weapons in one slot when called for "equip" console command (now works only with number id values i.e. 'equip 1 2' but not with 'equip 1 glock')
- Error when pressed drop button for certain weapon slots
v 1.3
Added:
- New type of weapons: shotgun
- New weapon: Sawn-off TOZ-66
- Additional smoke effect when hitting the wall
Improved:
- Calculation for recoil (now in degrees)
Fixed:
- Bullet lines! Now it do not freeze server clients.
- Shooting a 1 bullet while switching weapon using "1-5" buttons, when player have more than one weapon in 1-5 slot.
Removed:
- aim_mode 1 (shooting mode, when the sight should be directly above the target)
- Release
v 1.1
Added:
- Configurable hitbox value for NPCs
- Configurable hitbox value for Players
- "Hitbox modifier" stat for weapons, will further increase hitboxes when you shoot from a specific weapon
Changed:
- Configurable "Range" stat for each weapons instead of one general value
v 1.2
Added:
- Configurable hot keys for custom buy menu, laser sight and laser color
Changed:
- Method of loading config.lua from 'require' to 'dofile' to prevent a possible bug with file path on some systems
Fixed:
- Critical bug, when player was able to shoot with custom and default weapon in same time after picking up ammo with pressed attack button while reloading
- Bug in damage calculating for stealth suit armor
- Bug with stacking custom and default weapons in one slot when called for "equip" console command (now works only with number id values i.e. 'equip 1 2' but not with 'equip 1 glock')
- Error when pressed drop button for certain weapon slots
v 1.3
Added:
- New type of weapons: shotgun
- New weapon: Sawn-off TOZ-66
- Additional smoke effect when hitting the wall
Improved:
- Calculation for recoil (now in degrees)
Fixed:
- Bullet lines! Now it do not freeze server clients.
- Shooting a 1 bullet while switching weapon using "1-5" buttons, when player have more than one weapon in 1-5 slot.
Removed:
- aim_mode 1 (shooting mode, when the sight should be directly above the target)
Credits
Spoiler
Lua:
Starkkz's NPC Pack (46)
CS2D Forum
Net
Sprites:
File does not exist (15260)
[Less-HD] RPK Machine Gun + 3 Sound Files (4)
SCAR-H [Now with Improved Shadings] (10)
AK47:AK47SOPMOD (14)
BaDgEr | Dragunov's SVD (24)
[BMS]: .357 Caliber Revolver (4)
Makarov pistol pack (9)
BaDgEr | Sawed-Off Shotgun (10)
Sounds:
Free sounds
Half-Life sounds
S.T.A.L.K.E.R. sounds
Starkkz's NPC Pack (46)
CS2D Forum
Net
Sprites:
File does not exist (15260)
[Less-HD] RPK Machine Gun + 3 Sound Files (4)
SCAR-H [Now with Improved Shadings] (10)
AK47:AK47SOPMOD (14)
BaDgEr | Dragunov's SVD (24)
[BMS]: .357 Caliber Revolver (4)
Makarov pistol pack (9)
BaDgEr | Sawed-Off Shotgun (10)
Sounds:
Free sounds
Half-Life sounds
S.T.A.L.K.E.R. sounds
More useful files:
2Gen's STALKER Anomalies script (11)
2Gen's Post-apocalyptic Tileset 64x64 (6)
edited 8×, last 18.09.18 01:18:22 pm
Approved by Sparty
Download
1.69 mb, 939 Downloads