Jump to content

Recommended Posts


shot1v.jpg
* FOR OFP / CWA *
DOWNLOAD v1.2.1: http://www.mediafire.com/download.php?7v5rc5rappo4rtg
The linked file includes a template and a demo mission.

 

The goal of this script pack is to provide an addon-free and easy to use way of including suppressive fire in user missions.

Every time a shot is fired the position of the bullet will be checked at given intervals, until it disappears or impacts. If the bullet comes close enough to a unit the suppression level of that unit will raise. If the suppression level is high enough that unit will either have their fire rate reduced or immediately lay down and stop doing anything. Only the most skilled ones will have a chance to keep crawling or keep firing.

In addition to this, units detecting an incoming grenade will try to run away from it.

FEATURES

  • Every single bullet is checked for suppression
  • Two levels of suppression: moderate and full
  • Suppressed units will fire at a considerable reduced rate
  • Fully suppressed units are forced to lay down
  • Only very skilled units will have a chance to return fire and/or move when fully suppressed
  • Units will try to run away from incoming grenades, if they detect them
  • While any weapon can suppress, MGs, LMGs and sniper rifles have a bigger suppression effect
  • Secondary weapons won't suppress
  • Specific units can be excluded from being suppressed, including players
  • Vehicles and their crews are unaffected by suppression, but can inflict it
  • Killing or damaging an enemy unit will raise the suppresion levels of its nearby allies
  • Works both in SP and MP
  • (optional) Very skilled units may have a chance of skipping suppression altogether (for that given bullet)
  • (optional) Fleeing units can be automatically excluded from suppression (you might want to use this for compatibility with some missions)


 

INSTRUCTIONS
In order to use kSuppression in your mission follow these steps:


  • Merge the template mission into yours.
  • Copy all the folders and files in the template mission to that of your mission
    • If you plan to only use this for single player you can skip the CoC NS 2 ones. So you could just copy: kSupp, kScustom and ofp_scriptlib
    • If you have your own "stringtable.csv" copy/paste its contents to the end of your own.
  • Adjust the options to your liking in the "kSupp_settings.sqf" file
  • Add this line to the init of any empty vehicle (that includes static machine guns): [this] exec "kSupp\prepEmptyVeh.sqs"

Advanced:


Changing the array used to check all units
By default kSuppression uses the array created by a trigger that lists all the units present on the map. Alternatively, you can use your own array of units to be checked for suppression. Just make sure that array contains units, not groups, and remember to update the corresponding setting in kSupp_settings.sqf.

For WGL you can safely delete the allUnits trigger in the editor and use the built-in "wgl_units" array instead.

Adding weapon classes from and addon or mod
You can use the _wCl var in the settings to specify the mods/addons you use in your mission. That will load the definitions for MG, LMG and sniper rifles classes used by them. _wCl is an array, so you can load several definitions at once (like: ["WGL","OEF"] or ["WW4","LSR","ORCS"], etc). Check kScustom\wpClasses.txt for a list of supported addons.

Adding your own weapon definitions
You can also add your own custom classes by editing the "CUSTOM" conditional block in the kScustom\wpClasses.sqf file, and then change _wCl to "CUSTOM" to load it. Just remember that there's no need to add any other weapon classes but those of MGs, LMGs and sniper rifles.

Excluding new units from suppression once the mission has already started
You can add new units to the exclusion array using this format: kSupp set [ 1, (kSupp select 1) + <array of units> ]

Examples:

  • To exclude a single unit from a script where the unit is stored in a var named _unit: kSupp set [ 1, (kSupp select 1) + [_unit] ]
  • To exclude the whole group of _unit: kSupp set [ 1, (kSupp select 1) + (units group _unit) ]

 


Removing units from excluded array
Use this format: kSupp set [ 1, (kSupp select 1) - <array of units> ]

Examples:

  • Single unit (referenced as _unit): kSupp set [ 1, (kSupp select 1) - [_unit] ]
  • Group: kSupp set [ 1, (kSupp select 1) - (units group _unit) ]

 



