Jump to content
  • 0

Make a unit (createUnit) act as a agent (createAgent)?


Donnovan

Question

25 answers to this question

Recommended Posts

  • 0

Thankyou for the answers. I really apreciate.

 

Its for a suicider bomber unit. When he engage in the intent to detonate his ammo near a player is better to command then as a agent. Other than that, he is a normal unit.

 

May be if i change the default unit FSM to the one i want (run near player and explode) and disable TARGET and AUTOTARGET, set behaviour to CARELESS and Combat Mode to RED.

 

I will just need to restore default unit FSM and settings if he fail to kill the player or player get killed by other causes.

Link to comment
Share on other sites

  • 0

Hi,

 

i'm currently thinking bout doTarget. Order your Unit to Target Player, give your Unit a Hatchet and reaload it, let it run to player (forceWeaponFire) and then delete hatchet, let unit go kaboom.

Link to comment
Share on other sites

  • 0

Thanks for the idea UKMartin.

Right now i'm trying to use doFSM but the command seens broken, it does not do anything (i have diag_logs inside the FSM that does not happens) and give no error.

As a workarround i'm using execFSM, but sometimes AI refuse to execut doMove correctly. I believe they can obey better with doFSM, since doFSM set the unit to Not Ready during all the process (Not Ready because its busy doing the doFSM), and no other actions will interfere.

Link to comment
Share on other sites

  • 0

Thanks for the idea UKMartin.

Right now i'm trying to use doFSM but the command seens broken, it does not do anything (i have diag_logs inside the FSM that does not happens) and give no error.

As a workarround i'm using execFSM, but sometimes AI refuse to execut doMove correctly. I believe they can obey better with doFSM, since doFSM set the unit to Not Ready during all the process (Not Ready because its busy doing the doFSM), and no other actions will interfere.

 

doFSM works silently, you won't be able to log actions inside that FSM File, unless you create a Function in Server_functions.sqf and then call that function via Publicvariable from the FSM.

Inside the FSM you can use MoveTo and MoveToComplete, to let the Bomber run to Player.

Link to comment
Share on other sites

  • 0

UKMartin,

There is still hope to execFSM (i mean, no need to try doFSM).

Problem found,

I believe the doMove command have a big completion radius on the destine, this is why the bot gets near player but not enough to explode. You know any way to lower the completion radius of the doMove command?

 

---//---

 

My FSM.

bomberman_zpsehu9qsqg.png

Link to comment
Share on other sites

  • 0

Umm yeah, on the Beginning of your FSM you could create like a improvised trigger area around player, using distance check. If ((_ai distance player) < 20) then {//GO boom};

 

Just put that in a Condition before the "Eplode" state

 

//EDIT: Actually you want the distance to be 3 - 5 Meters, instead of 20 ^^

BTW: I love your Convoy script :)

Link to comment
Share on other sites

  • 0

UKMartin, the radius i created for explode is ok.

 

The problem is the completion radius of the doMove command.

 

If i doMove a AI from [1120,1000,0] to a player in [1000,1000,0] he, the AI, will consider the move done when he is at [1012,1000,0], for example. And since explosion radius is 6 m, the AI will not explode.

Link to comment
Share on other sites

  • 0

UKMartin, the radius i created for explode is ok.

 

The problem is the completion radius of the doMove command.

 

If i doMove a AI from [1120,1000,0] to a player in [1000,1000,0] he, the AI, will consider the move done when he is at [1012,1000,0], for example. And since explosion radius is 6 m, the AI will not explode.

 

I see. If the Player is Moving, then you'll have to update the Position after doMove command, otherwise it will move to the Position the player was at, when you executed the command.

Generally i never had any problems with the Positioning, but i'm interested in which function are you using to get the Position? getPosATL ?

Link to comment
Share on other sites

  • 0

Just perform another doMove, I have an fsm for a unit, and when following the player, had to add in a block to stop the ai constantly moving next to the player.

 

Pseudo FSM, if not within detonation distance perform doMove to player position, repeat.

Link to comment
Share on other sites

  • 0

I'm using doMove getPosATL _target to set the doMove position.

 

The more i issue doMoves, the more the unit run in zigzag.

 

I acumulate red balls on the unit head for each doMove issued. The unit runs straight foward, and when a new ball appears (doMove executed) the unit zig to right or zag to left.

 

When the unit is near the player i can send 10 doMove to the exact player position and the unit will stay rounding the player. Eventually the unit will enter the detonate radius (10 meters) and will explode.

 

Here is how a preparate the unit to be a humam bomber:

_bomber_grp = createGroup EAST;
[_unit] joinSilent _bomber_grp;
_bomber_grp selectLeader _unit;

_unit disableAi "TARGET";
_unit disableAi "FSM";
_unit setSkill 0;
_bomber_grp setBehaviour "CARELESS";
_bomber_grp setCombatMode "RED";
Link to comment
Share on other sites

  • 0

Sounds like your FSM is not waiting for unitReady before performing the next check

 

EDIT: Don't check on every tick for anything, put a scheduler into your FSM and some control loops. Are you sure the wait is waiting, can't see the actual code :) Update destine is the most likely suspect.

 

