Jump to content
prototype1479

AI iimprovement script (v1.3) AI take cover and swimming script

Recommended Posts

Take cover script

 

 

Features of TC (Take Cover) script :

 

1) AI can dynamically take cover behind 3 different types of sandbags and 2 wreck jeeps

 

2) Not only that they can take cover inside houses too

 

3) The nearby enemy position is calculated and defenders will take cover on positions that fits right for them (For example if AI is taking cover in a house then they will take cover behind the nearest window to the enemy position)

 

4) There is also the assaulters they behave differently. They either push/flank or take cover using bushes by setting them on "RED" combat mode (Depending on the situation)

 

5) AI can be suppressed - just shoot somewhere near AI and they will go prone (If they are taking cover)

 

Instructions are inside TC_Init.sqs there is also more in-depth info there

 

Features of SW (Swimming script) and how it works :

 

The main feature of SW is that you literally swim but there is few conditions - the unit must be in prone and must be slightly above sea level

 

You will swim up if you fell into the water

 

The way the script works is that a pallet spawns under you and that keeps you from falling

 

The file : https://bit.ly/2FZJwps

 

Oh also there is 1 more feature on take cover script that AI sends info about enemy positions time to time

 

There is something on OFP that bothers me when there is a nearby group that is getting killed the other nearby group doesn't notice that but that feature fixed that

 

NEW UPDATE! 

 

-Script is slightly more optimized

 

-When the AI died and spawned again the AI didn't had the effects of the script but now it does

 

-I think I might have fixed a bug where the game freezes completely it doesn't even crash if you see it happen then post here so we can fix it I'm still not sure if this is the fix though

 

-I improved revive script too now when a unit dies the body bag spawns right at their location and also they automatically follow their leader after they revived (I'm not taking credit for the work though I already credited them inside the missions briefing)

 

-The test mission had some bugs itself like to some players in MP , the objective didn't progress to them

 

Now in future updates I might improve the system of take cover script right now the script controls the units per script but in future I might do it groups per script it increases the optimization and fixes some things that I wanted to fix

 

And also  after all of these I'm going to make a mod for this so people who want to play with this wouldn't waste their time trying execute the script for each soldier

 

It's the same link as previous one but I thought I should still put one in this post too

 

Cya

  • Like 4

Share this post


Link to post
Share on other sites

NEW UPDATE! (Again)

 

-Script is even more optimized than before - one of the scripts checks your FPS and if your FPS is doing bad it will increase the delays depending on how well/bad your FPS did

 

-The bug where the game completely freezes is now completely gone (Probably. Well I at least fix the one that caused it)

 

-The AI didn't send info's correctly to the other groups but that's fixed now

 

-Delay for suppressing the AI is now decreased a little now they react quicker to it

 

-And some other minor fixes

 

Next Time I will probably make a mod out of this so others don't have to manually execute the script for each soldier

 

So here is the file : https://bit.ly/2FZJwps

 

It's the same link as previous one but I thought I should still put one in this post too

 

(It's Swim and Cover v2.01 now btw)

  • Like 1

Share this post


Link to post
Share on other sites

Very nice! If you're still working on this, I'd be definitely interested in a mod version as well. :)

  • Like 1

Share this post


Link to post
Share on other sites

I'm working on the mod it will come with my own campaign and with AI take cover v1.4 and with some of my own scripts

 

Here's the feaures:

 

1) AI can only take cover in houses (behind windows , on top of towers and ect.) jeepwrecks and sandbags (100% done)

2) AI sends info to other groups they know about locations of the enemy positions (100% done)

3) AI will hold fire and seek cover first if they see an unknown target and if the unknown target hasn't seen them (50% done)

4) AI can be supressed by other AI and by the player too and it will make them go prone (Redoing this 10% done)

5) AI won't take cover if the AI isn't following the leader or the player is their leader (Almost done)

6) AI groups can get pressured/pinned down if they are outnumbered and they will take cover more often rather than moving to their next waypoint (0% done)

7) AI won't be affected by the script in cutscenes and this will ensure that cutscenes are in the way they are meant to be (100% done)

 

In the future I might add AI taking cover on hedges/hills/ground

 

Now i use optimized structure for finding cover and the script will automatically optimize itself by increasing the delays depending on how any AI is on the mission

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
Quote

4) AI can be supressed by other AI and by the player too and it will make them go prone (Redoing this 10% done)

 

I remember in SLX being suppressed by enemy fire made missions unplayable as you were constantly forced to the ground.

  • Like 2

Share this post


Link to post
Share on other sites

Well mine is going to be completely different

 