NOTES

  • Only MGs, LMGs and sniper rifles have a reliable suppression effect. Suppressing with ARs or pistols will require significantly more effort
  • This pack only uses a single global variable, and a few others for functions, etc, so it shouldn't cause any savegame bug
  • CoC NS 2 is only used if the mission is detected to be played in MP. In that environment this whole system won't start working until CoC NS 2 loads properly and the suppression scripts are initialized. For SP this wait will be significantly shorter, as CoC NS 2 won't be used.

KNOWN ISSUES

  • Sometimes units are caught between bullet position checks and aren't suppressed. That also applies to those near to bullet impact points.
  • Empty vehicles will be assigned the fired EH twice if manned before being registered in the kSupp array
  • Suppressive fire affects units of all sides but those belonging to the one of the suppressing unit. So, in situations where two sides are fighting together they may end up suppressing each other.


CHANGELOG


v1.2.1

CoC UA, ECP, SLX/GL3 and DTV compatibility and hand grenade definitions



Fix: Solved incompatibility when the script version of CoC NS2 is used in a mission that uses CoC UA

Fix: First bullet was not being counted for suppression. That included both single shots and grenades

Change: Now you don’t need (you shouldn’t in fact) place a game logic and name it CoC_Server anymore. kSupp will automatically create it if it doesn’t detect it. This is to prevent the conflicts with CoC UA mentioned earlier

Change: You can also now define your own hand grenade classes. Definitions in wpClasses.sqf updated accordingly

Change: Scripts for register and clear group entries to the global array moved to kShared

Change: Particle color (_clr) checks moved out of the loop in kSupp\suppression.sqs

Change: unitPos only changed to “down†for fully suppressed units

Change: Functions renamed to prevent confusion with the built-in CoC NS2 ones

New: New global var that checks if DTV (and any other future related project) is running, and if so they’ll share some scripts to reduce CPU and memory usage

New: If DTV is used in the mission suppressing and suppressed units will say relevant phrases when applying or being under suppression.

New: kSuppression will deactivate if the player is running ECP or SLX/GL3, as they have their own suppressive fire system





v1.2

Suppression levels, suppression on hit and kill, support for rapid fire and general cleaning



Fix: Units weren't reverting the "stopped" status back to normal after suppression

Fix: Host players unable to be suppressed by other players

Fix: Empty vehicles (mounted later) not suppressing in MP

Fix: Players being assigned EHs twice if respawned without belonging to a group

Change: CoC NS 2 initialization moved to kSupp\start.sqs

Change: CoC NS 2 custom functions now only loaded if playing in MP

Change: Fire EH pause control changed. Now it's only paused for 1s after 2s of shooting, allowing rapid fire and bursts to be checked while not losing too much performance

Change: Suppression now tied to skill level of suppressed unit (lower skill = longer suppression and less shots needed to be suppressed).

Change: Civilian side not excluded anymore by default in the settings

New: Suppression levels (moderate and full), raised by each close bullet. Units only suppressed when supp lvl reaches a given point, tied to skill of unit (higher skill = harder to suppress)

New: kSuppStarter logic used now to initialize kSuppression. Init file no longer required

New: Hitting and killing enemy units will raise suppression level of nearby enemies

Removed: Calls to fu\SPcheck.sqf. The "fu" directory in the root of the mission dir isn't needed anymore

Removed: Use of CoC_ClientsReady global var in SP mode

Removed: Settings for duration in settings file

Other: Cleaned and streamlined some scripts





v1.1

Overall performance should be enhanced or at least maintained, while offering more precise suppression in most cases



Fix: Excluded sides now work properly

Fix: camDestroy changed to deleteVehicle in the check for WGL grenades

Fix: Units behind the suppressing unit shouldn't be suppressed anymore

Change: EH pauses reduced from 1 second to 0.5, so now rapid fire is more viable for suppression

Change: Suppression distance and duration reduced in default settings

Change: _debug var now stored in global array (kSupp select 8)

Change: Suppression script for grenades now separated

Change: Logic side automatically excluded

Change: Original OFP weapon classes for MGs and sniper rifles automatically added to weapon class arrays

