Raised This Month: $51 Target: $400
 12% 

DoD Smokegrenades plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Day of Defeat        Category:   Fun Stuff        Approver:   devicenull (200)
Trp. Jed
Member
Join Date: Aug 2004
Old 10-10-2004 , 10:58   DoD Smokegrenades plugin
Reply With Quote #1

My second and so biggest bit of coding yet!

This plugin gives players the ability to use smoke grenades in DoD for tactical purposes such as giving cover for breakouts and assaults.

I listened to a lot of suggestions from admins and players and have done my best to supply plenty of configuration to suit different maps and to stop idiots spamming them. I've also tried my best to minimize the graphical fps drops and lag that might occur. I've tested it on a real server with several players with machines of various specs and none reported any significant detrimental effects - however your mileage my vary.

Shot synopsis - player binds a key to the command "throw_smoke". Pressing the key throws a smoke grenade. How hard it is thrown depends on how high they aim up in the air. The smoke lasts a short while so it doesnt blanket the area for too long and isnt totally opaque so its really just for short-term cover.

Admins can enabled or disable the smoke grenades completely, enable or disable them per team or limit them to weapons of a certain role. They can also set a limit if the total grenades thrown per round is player or team based, e.g. you can set 2 per player or a total of 2 per team. This can be put in the server.cfg or map.cfg as needed.

Players have a configurable time delay after throwing before they can thrown another and another cvar controls how many at one time a team can have active in the map. There are also time delays on spawn and end of round to stop people letting them off in spawn.

I think thats about all you need to know!

I didnt use DODX because I wanted to keep this as low-level as possible and hopefully make it compatible with AMX.

This was built at tested with 0.16. If you want to try it out, bind a key to "throw_smoke" and test it on the following server: 67.19.63.72:27015

Code:
/* AMXX Mod script * *   Smoke Grenades (for DoD 1.3, should work in any mod with a bit of alteration on sprites, weapon consts, etc.) *   by Neil 'Jed' Jedrzejewski * *   Adds the ability to throw a smoke grenade * *   Cvars: *   mp_smokegrenades 0/1      disable/enable the use of smoke grenades (on by default) *   mp_smokegren_axis_classes 63   axis classes allowed to use smoke grenades, see below *   mp_smokegren_allie_classes 63  allie classes allowed to use smoke grenades, see below *   mp_smokegren_msg 0/1      show the user messages relating to smoke grenades (on by default) *   mp_smokegren_mode 0/1    sets if smoke grenade limits are team or player based (0 = team, 1 = player) *   mp_smokegren_limit 2      sets how many grenades each player or team gets per round (default 2) *   mp_smokegren_atonce 2    how many smoke grenades can be on-screen at once per team (default is 2) *   mp_smokegren_delay 18.0        delay in seconds after the end of the smoke before the user can throw another * *   Commands: *   amx_smoke <nick|id>        Allow player to use smoke grenades (doesnt overide cvar limits) *   amx_nosmoke <nick|id>    Prevents player from using smoke grenades (regardless of cvar limits)     amx_smokereset      Rests the plugin if you find problems with some teams not having them     amd_smokedebug      Displays debug info for the grenades (counter status, etc) *    *   Class limits for smoke greandes: *   You can set class limits on what sort of classes can use smoke grenades in a similar way to how *   class limits are set in DoD. Rather than limiting by each weapon the classes are grouped into *   'roles' and limts are set on these. For example, rifles and carbines are one 'role', SMGs another, etc. * *   Each class has a number associated with it. To enable smoke for those classes add together the numbers for *   the classes you want and set mp_smokegren_axis_classes or mp_smokegren_allies_classes to that number. *    *   Class numbers as as follows for all teams: * *   Riflemen   1  (Rifles and carbines) *   Snipers        2   (Sniper rifles - duh!) *   SMGs      4  (Sub-Machine guns, e.g. Sten, MP40, Thompson, Greasegun) *   LMGs      8  (Bren, Bar, MP44, FG42 - MP44 and FG42 are here because of their calibre and power) *   MGs        16  (.30cal, MG34, MG42) *   AT Weapons 32   (PIAT, Panzershrek, Bazooka) * *   So, for example of you want smoke grenades for the Axis for Riflemen, SMGs and LMGs use 1+4+8 = 13 so set *   mp_smokegren_axis_classes to 13. Easy huh? To enable it for all classes use 1+2+4+8+16+32 = 63. * *   To disable smoke grenades for an entire team set the value to 0. *    *   Usage: *   Bind a key to "throw_smoke" to throw a smoke grenade * *   Requirements: *   For AMX Mod X you'll need the fun and engine modules installed.        */
Attached Files
File Type: sma Get Plugin or Get Source (smoke_grenade.sma - 3367 views - 22.3 KB)
Trp. Jed is offline
EKS
Veteran Member
Join Date: Mar 2004
Location: Norway
Old 10-10-2004 , 11:20  
Reply With Quote #2