PS: I didn't liked that part of SLX especially the part where you drop the gun on your hand randomly

Share this post


Link to post
Share on other sites
On 13. 1. 2019 at 8:17 AM, prototype1479 said:

I'm working on the mod it will come with my own campaign and with AI take cover v1.4 and with some of my own scripts

 

Here's the feaures:

 

1) AI can only take cover in houses (behind windows , on top of towers and ect.) jeepwrecks and sandbags (100% done)

2) AI sends info to other groups they know about locations of the enemy positions (100% done)

3) AI will hold fire and seek cover first if they see an unknown target and if the unknown target hasn't seen them (50% done)

4) AI can be supressed by other AI and by the player too and it will make them go prone (Redoing this 10% done)

5) AI won't take cover if the AI isn't following the leader or the player is their leader (Almost done)

6) AI groups can get pressured/pinned down if they are outnumbered and they will take cover more often rather than moving to their next waypoint (0% done)

7) AI won't be affected by the script in cutscenes and this will ensure that cutscenes are in the way they are meant to be (100% done)

 

In the future I might add AI taking cover on hedges/hills/ground

 

Now i use optimized structure for finding cover and the script will automatically optimize itself by increasing the delays depending on how any AI is on the mission

 

 

Sounds stellar. Cannot wait.

 

How compatible will it be with other mods? Say, if I wanted to use Extended Effects alongside your mod, will it work from get go or will it need some kind of compatibility/merged config.cpp?

Share this post


Link to post
Share on other sites
On 1/13/2019 at 10:17 AM, prototype1479 said:

Here's the feaures:

 

Nice but I remember there were similar features in SLX mod.

 

About AI taking cover in buildings I'd suggest replacing "lying" animation with crouching so that would look natural

 

 

 

Share this post


Link to post
Share on other sites

Lying? does it lie all the time? And yeah they should be crouching most of the time

 

This is an outdated version anyways in 1.4 there will be drastic changes (I'm also having issues with life so it will come out later than I plan all the time)

Share this post


Link to post
Share on other sites

Vanilla AI mechanic is that soldiers hit the ground all the time. It's realistic but not fun.

Share this post


Link to post
Share on other sites

If you want vanilla AI to not hit the ground all the time then put this on units INIT field : this setunitpos "UP"

Share this post


Link to post
Share on other sites

WOW! Did not expect to see some 1 still doing A.I. improvements for OFP!

 

Always happy to use / test some new A.I. stuff! Thanks! 🙂

Share this post


Link to post
Share on other sites

I'm still up on the project with the mod. I'm currently trying to fix AI pathfinding in houses.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

I have some scripts you might be interested in. 

 

A Script to have a truck driver get out of his truck whenever  he reaches "COMBAT" behavior and then return to his truck when no longer threatened. I made that script initially for cavalry.

Several scripts for stop and fire for tanks. So they stop the annoyingly beyond unrealistic rush into your face behavior.

I have a melee combat script. I was going to elaborate further on it, but just never got around to it. The melee combat can be seen in OFPWH40K and Pacific Mods.

 

You're welcome to them if you want them.

  • Like 3

Share this post


Link to post
Share on other sites

1) That's a good idea but problem with that is missions might not be designed that way. Because:

    - Mission might need the truck to have the driver inside.
    - If the AI gets out of the truck via the mods script the missions scripts will not know if the AI got out by mods or missions script.
So best way to use this script would be with the script implemented in the mission not in the mod.

 

2) I was going to make a script with similar idea where the entire group stops to engage the enemy for a bit then move on for a bit and do it again and again until it reaches the waypoint. But I ended scratching that idea because if some unrelated script uses "move" command then the group wont be able to follow that "move" command later on because doFollow command only works for waypoints.

 

3) Melee combat script for AI? I don't know how melee combat scripts work in either of these mods.


Also the mods scripts are done so it's coming up soon I'm just making missions thats designed around the design ideologies that I made for the mod. It's definitely going to take a while.

Share this post


Link to post
Share on other sites

For move - create a gamelogic that disables script.

I'll plug these in use or not up to you.

 

Halt and fire script:

 

;Tank stops then shoots and waits 20 seconds then scoots
;[vehicle this] exec "halt_and_fire.sqs";
_tank=_this select 0

#start
?!alive _tank:exit
?behaviour _tank == "COMBAT":_tank setfuel 0
~20
_tank setfuel 1
~10
goto "start"

 

This for the truck driver:

 

;[horse,rider] exec "horseride.sqs"

_ride=_this select 0
_rider=_this select 1

#dismount
?!alive _ride || !alive _rider: exit
?((behaviour _rider == "SAFE" || behaviour _rider == "CARELESS" )||(behaviour _rider == "STEALTH" || behaviour _rider == "ERROR")): goto "checkout"
?_rider in _ride && behaviour _rider == "COMBAT":[_rider] orderGetIn false,goto "checkstatus"
~2
goto "dismount"

#checkstatus
?!alive _ride || !alive _rider: exit
?fleeing _rider && !(_rider in _ride):goto "flee"
?((alive _ride && alive _rider) && (behaviour _rider == "AWARE")) : goto "timeout"
?((behaviour _rider == "SAFE" || behaviour _rider == "CARELESS" )||(behaviour _rider == "STEALTH" || behaviour _rider == "ERROR")): goto "checkout"
~10
goto "checkstatus"

#mount
?!alive _ride || !alive _rider: exit
?((_rider distance _ride>=150 && behaviour _rider != "COMBAT") || (behaviour _rider != "AWARE")):goto "timeout"
?((alive _ride && alive _rider) && (behaviour _rider == "COMBAT")):goto "dismount"
?((!(_rider in _ride) && behaviour _rider != "AWARE")):[_rider] orderGetIn true
~2
goto "mount"

#timeout
?!alive _ride || !alive _rider: exit
?fleeing _rider && !(_rider in _ride):goto "flee"
?((!(_rider in _ride) && behaviour _rider != "COMBAT")&& !(isEngineOn _ride)&&(speed _ride <=1 && _rider distance _ride>=150)):_ride setpos [getpos _ride select 0,getpos _ride select 1,(getpos _ride select 2)+2]
?((_rider != driver _ride && _rider distance _ride>=10)&&(behaviour _rider != "COMBAT")): _rider assignAsDriver _ride
?_rider in _ride && behaviour _rider == "COMBAT":goto "dismount"
?(!(_rider in _ride) && (behaviour _rider == "AWARE")) : goto "mount"
~10
goto "timeout"

#checkout
?!alive _ride || !alive _rider: exit
?fleeing _rider && !(_rider in _ride):goto "flee"
?(_rider distance _ride>=150 && _rider != driver _ride):_ride setpos [getpos _ride select 0,getpos _ride select 1,(getpos _ride select 2)+2],_rider assignAsDriver _ride,[_rider] orderGetIn true
?behaviour _rider == "AWARE" : goto "mount"
?behaviour _rider == "COMBAT":goto "dismount"
~5
goto "checkout"

#flee
?!alive _ride || !alive _rider: exit
?(_rider in _ride)||!(fleeing _rider):goto "checkout"
_rider doMove getPos _ride
~5
_rider assignAsDriver _ride
[_rider] orderGetIn true
goto "checkout"

;|| behaviour _rider == "SAFE" || behaviour _rider == "CARELESS" || behaviour _rider == "ERROR": goto "mount"  
;?((!(_rider in _ride) && behaviour _rider != "COMBAT")&&(speed _ride <= 1 && _rider distance _ride>=10)):_ride setpos [getpos _ride select 0,getpos _ride select 1,getpos _ride select 2]

 

 

Tank round deviate:

 

; bored_onion's RPG path deviation script

_typeofammo =["IOE25mmpanhard","IOE37mmshort","IOE37mmlong","IOE47SA35","IOE_PAK36AP","IOE_PAK36HE","IOE75SA35","IOE20mmKwK30AP","IOE20mmKwK30HE","IOEPz38tshell","IOEPz35tshell","IOEPz3tshell","IOE47mmtshell","IOE150mmtshell","IOE75mmtshell","IOE_47mmAP","IOE_25mmAP","IOE_60mmMortarAmmo","IOE_81mmMortarAmmo"]

_unit = _this select 0
_ammo = _this select 4 
_rocket = nearestobject [_unit,_ammo]

_type = typeof _rocket

_count = 0

_defectprobability = random 1

? _defectprobability >= defect: goto "end" 


? _type !in _typeofammo: hint "not ammo", goto "end" 

hint "is ammo"

_pm1 = 2
_pm2 = 2
_pm3 = 2

_xcheck = random 1
_ycheck = random 1
_zcheck = random 1

?_xcheck >= 0.5 : _pm1 = _pm1 * +1
?_xcheck < 0.5 : _pm1 = _pm1 * -1
?_ycheck >= 0.5 : _pm2 = _pm2 * +1
?_ycheck < 0.5 : _pm2 = _pm2 * -1
?_zcheck >= 0.5 : _pm3 = _pm3 * +1
?_zcheck < 0.5 : _pm3 = _pm3 * -1