New: New method to load custom weapon classes. Should be simpler and more flexible

New: Speed of bullet position checks now automatically adjusted to the amount of units to check (less units = faster checks, more = slower checks)

New: Option to set maximum distance a unit has to be to be suppressed

New: Option to stop checks after bullet flies for a given amount of time

New: Custom prepgroup.sqs available to add anything you want to the kSupp groups

New: kSupp ready var (kSupp select 9)





v1.0

Initial release


CREDITS

 

  • Chain of Command team (for CoC NS 2, probably the best system for server/client synching)
  • Vektorboson (for ofp_scriptlib, a varied, lighteweight and generally awesome pack of functions)
  • Igor Drukov and his bro (for getrelpos.sqf)
  • Drongo69 (for the script to register groups, and for support and inspiration in general)
  • TPWC AI suppression system (the idea to use balls over units for debugging and different suppression levels comes from there)
  • ECP (for using an array to store global values without creating SP savegame crash)
  • SLX (for the simple yet effective way to detect null vars and general inspiration on suppression)

Have in mind that those are the ones I've kept track of and/or remember. It's more than likely many others that should be credited here. If you feel that you or someone else should be added just let me know and I'll update the credits accordingly.

DOWNLOAD v1.2.1:
- http://www.mediafire.com/download.php?7v5rc5rappo4rtg

Older versions:

Edited by kenoxite
Updated to 1.2.1

Share this post


Link to post
Share on other sites

Good to hear that :)

Also, let me know if you find any bug or broken functionality.

Share this post


Link to post
Share on other sites
I bet this script would be really nice with the ai modes on the lsr mg's......

Yes, it actually works pretty well. Units spend way less ammo for the same suppression effect.

You have made me realize that the extra settings I've included for this script pack should be expanded. So, I've added more predefined configs in the "_extra_settings" dir. It now includes:

  • WW4
  • WGL
  • Laser Weapons pack
  • Russian Weapons Pack (ORCS)
  • LSR+RFWP (those two above combined)
  • JAM
  • OEF+WGL
  • Lost Brothers
  • Tonal
  • PLA
  • VTE
  • SEB
  • UKF
  • OFrP
  • FFAA+Finul

DOWNLOAD extra settings: http://www.mediafire.com/download.php?v5ovaejot5vn48e

I've also noticed there's a couple errors in the pack. They're quite minor and shouldn't affect any functionality, so I'll wait a bit before releasing a new version.

Share this post


Link to post
Share on other sites

I've updated kSuppression to version 1.1.

Check the "NOTES ABOUT VERSION 1.1" and the "CHANGELOG" section in the first post for more info about what's new and other stuff you should be aware of.

This version contains a couple relatively minor bugs in MP. This should be fixed in the next version.

As I have the impression that his will script pack will be used mainly for SP I've decided to not delay the release any longer.

As always, if you find any bug or weird behaviour, or you have any suggestion, please, go ahead and let me know.

NOTES ABOUT VERSION 1.1

Overall performance should be enhanced or at least maintained, while offering more precise suppression in most cases.

The way to add new weapon classes has been simplified.

All the definitions are now stored in kScustom\wpClasses.sqf. You just need to change the _wCl var in kSupp_Settings.sqf and specify the name of the mods or addons you use in your mission. The list of possible values can be found in kScustom\wpClasses.txt. You can also add your custom weapon classes by editing the "CUSTOM" entry in kScustom\wpClasses.sqf.

You can now safely delete the "_extra_settings" directory.

You can also add anything to the init of the kSuppression groups by editing the kScustom\PrepGroup.sqs script.

If you want to upgrade from the previous version is better to delete the old kSupp (and _extra_settings) directory before. While it's not actually needed this way you'll make sure you don't have unused scripts around which would only make the size of the pboed mission bigger.

Edited by kenoxite
added "NOTES ABOUT VERSION 1.1"

Share this post


Link to post
Share on other sites

I just noticed there's an error in suppression.sqs, where the units are stopped and not reenabled again. I'm afraid that was due to some careless copy/pasting when I was moving the stopped block around.

You can fix it by finding this line:

?((random 1) > (_sk/1.2)): _u stop true

and moving it below this:

?(stopped _u): _st = true

So it would look like this:

; Chance to stop unit
_st = false
?(stopped _u): _st = true
?((random 1) > (_sk/1.2)): _u stop true

Alternativelly, you can just copy this corrected version of suppression.sqs and paste it over your own:

; SUPPRESSION

; PREFERENCES
_sett = [2] call loadfile "kSupp_settings.sqf"
; Percentage of the skill of the unit to use to calculate if unit manages to not be affected by suppression
; Set to 0 to make all units being able to be suppressed, no matter the skill
_skP = _sett select 0
; Duration of the suppression effect on the unit (in seconds)
_d = _sett select 1
; Duration of the suppression effect on the unit when suppressed by MGs
_mgD = _sett select 2
; Duration of the suppression effect on the unit when suppressed by a sniper rifle (in seconds)
_snD = _sett select 3
; Show particle above unit when suppressed. For debugging
_debug = kSupp select 8
; --

_sU = _this select 0
_u = _this select 1
_mg = _this select 2
_sn = _this select 3

?(_mg): _d = _mgD
?(_sn): _d = _snD

_null=format["%1",_nullstring];

?(_u in (kSupp select 0)): exit

; Chance of avoid being suppressed altogether if unit skill is high enough and lucky
_sk = skill _u
_p = (_sk*(_skP /100))
?(_p > 0): if ((random 1) <= (_sk/_p)) then { exit }


kSupp set [ 0, (kSupp select 0) + [_u] ]

?(_debug): player sidechat format ["%1 SUPPRESSING: %2, skill: %3",name _sU,_u, skill _u]

; Chance of detecting suppressor if not known yet
?((random 1) <= (_sk/1.2)): _u reveal _sU

; Lower skill
_u setSkill (_sk - 0.5)


; Force laying down
_anim = "Lying"
?((primaryWeapon _u) != ""): _u selectWeapon (primaryWeapon _u)
?(SP): _u playmove _anim
?(!SP): [[_u,_anim],"fNplayAnim","NO_NQ"] call fNSendAll

; Chance to stop unit
_st = false
?(stopped _u): _st = true
?((random 1) > (_sk/1.2)): _u stop true


; Keep suppressed for duration
_pos = getPos _u
_c = 0
_t = 1
#loop
_u setUnitPos "DOWN"
; Show particle effect
?(_debug): drop ["cl_fire", "", "Billboard", 6, _t, [0,0,2], [0,0,0], 0, 1.275, 1, 0, [0.4],[[1, 0.7, 0, 1]],[0],0,0,"","",_u]
_c = _c + _t
~_t
?(_c < _d and alive _u): goto "loop"

; Unit unsupressed
_u setSkill _sk
?(!_st): _u stop false
_u setUnitPos "AUTO"

kSupp set [ 0, (kSupp select 0) - [_u] ]

?(_debug): player sidechat format ["%1 #NOT# SUPPRESSING: %2, skill: %3, alive? %4",name _sU,_u, skill _u, alive _u]

; Set behaviour of unit to combat if it wasn't yet
?(behaviour _u != "COMBAT" or behaviour _u != "STEALTH"): _u setBehaviour "COMBAT"

exit

I'm going to update kSuppression pretty soon. That version fixes this, and also adds a couple new features that I'm testing right now.

Namely, the addition of suppression levels and the ability of a killed unit to raise the suppression levels of its close allies.

The former changes the suppression dynamics quite a lot. All units now will have a built-in suppression level that raises each time a bullet passes close (mgs and sniper rifle bullets raise it more). When it's beyond half total suppression the unit will be in a "moderate" suppression level, where only its fire rate will be affected. Those with suppression level at max will be in "total" suppression, where the effects you already know will be working (unit lies down, etc).

I was hesitant until now to use that because of the potential performance impact. It turns out that it does indeed affect performance but not to the degree I imagined, so so far this will go into v1.2.

Edited by kenoxite
kSupp_setttings.sqf -> kSupp_settings.sqf

Share this post


Link to post
Share on other sites

