Jump to content
Sign in to follow this  
Blanco

empty enemy static weapons

Recommended Posts

How can prevent Ai friendlies firing at empty enemy static weapons.?

When the crewmen of a static MG got killed, my friendlies next target is the empty MG, but it's harmless when it's empty.

How can I prevent them doing that?

-without blowing it up automatically when the crew's dead -

Share this post


Link to post
Share on other sites

Try with "object setCaptive true" after the gunner/s are dead...

/Christer (a.k.a KeyCat)

Share this post


Link to post
Share on other sites

Offcourse, setcaptive... crazy_o.gif

Let's hope it works with empty objects.

Thx

Share this post


Link to post
Share on other sites

.......however if you are using a trigger to do something when all the enemy units are dead...the trigger will not work, thus you WOULD have to blow it up when crew is dead.

Share this post


Link to post
Share on other sites
.......however if you are using a trigger to do something when all the enemy units are dead...the trigger will not work, thus you WOULD have to blow it up when crew is dead.

Hmm... perhaps you could "join" the empty MG to someone on a different side to prevent this? Longshot, but it may work....

Share this post


Link to post
Share on other sites

Hmm... I don't think you can "join" empty weapons or vehicles...

I never tried this, but this could work :

-place a manned machinegun and run this script :

[name of the gun] exec "emptygunfix.sqs"

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_gun = _this select 0

#check

?((count crew _gun) == 0) : goto "createtmpgunner"

~1

goto "check"

#createtmpgunner

_gunny = "logic" createvehicle getpos _gun

_gunny moveingunner _gun

~1

Capture_action = _gun addaction ["Capture weapon","Capture.sqs"]

exit

Then the capture script...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

;;capture.sqs

_gun = _this select 0

_user = _this select 1

_gun removeaction Capture_action

_tmpgunner = gunner _gun

(_tmpgunner) action ["eject",_gun]

@side _gun != LOGIC

_user assignasgunner _gun

[_user] ordergetin true

~0.5

deletevehicle _tmpgunner

exit

I've noticed when you moveingunner' a gamelogic in a static weapon, the side of weapon changes to LOGIC. So I guess nobody will try to destroy the machinegun anymore.

Nobody is able to board the gun anymore , that's why I'v added that capture_action. You can also order your men to capture the gun via the action menu (select a soldier and then 6- Capture weapon)

Not tested, but I think this could work.

Share this post


Link to post
Share on other sites

No, when the gun is empty ,it's side is civilian

But the script doesn't work... ghostface.gif

Unbelieveable, they still think that empty gun as the most deadly threat around. How stupid can you be.

I'v placed a manned machinegun in front of a house with a small enemy group patrolling about 50m away from it.

my men killed the gunner, the gamelogic moves in (side is LOGIC atm), My men fired like lunatics at the empty machinegun, they even destroyed the house. crazy_o.gif

They don't give a shit about the attacking groups, that's really really stupid AI.

But I don't give up, there must be a way...goddammit

Share this post


Link to post
Share on other sites

One thing I've noticed with the "setcaptive" command, is that if UnitA is targeting UnitB, and then you make UnitB a captive, UnitA will keep on shooting at UnitB. Perhaps the same sort of thing is happening here: your men are targeting the MG, then the gun is turned friendly/whatever by the gamelogic, but your guys keep shooting it because they were already in the middle of shooting at it.

Try the mission again like this, to test my theory: start the player on his own near the MG, and have a friendly group somewhere out of sight moving towards the gun. Kill the gunner yourself, and see if your buddies still decide to light up the gun when they get close enough to see it.

Share this post


Link to post
Share on other sites

Your theory is correct, general

AI stays in "berzerk -mode"   biggrin_o.gif ... when they've started the attack.

Can't fix that, unless you use the drastic way :

emptygunfix.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

;[name of gun] exec "emptygunfix.sqs"

_gun = _this select 0

_guntype = typeof _gun

_gundir = getdir _gun

_gunposx = getpos _gun select 0

_gunposy = getpos _gun select 1

_gunposz= getpos _gun select 2

#checkcrew

?!alive _gun : exit

?((count crew _gun) == 0) :_gundam = getdammage _gun;goto "createnewgun"

~1

goto "checkcrew"

#createnewgun

_newgun = _guntype createvehicle [0,0,0]

_newgun setpos [_gunposx,_gunposy,_gunposz]

_newgun setdir _gundir

_newgun setdammage _gundam

~0.5

exit

With the script a new empty gun is created at the exact same spot as the original. Noone will attack that gun.

Is't drastic but it works perfect.

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
Sign in to follow this  

×