#loop

? _count >= 100 : goto "end"

? _type != typeof _rocket : goto "end"

_rocket setvelocity [(velocity _rocket select 0) + random _pm1,(velocity _rocket select 1)+ random _pm2,(velocity _rocket select 2)+ random _pm3]

~0.001

_count = _count + 1

goto "loop"

#end


exit

;? _type != "IOE25mmpanhard" AND _type != "IOE37mmshort" AND _type != "IOE37mmlong" AND _type != "IOE37mmlong" AND _type != "IOE47SA35" AND _type != "IOE_PAK36AP" AND _type != "IOE_PAK36HE" AND _type != "IOE75SA35" AND _type != "IOE20mmKwK30AP": goto "end"
  

 

Share this post


Link to post
Share on other sites

I have ammo pouch script.  comes with sound and description.sqf

 

below is meant for mission not config.

 

You can add all your mods weapons and ammo and the script will detect what weapon you are using and automatically resupply the unit.

Meant for units on a long campaign.  You can drop weapon and pick up another weapon without losing ability to resupply as long as you had reloads left in script.

 

;//Ammobag Script made for WH40K MOD Ver. 3.5
;//Edited by WW2Weasel
;// 4 files required -  "getmag.sqf" & "ammopouch.sqs" & "description.ext" <needed to config & allow soundfile to work> & "rummagepouch.ogg" <in Sound folder>
;//This script will count and replenish primary weapon Mags for a unit. It will call a function to handle sorting out which <WH40K Mod> mags a player has.
;//This will keep player stocked with 3 mags until the player exhausts number of mag allowance in ammopouch...
;//[unit name,number of mags to put in ammo pouch script]exec "ammopouch.sqs" |  [unitname,10] exec "ammopouch.sqs";
;//Be sure to preprocessFile the Function - important as the function needs to be handled differently then a script...
;//Example: In <just need one trigger> put: getmag=preprocessFile "getmag.sqf"
;//Permission to modify granted... As long as you give some credit to WH40K mod.

_unit = _this select 0
_ammopouch = _this select 1
_ammopouch2 = _ammopouch / 2

#start
_mags={}
_mags2={}

?((_ammopouch==0)||(!alive _unit)):exit
_primary_weapon = primaryWeapon _unit
_secondary_weapon = secondaryweapon _unit
;_unit groupChat format ["%1",weapons _unit]
_weapons_unit = weapons _unit

_magcount = count magazines _unit
_magazines = magazines _unit

[_primary_weapon,_secondary_weapon,_unit]call getmag
~5
_totalMags=("_x == _mags" count magazines _unit)
?(((_plysund)&&(_totalMags <= 2 && _ammopouch >= 1))&&(_unit==player)):_unit groupChat "Rummaging in Ammopouch for spare Mag.",playSound "rummagepouch",_unit addMagazine _mags, _ammopouch = (_ammopouch - 1)
;_unit groupChat format ["%1",_mags]
~15
_plysund=true

?((secondaryWeapon _unit != "") && (_ammopouch2 > 0)) :goto "start2"
goto "start"

#start2
?_ammopouch2==0 || !alive _unit:goto "start"
_secondary_weapon = secondaryWeapon _unit
_magcount = count magazines _unit
_magazines = magazines _unit
["",_secondary_weapon]call getmag
~10
_totalMags2=("_x == _mags2" count magazines _unit)
?((_plysund &&(_totalMags2 <= 1 && _ammopouch2 >= 1))&&(_unit==player)):_unit groupChat "Rummaging in Ammopouch for spare Missile.",playSound "rummagepouch",_unit addMagazine _mags2, _ammopouch2 = (_ammopouch2 - 1)
goto "start"

;exit


;old working example

;?primaryWeapon eld2=="EldarShurikenCatapult" && count magazines eld2 <= 5 && eldammopouch2 >= 1:  
;eld2 addMagazine "EldarShurikenCatapultMag", eldammopouch2 = (eldammopouch2 - 1) 


;troubleshooting

;hint format ["%1",_mags]
;hint call format ["%1",_mags]
;hint "where are we at"
;_totalMags2=_magcount - _totalMags 
;hint format ["%1",_totalMags2]
;hint format ["%1",_magazines]
;secondaryWeapon player == ""

 

 

.sqf   the below is using WH40K weapons - change to your mod weapoms and magazines.

 

 