kSuppression is updated to v1.2

This version introduces the concept of suppression levels, the ability to suppress nearby units after a kill or a hit and some changes to wait.sqs which should allow the use of rapid fire for suppression. It also fixes the MP bugs mentioned earlier.

Compared to 1.1 it performs a bit worse, but it's the price to pay for allowing rapid fire. Now it will wait for two seconds after the first shot before pausing the checks. Then one second of pause and start again. In two seconds you (or any other unit) has time to fire two bursts or make a quite generous sweep with an MG. This also means that for many units almost every shot will be checked, and hence the hit on performance. Also, the new check in suppression.sqs to retrieve and update the suppression level of the unit contributes to all this. If you feel like the performance hit is too high let me know.

The suppression levels make suppressing a bit harder now. A single bullet close enough won't necessarily suppress a unit immediately. Now every time a bullet comes close to a unit its suppression level gets higher (MGs and sniper rifles raise this level faster). Only when this level reaches a given limit the unit is considered suppressed, and in most cases will only raise to "moderate" suppression, not "full". This limit is automatically tied to the skill of the unit (80% used), so poorly skilled units will be easier to suppress and for longer periods, but suppressing an "ace" will require a lot of effort. For instance, a unit with a skill of 1 (such as a player) will need a suppression level of 8 and will be suppressed for 2 seconds tops.

Apart from that, I've moved some stuff around and removed some. For instance, the fu directory isn't needed anymore (the one in the root, not the one inside kSupp). The init.sqs isn't needed either, unless you have one for your own purposes. The stuff from the init has been moved to kSupp\start.sqs, and kSuppression is now started by a logic in the map editor (which is deleted as soon as ksupp starts). If you want to upgrade to this version this means two things:

- You'll have to copy, merge or recreate the new kSuppStarter logic.

- You really need to delete all the stuff from your init.sqs related to kSuppression (or some weird things might happen)

On the bright side, now including kSuppression in a mission should be way easier. The only thing you'd need to edit is the _wCl var in kSupp_settings.sqf, and only if you use some addon or mod with custom MGs or sniper rifles.

Also, the ball particles shown in debug mode will now display three different colors: yellowish for moderately suppressed units (reduced fire rate), red for fully suppressed (lie down and stopped) and green for fully suppressed but skilled enough to be able to move and shoot (at a reduced rate).

It's probable that I'm forgetting something else to mention. Make sure you read the changelog in the first post for more info.

This will probably be the last version of kSuppression. Any further versions would focus on polishing some aspects and fixing any remaining bugs, and not on including new features.

Share this post


Link to post
Share on other sites

I saw this for the first time, today - thanks for putting it out!

Share this post


Link to post
Share on other sites

You're welcome.

kSupression updated to 1.2.1. Includes new features, changes and fixes. Here's the changelog:

v1.2.1

CoC UA, ECP, SLX/GL3 and DTV compatibility and hand grenade definitions

  • Fix: Solved incompatibility when the script version of CoC NS2 is used in a mission that uses CoC UA
  • Fix: First bullet was not being counted for suppression. That included both single shots and grenades
  • Change: Now you don’t need (you shouldn’t in fact) place a game logic and name it CoC_Server anymore. kSupp will automatically create it if it doesn’t detect it. This is to prevent the conflicts with CoC UA mentioned earlier
  • Change: You can also now define your own hand grenade classes. Definitions in wpClasses.sqf updated accordingly
  • Change: Scripts for register and clear group entries to the global array moved to kShared
  • Change: Particle color (_clr) checks moved out of the loop in kSupp\suppression.sqs
  • Change: unitPos only changed to “down†for fully suppressed units
  • Change: Functions renamed to prevent confusion with the built-in CoC NS2 ones
  • New: New global var that checks if DTV (and any other future related project) is running, and if so they’ll share some scripts to reduce CPU and memory usage
  • New: If DTV is used in the mission suppressing and suppressed units will say relevant phrases when applying or being under suppression.
  • New: kSuppression will deactivate if the player is running ECP or SLX/GL3, as they have their own suppressive fire system

Updated download link in the first post.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×