Another thing to consider for your position might be:

_moveToPosition = [player, _intDistanceWithinDetonationDistance, _random 360] call BIS_fnc_relPos;

That will find a random position around the player but not the actual player position.

Link to comment
Share on other sites

  • 0

Nice!

 

Will tweak the frequency of doMove.

 

I reached good results adding 2 lines to the unit preparation:

_bomber_grp = createGroup WEST; //NEW! NEW! "WEST" INSTEAD OF "EAST"
[_unit] joinSilent _bomber_grp;
_bomber_grp selectLeader _unit;

_unit disableAi "TARGET";
_unit disableAi "FSM";
_unit setSkill 0;
_unit setCaptive true; //NEW! NEW!
_bomber_grp setBehaviour "CARELESS";
_bomber_grp setCombatMode "RED";

Link to comment
Share on other sites

  • 0

With execFSM, in the middle of the combat, AI will always be Not Ready and not able to execute the doMove command. I believe there is nothing we can do.

If i could use moveTo to a unit via execFSM... but moveTo seen not to work in this context.

 

So, i have back to doFSM, because it get all the AI attention.

I have tried again, but as before, the doFSM command seens to do completely nothing.

 

Here how i call it:

//_unit is the AI unit that will enter in bomber mode
_unit setVariable ["doFSM",[objNull,_unit,1],false];
_unit doFSM ["andre_bomberman_doFSM.fsm",position _unit,_unit];

Here is the doFSM FSM file:

https://www.dropbox.com/s/o5chwl4y525cvi7/andre_bomberman_doFSM.fsm?dl=0

 

Thankyou UKMartin! I hope the next release will be kick ass!

Link to comment
Share on other sites

  • 0

When a unity is ready or not ready?

 

"If the unit has any active waypoints or group tasks (e.g., engaging,

moving to a particular position), it is not ready. Otherwise, it is."

 

http://forums.bistudio.com/showthread.php?114548-unitReady-commands

 

So in my situation - a group of units with a active waypoint and at war - all of the units will be not ready.

 

I can join the bomber to a lonely group, and this will let me change its behaviour and combat mode, but this is like to make the unit die to the comvoy, since it will not be able to follow the convoy, enter/exit vehicle, etc. I can rejoin this unit to the convoy group but this would be complicated at the moment.

Link to comment
Share on other sites

  • 0

Nice Axeman, i will take a look at Arma 3 Epoch server files.

 

But seens moveTo does not work with units, it only works with agents.

 

In all my tests with units (not agents), execFSM (not doFSM) and moveTo (not doMove) the units did nothing with the moveTo command, and this was loged to make sure moveTo was executed, i would love to be wrong.

Link to comment
Share on other sites

  • 0

Correct, as I said moveTo for agents, doMove for units :)

 

DoFsm is more of a command to issue a simple task against a unit which you don't want disturbed whilst doing, maybe by a controlling execfsm structure.

 

When a unit is doing a DoFsm it will always be not ready, so an execfsm can call a DoFsm on a unit and, if you check for unitready before issuing the next DoFsm things will always be more structured. 

 

A DoFsm would be something like, move from a to b, or heal a unit..

Link to comment
Share on other sites

  • 0

Nice Axeman, i will take a look at Arma 3 Epoch server files.

 

But seens moveTo does not work with units, it only works with agents.

 

In all my tests with units (not agents), execFSM (not doFSM) and moveTo (not doMove) the units did nothing with the moveTo command, and this was loged to make sure moveTo was executed, i would love to be wrong.

 

moveTo will never work with a Unit, unless a higher ranked unit orders that unit to move to that Position. It's part of the Commandings, that are used in arma like when you press Backspace. Try setting the nearest Player as higher ranked member of the Group and execute moveTo from the Mission Folder (player) or try it with remote execution.

Another solution would be to give that unit a Waypoint and wait untill it reached the Waypoint.

Or just use doMove instead of moveTo

Link to comment
Share on other sites

  • 0

Thanks a lot Axeman.

I understand the idea, and seens a very nice solution. But i think i will wait forever for the unit to be ready to execut the doFSM, since i must execute it on units that are at war and that have an active waypoint.

May be the doFSM do nothing in my tests because it is waiting for the unit to be ready before really execute.

Link to comment
Share on other sites

  • 0

Use execFsm to run your mission control. Issue DoFsm if you want a simple, undisturbed task performed by a unit. ExecFsm   on other complicated tasks, e.g. One on each unit to control their whereabouts. If using this concept then look at handles and set/getFsmVariable command.

 

The next sapper Update uses this principle, I have gone from spawning 20 to nearly 60 before I take a FPS hit on my laptop in the editor. 

Link to comment
Share on other sites

  • 0

Using Now:

execFSM + doMove

 

Badie: The bomber can take some time to be ready to receive a doMove comand.

Solution: increase the number of bombers, so you will have the wanted number of AI running into the player!

Goodie: All soldiers can be bombers! And they will run on the player like a smart bomber! So its not the case of Serious Sam Kamikazes.

 

SOLVED! Thankyou for all the help!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...