//Script Function made for WH40K MOD Ver. 3.5
//Edited by WW2Weasel
//This Function is used in Ammopouch script.  Below is all steps needed to implement this function within ammopouch.sqs ...
//This script will count and replenish primary weapon Mags for a unit. 
//This will keep player stocked with 3 mags until the player exhausts number of mag allowance in ammopouch...
//[unit name,number of mags to put in ammo pouch script]exec "ammopouch.sqs" |  [unitname,10] exec "ammopouch.sqs";
//Be sure to preprocessFile the Function - important as the function needs to be handled differently then a script...
//Example: In <just need one trigger> put: getmag=preprocessFile "getmag.sqf"
//Permission to modify granted... As long as you give some credit to WH40K mod.

_unitweapon=_this select 0;
_unitweapon2=_this select 1;
_unit=_this select 2;
if (_unitweapon=="") then {_unitweapon=weapons _unit select 0};
if (_unitweapon2=="") then {_unitweapon2=""};
//---------------------------------------------------------------------------------------------------------------
//////////////////////////////////////////////////////  Eldar  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//---------------------------------------------------------------------------------------------------------------
if (_unitweapon=="EldarShurikenCatapult") then {_mags={EldarShurikenCatapultMag}};
if (_unitweapon=="EldarSniperRifle") then {_mags={EldarSniperRifleMag}};
if (_unitweapon=="EldarReaperL") then {_mags={EldarReaperLMag}};
//---------------------------------------------------------------------------------------------------------------
//////////////////////////////////////////////////////  Dark Eldar  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//---------------------------------------------------------------------------------------------------------------
if (_unitweapon=="DEL_SplitRifle") then {_mags={DEL_SplitRifleMag}};
if (_unitweapon=="DEL_SplitCannon") then {_mags={DEL_SplitCannonMag}};
if (_unitweapon=="DEL_Punisher") then {_mags={DEL_SplitLanceMag}};
if (_unitweapon=="DEL_SplitPistol") then {_mags={DEL_SplitPistolMag}};
if (_unitweapon=="WH40K_SplinterRifle") then {_mags={WH40K_SplinterRifleMag}};
if (_unitweapon=="WH40K_SplinterCannon") then {_mags={WH40K_SplinterCannonMag}};
//---------------------------------------------------------------------------------------------------------------
//////////////////////////////////////////////////////  Bloodpact  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//---------------------------------------------------------------------------------------------------------------
if (_unitweapon=="WH40K_BPLasgun") then {_mags={WH40K_LasgunMag}};
if (_unitweapon=="WH40K_PlasmaGun") then {_mags={WH40K_PlasmaGunMag}};
if (_unitweapon=="WH40K_GrenadeLauncher") then {_mags={WH40K_GrenadeLauncher}};
if (_unitweapon=="WH40K_FlamerIG") then {_mags={WH40K_FlamerIG}};
if (_unitweapon2=="WH40K_IGrpg") then {_mags2={WH40K_IGrpgAT}};                         //secondary weapon
if (_unitweapon=="WH40K_Laspistol") then {_mags={WH40K_LaspistolMag}};
if (_unitweapon=="WH40K_Boltpistol") then {_mags={WH40K_BoltpistolMag}};
//---------------------------------------------------------------------------------------------------------------
//////////////////////////////////////////////////////  Chaos Cultists  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//---------------------------------------------------------------------------------------------------------------
if (_unitweapon=="WH40K_CultLaspistol") then {_mags={WH40K_CultLaspistolMag}};
if (_unitweapon=="WH40K_CultPlasmaGun") then {_mags={WH40K_CultPlasmaGunMag}};
if (_unitweapon=="WH40K_CultGrenadeLauncher") then {_mags={WH40K_CultGrenadeLauncher}};
//---------------------------------------------------------------------------------------------------------------
//////////////////////////////////////////////////////  Steel Legion  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//---------------------------------------------------------------------------------------------------------------
if (_unitweapon=="WH40K_SLPlasmaGun") then {_mags={WH40K_PlasmaGunMag}};
if (_unitweapon=="WH40K_SLGrenadeLauncher") then {_mags={WH40K_GrenadeLauncher}};
//---------------------------------------------------------------------------------------------------------------
//////////////////////////////////////////////////////  Chaos Space Marines  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//---------------------------------------------------------------------------------------------------------------
if (_unitweapon=="CSM_Boltgun") then {_mags={CSM_Boltgunmag}};
if (_unitweapon=="CSM_Boltpistol") then {_mags={CSM_Boltpistolmag}};
if (_unitweapon=="CSM_HBolter") then {_mags={CSM_HBoltermag}};
if (_unitweapon=="CSM_AutoC") then {_mags={CSM_APACmag}};
if (_unitweapon2=="CSM_MissileL") then {_mags2={CSM_KrakMmag}};                          //secondary weapon
if (_unitweapon=="CSM_PlasmaG") then {_mags={CSM_PlasmaGmag}};
if (_unitweapon=="CSM_MeltaG") then {_mags={CSM_MeltaGmag}};
if (_unitweapon=="CSM_LaserC") then {_mags={CSM_LaserCmag}};
if (_unitweapon=="CSM_Flamer") then {_mags={CSM_Flamermag}};
if (_unitweapon=="CSM_TBolt") then {_mags={CSM_TBoltmag}};
if (_unitweapon=="CSM_ReaperAC") then {_mags={CSM_ReaperACmag}};
if (_unitweapon=="CSM_TerFlamer") then {_mags={CSM_TerFlamermag}};
//---------------------------------------------------------------------------------------------------------------
//////////////////////////////////////////////////////  Space Marines  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//---------------------------------------------------------------------------------------------------------------
if (_unitweapon=="IF_Boltgun") then {_mags={IF_Boltgunmag}};
if (_unitweapon=="IF_BoltgunM") then {_mags={IF_Boltgunmag}};
if (_unitweapon=="IF_Plasmapistol") then {_mags={IF_Plasmapistolmag}};
if (_unitweapon=="IF_PlasmaC") then {_mags={IF_PlasmaCmag}};
if (_unitweapon=="IF_MMelta") then {_mags={IF_MMeltamag}};
if (_unitweapon=="IF_PlasmaG") then {_mags={IF_PlasmaGmag}};
if (_unitweapon=="IF_Flamer") then {_mags={IF_Flamermag}};
if (_unitweapon=="IF_MeltaG") then {_mags={IF_MeltaGmag}};
if (_unitweapon=="ICN_Bolter") then {_mags={ICN_Boltermag}};
if (_unitweapon=="IF_Boltpistol") then {_mags={IF_Boltpistolmag}};
if (_unitweapon=="IF_TerSBolt") then {_mags={IF_TerSBoltmag}};
if (_unitweapon=="IF_TerAssoC") then {_mags={IF_TerAssoCmag}};
if (_unitweapon=="IF_TerFlamer") then {_mags={IF_TerFlamermag}};
if (_unitweapon=="IF_Sniper") then {_mags={IF_Snipermag}};
if (_unitweapon=="IF_HbolterS") then {_mags={EldarReaperLMag}};
if (_unitweapon=="IF_Shotgun") then {_mags={IF_ShotgunMag}};
if (_unitweapon=="IF_BoltgunS") then {_mags={IF_Boltgunmag}};
if (_unitweapon=="IF_HBolter") then {_mags={IF_HBoltermag}};
if (_unitweapon=="BA_Boltgun") then {_mags={BA_Boltgunmag}};
if (_unitweapon=="BA_Boltpistol") then {_mags={BA_Boltpistolmag}};
if (_unitweapon=="BA_HBolter") then {_mags={IF_HBoltermag}};
if (_unitweapon2=="BA_MissileL") then {_mags2={IF_KrakMmag}};                         //secondary weapon
if (_unitweapon=="BA_PlasmaG") then {_mags={IF_PlasmaGmag}};
if (_unitweapon=="BA_PlasmaC") then {_mags={IF_PlasmaCmag}};
if (_unitweapon=="BA_MeltaG") then {_mags={IF_MeltaGmag}};
if (_unitweapon=="BA_MMelta") then {_mags={IF_MMeltamag}};
if (_unitweapon=="EldarReaperL") then {_mags={EldarReaperLMag}};
if (_unitweapon=="BA_LaserC") then {_mags={IF_LaserCmag}};
if (_unitweapon=="DC_Boltpistol") then {_mags={BA_Boltpistolmag}};
if (_unitweapon=="DC_Boltgun") then {_mags={BA_Boltgunmag}};
if (_unitweapon=="LM_Boltpistol") then {_mags={BA_Boltpistolmag}};
if (_unitweapon=="BA_BoltgunS") then {_mags={BA_Boltgunmag}};
if (_unitweapon=="BA_Shotgun") then {_mags={BA_ShotgunMag}};
if (_unitweapon=="BA_Sniper") then {_mags={IF_Snipermag}};
if (_unitweapon2=="BA_MissileLS") then {_mags2={IF_KrakMmag}};                         //secondary weapon
if (_unitweapon=="GSM_Sniper") then {_mags={GSM_Snipermag}};
if (_unitweapon=="BA_HBolterS") then {_mags={IF_HbolterSmag}};
if (_unitweapon=="BA_TychoGun") then {_mags={BCN_Boltermag}};
if (_unitweapon=="UM_Boltgun") then {_mags={UM_Boltgunmag}};
if (_unitweapon=="UM_BoltgunM") then {_mags={UM_Boltgunmag}};
if (_unitweapon=="UM_HBolter") then {_mags={UM_HBoltermag}};
if (_unitweapon2=="UM_MissileL") then {_mags2={UM_KrakMmag}};                         //secondary weapon
if (_unitweapon=="UM_PlasmaG") then {_mags={UM_PlasmaGmag}};
if (_unitweapon=="UM_PlasmaC") then {_mags={UM_PlasmaCmag}};
if (_unitweapon=="UM_MeltaG") then {_mags={UM_MeltaGmag}};
if (_unitweapon=="UM_MMelta") then {_mags={UM_MMeltamag}};
if (_unitweapon=="UM_LaserC") then {_mags={UM_LaserCmag}};
if (_unitweapon=="UM_Flamer") then {_mags={UM_Flamermag}};
if (_unitweapon=="UM_Boltpistol") then {_mags={UM_Boltpistolmag}};
if (_unitweapon=="UM_TerSBolt") then {_mags={UM_TerSBoltmag}};
if (_unitweapon=="UM_TerAssoC") then {_mags={UM_TerAssoCmag}};
if (_unitweapon=="UM_TerFlamer") then {_mags={UM_TerFlamermag}};
//---------------------------------------------------------------------------------------------------------------
//////////////////////////////////////////////////////  Orcs  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//---------------------------------------------------------------------------------------------------------------
if (_unitweapon=="WH40K_slugga") then {_mags={WH40K_sluggaMag}};
if (_unitweapon=="WH40K_Heavyshoota") then {_mags={WH40K_HeavyshootaMag}};
if (_unitweapon=="shoota") then {_mags={shoota_mag}};
if (_unitweapon=="orkburna") then {_mags={burna}};
if (_unitweapon=="rokkitlauncha") then {_mags2={rokkitlaunchaMag}};                         //secondary weapon
if (_unitweapon=="nobslugga") then {_mags={WH40K_sluggaMag}};
if (_unitweapon=="megashoota") then {_mags={megashoota_mag}};
if (_unitweapon=="GrotSlugga") then {_mags={GrotsluggaMag}};
//---------------------------------------------------------------------------------------------------------------
//////////////////////////////////////////////////////  IG  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//---------------------------------------------------------------------------------------------------------------
if (_unitweapon=="WH40K_TallarnLasgun") then {_mags={WH40K_LasgunMag}};
if (_unitweapon=="WH40K_TallarnSniperRifle") then {_mags={EldarReaperLMag}};
if (_unitweapon=="WH40K_Lasgun") then {_mags={WH40K_LasgunMag}};
if (_unitweapon=="WH40K_Autogun") then {_mags={WH40K_AutogunMag}};
if (_unitweapon=="WH40K_IGSniperRifle") then {_mags={WH40K_IGSniperRifleMag}};
if (_unitweapon=="WH40K_ExitusRifle") then {_mags={WH40K_ExitusRifleMag}};
if (_unitweapon=="WH40K_Exituspistol") then {_mags={WH40K_ExituspistolMag}};
if (_unitweapon=="WH40K_Hellgun") then {_mags={WH40K_HellgunMag}};
if (_unitweapon=="WH40K_KPlasmagun") then {_mags={WH40K_KPlasmagunMag}};
if (_unitweapon=="WH40K_KFlamerIG") then {_mags={WH40K_KFlamerIG}};
if (_unitweapon=="WH40K_Hellpistol") then {_mags={WH40K_HellgunMag}};
if (_unitweapon=="WH40K_RipperGun") then {_mags={WH40K_RipperGunMag}};
if (_unitweapon=="EL_Lasgun") then {_mags={EL_LasgunMag}};
if (_unitweapon=="EL_shotgun") then {_mags={EL_shotgunMag}};
if (_unitweapon=="EL_LasSnip") then {_mags={EL_LasSnipMag}};
if (_unitweapon=="EL_LasgunK") then {_mags={EL_LasgunMag}};
if (_unitweapon=="EL_LasPistol") then {_mags={EL_LasPistolMag}};
if (_unitweapon=="EL_GrenLauncher") then {_mags={EL_FragGLMag}};
if (_unitweapon2=="EL_MslLauncher") then {_mags2={EL_KrakMsl}};                        //secondary weapon
if (_unitweapon=="EL_HBolter") then {_mags={EL_HBolterMag}};
if (_unitweapon=="EL_Meltagun") then {_mags={EL_MeltagunMag}};
if (_unitweapon=="EL_Plasmagun") then {_mags={EL_PlasmagunMag}};
if (_unitweapon=="EL_Flamer") then {_mags={EL_FlamerMag}};
if (_unitweapon=="SL_Lasgun") then {_mags={SL_LasgunMag}};
if (_unitweapon=="SL_Lasgun2") then {_mags={SL_LasgunMag}};
if (_unitweapon=="SL_Flamer") then {_mags={SL_Flamer}};
if (_unitweapon=="SL_GrenLauncher") then {_mags={SL_GrenLauncher}};
if (_unitweapon=="SL_Plasmagun") then {_mags={SL_PlasmagunMag}};
if (_unitweapon=="SL_MeltaGun") then {_mags={SL_MeltaGun}};
if (_unitweapon=="SL_HBolter") then {_mags={SL_HBolterMag}};
//---------------------------------------------------------------------------------------------------------------
////////////////////////////////////////////////////// Sisters of Battle  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//---------------------------------------------------------------------------------------------------------------
if (_unitweapon=="WH40K_BSbolter") then {_mags={WH40K_BSbolterMag}};
if (_unitweapon=="WH40K_BSflamer") then {_mags={WH40K_BSflamer}};
if (_unitweapon=="WH40K_BSmeltagun") then {_mags={WH40K_BSmeltagunMag}};
if (_unitweapon=="WH40K_BSmultiMelta") then {_mags={WH40K_BSmultiMeltaMag}};
if (_unitweapon=="WH40K_BShwbolter") then {_mags={WH40K_BShwbolterMag}};
//---------------------------------------------------------------------------------------------------------------
////////////////////////////////////////////////////// Tau  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//---------------------------------------------------------------------------------------------------------------
if (_unitweapon=="Tau_PulseR") then {_mags={Tau_PulseRmag}};
if (_unitweapon=="Tau_PulseC") then {_mags={Tau_PulseCmag}};
if (_unitweapon=="Tau_PulseP") then {_mags={Tau_PulsePmag}};
if (_unitweapon=="Tau_RailRifle") then {_mags={Tau_RailRiflemag}};
if (_unitweapon=="Tau_VespidGun") then {_mags={Tau_VespidGunMag}};
if (_unitweapon=="Tau_Lasgun") then {_mags={Tau_LasgunMag}};
if (_unitweapon=="Tau_Carbine") then {_mags={Tau_PulseCmag}};
if (_unitweapon=="Tau_KLR") then {_mags={Tau_KLRmag}};
if (_unitweapon=="Tau_DBurstC") then {_mags={Tau_DBurstCmag}};
if (_unitweapon=="Tau_DMslPodTT") then {_mags={Tau_DMslPodTT}};
if (_unitweapon=="Tau_DPulseC") then {_mags={Tau_DPulseCmag}};
if (_unitweapon=="Tau_DPhotonGL") then {_mags={Tau_DPhotonGLMag}};
if (_unitweapon=="Tau_DRailR") then {_mags={Tau_DRailRmag}};

//---------------------------------------------------------------------------------------------------------------
////////////////////////////////////////////////////// Necrons  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//---------------------------------------------------------------------------------------------------------------
if (_unitweapon=="NecronFlayer") then {_mags={NecronFlayerMag}};
if (_unitweapon=="NecronGaussBlaster") then {_mags={NecronGaussBlasterMag}};

 

 

 

 

 

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, krzychuzokecia said:

@ww2weasel it'd be all easier to read (and copy into notepad) if you'd used

 


code function

for scripts!

You sir, are a gentelman and a scholar!

also ww3weasel when?

Share this post


Link to post
Share on other sites
5 hours ago, krzychuzokecia said:

@ww2weasel it'd be all easier to read (and copy into notepad) if you'd used

 


code function

for scripts!

Ya, when I wrote the scripts initially, I was writing them for my mods wasn't thinking of anything but getting them to work.

So I would need to look them over to put in helpful comments.

When I get some more free time.

Currently working atm.

Perhaps I'll make demo mission snippets, so you can plug and play.

Share this post


Link to post
Share on other sites

Do you have a list of weapon class and magazine class you use? I can quickly transpose those into my script for you to try out. 

The only caveat with ammopouch script - is it is designed to work with 1 or 2 magazine slots.  So if the magazine takes 3 or more magazine slots the script may not function as advertised because the magazine count may become skewed/muddled.

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

×