I remember i tried to do this, but failed (But i tried via the particle engine ).

I noticed that you include #include <Vexd_Utilities> , Thats not needed when you have #include <engine>.

Would be very cool with a screenshot of the plugin in action
EKS is offline
speedy
Member
Join Date: Aug 2004
Old 10-10-2004 , 12:05  
Reply With Quote #3

Very good plugin im getting a probelm though that im only able to throw one grenade then it comes up with :-

[SMOKE: You can't throw another grenade for -443 seconds]

And the seconds just keep counting.
speedy is offline
Trp. Jed
Member
Join Date: Aug 2004
Old 10-10-2004 , 12:05  
Reply With Quote #4

OK. I took the VexD reference out (or commented it out).

I also just noticed a strange bug where sometimes on a map change the variable that holds how many grenades the axis has thrown is some insanely large number and not 0. I've tried to trap it but not 100% sure if I've got it.

Until I can sort it precisely I've added and amx_smokereset command to re-init everything should anything go wrong.
Trp. Jed is offline
Trp. Jed
Member
Join Date: Aug 2004
Old 10-10-2004 , 12:06  
Reply With Quote #5

Quote:
Originally Posted by speedy
Very good plugin im getting a probelm though that im only able to throw one grenade then it comes up with :-

[SMOKE: You can't throw another grenade for -443 seconds]

And the seconds just keep counting.
LOL. yeah, I just noticed this too. Sod's law - works fine up to the point you upload it. I'm looking through it now because I just had the same myself.
Trp. Jed is offline
darkdog
Junior Member
Join Date: May 2004
Old 10-10-2004 , 12:51  
Reply With Quote #6

Also..Does the smoke sound ever stop?and people who have cl_particlefx 0 dont see it :\
darkdog is offline
Send a message via AIM to darkdog
Trp. Jed
Member
Join Date: Aug 2004
Old 10-10-2004 , 13:00  
Reply With Quote #7

Errr it should stop. It is set to stop after the grenade finishes burning and yes, cl_particlefx doesnt effect it.
Trp. Jed is offline
speedy
Member
Join Date: Aug 2004
Old 10-10-2004 , 13:04  
Reply With Quote #8

Cool Jed that was quick cant wait for update now.
speedy is offline
SidLuke
Senior Member
Join Date: Mar 2004
Location: Poland, Chrzanow
Old 10-10-2004 , 13:43  
Reply With Quote #9

// DoD weapon constatnts - borrowed from DODX

Weapons ids > 32 may be different in DoDX and DoD mod because they are not really id's but sprite indexes. I'm detecting those weapons in my own way so you should better recheck them.
__________________
Looking for DoD plugins ? Check DoD Plugins Center
SidLuke is offline
Send a message via AIM to SidLuke Send a message via MSN to SidLuke
Trp. Jed
Member
Join Date: Aug 2004
Old 10-10-2004 , 13:55  
Reply With Quote #10

Ah ok. Luke, Thanks. i'll run through them all and check.
Trp. Jed is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode