Jump to content
Sign in to follow this  
Kydoimos

AI Sitting on chairs

Recommended Posts

Sorry for the delay. busy with other things in RL. Give me a few hours(/days) I hope to have it updated.

Share this post


Link to post
Share on other sites

in the demo mission In multiplayer some animations do not work and the unit disappears.

Someone could help me please

Share this post


Link to post
Share on other sites
How is it that no one had said anything about the guy in the field toilet in the sample mission?

That was hilarious! I loved it.

You're example mission is a MUST for every mission maker out there. I'm now implementing it in my up to come mission.

I just hope Foxhound and the other MODS will take the time to make stickies out of these great tools and scripts for others to easily find.

Thanks for the hard work!

in the demo mission In multiplayer some animations do not work and the unit disappears.

Someone could help me please

Make sure when you copy/paste the code from the sample missions to your map, you've deleted the "hideobject".

Maybe that is what is making your units disappear. Should be the very last part of the code that goes in the units init box.

Share this post


Link to post
Share on other sites
Make sure when you copy/paste the code from the sample missions to your map, you've deleted the "hideobject".

Maybe that is what is making your units disappear. Should be the very last part of the code that goes in the units init box.

I only use this in the init of unit:

[this,"REPAIR_VEH_STAND","LIGHT"] call BIS_fnc_ambientAnim;

and this in other unit:

[this,"GUARD","FULL",{player distance _this < 10 || getdammage _this >0}] call BIS_fnc_ambientAnimCombat;

Share this post


Link to post
Share on other sites

I haven't tested these animation functions in MP myself. I think it might be a case of running bis_fnc_mp to make sure they are run on all machines.

I have never used the function before, but this 'may' work

UNTESTED- try below unit initialisation field

[[this,"REPAIR_VEH_STAND","LIGHT"],"bis_fnc_ambientAnim",false,true] call BIS_fnc_mp 

might need to work out where to run the function, ie. the false,true not 100% on this part might have to test a little.

ps. thanks for the compliment on the example mission Kommie - I didn't think it was really that great. but it helps that at least one person found it useful.

NOTE: the part in the ambientAnimCombat : {player distance _this < 10 || getdammage _this >0} is just an example, i believe using code based on a knowsabout player would be much more useful. - i'll try to work something out.

Edited by KevsnoTrev
updated code as had local variable in global space

Share this post


Link to post
Share on other sites

Thank you so much to all for your replies

I will try this and tell you if that works :

[[_this,"REPAIR_VEH_STAND","LIGHT"],"bis_fnc_ambientAnim",false,true] call BIS_fnc_mp

Share this post


Link to post
Share on other sites
I haven't tested these animation functions in MP myself. I think it might be a case of running bis_fnc_mp to make sure they are run on all machines.

I have never used the function before, but this 'may' work

UNTESTED- try below unit initialisation field

[[_this,"REPAIR_VEH_STAND","LIGHT"],"bis_fnc_ambientAnim",false,true] call BIS_fnc_mp

might need to work out where to run the function, ie. the false,true not 100% on this part might have to test a little.

local variable in global space????

Share this post


Link to post
Share on other sites

OK thanks blackMamb

To achieve fix the problem through an activator by putting this and work:

[m1, "SIT_SAD1", "NONE", sit_wall] call BIS_fnc_ambientAnim; [m2, "REPAIR_VEH_STAND", "LIGHT"] call BIS_fnc_ambientAnim; [m3, "GUARD", "FULL", {_this distance player <10 | | getdammage _this> 0}] call BIS_fnc_ambientAnimCombat; [m4, "LEAN", "FULL", {_this distance player <10 | | getdammage _this> 0}] BIS_fnc_ambientAnimCombat call;

But now I need that the whole group not only the player use this {player distance _this <10 | | getdammage _this> 0}]

3 persons in mission and only work the distance for my

PD: sorry for my bad English :rolleyes:

Edited by Thor632

Share this post


Link to post
Share on other sites

You could use this:

{({_this distance _x < 10} count playableUnits > 0) ||  getdammage _this> 0}

It should be relatively reasonable if you only have three playable units.

Edit : note that playableUnits may be empty if you're testing this i the SP editor.

Share this post


Link to post
Share on other sites

Thanks again

then for 8 players would be:

{({_this distance _x < 10} count playableUnits > 8) || getdammage _this> 0}

or would be >0 to recognize all players?

Share this post


Link to post
Share on other sites

Nah, you keep it to zero.

Basically what it does: it counts the number of playable units that are less than ten meters away from your (m4) unit. If that count is more than 0, then it means at least one player is close enough.

If you were to replace that by 3, you would need to have at least 3 players near the dude for the script to fire.

Share this post


Link to post
Share on other sites

thank you so much blackmamb for you help

Edited by Thor632

Share this post


Link to post
Share on other sites

 {({_this knowsabout _x > 1.3} count (playableUnits + switchableunits) > 0) ||  getdammage _this> 0}

Can someone give this a go? just wondering if it gives a little bit of simulated intelligence ti the AI unit, so if they see the player then they will break the animation and go into their combat stance. my testing has been hit and miss, sometimes I am within spitting distance others I can be between over 100m away

I seem to think knowsabout was touchy with A2 and OA. (confirmation would be good)

I am working on a way to use this in conjunction with neartargets and looking at the (_x select 0) select 3 --- 'cost' a weighting that gives a value where the higher the value the more dangerous the target that was 'seen'

ps: BlackMamb using '(playableUnits + switchableunits) ' covers for both editor testing and multiplayer hosting. saves changing for multiplayer or using ismultiplayer if statements too.

Share this post


Link to post
Share on other sites
 {({_this knowsabout _x > 1.3} count (playableUnits + switchableunits) > 0) ||  getdammage _this> 0}

Can someone give this a go? just wondering if it gives a little bit of simulated intelligence ti the AI unit, so if they see the player then they will break the animation and go into their combat stance. my testing has been hit and miss, sometimes I am within spitting distance others I can be between over 100m away

I seem to think knowsabout was touchy with A2 and OA. (confirmation would be good)

I am working on a way to use this in conjunction with neartargets and looking at the (_x select 0) select 3 --- 'cost' a weighting that gives a value where the higher the value the more dangerous the target that was 'seen'

KevsnoTrev I tried to use nearTargets on something else but was never able to get it to function how I wanted. You might want to check the side of the units other wise it will cause some issues.

I have a quick work around to get units to break out of the state. Here was what I tried.

I placed a gamelogic down on the map and add the following code.

fired = 0;
this addEventHandler ["FiredNear",{fired = 1}];

Then I added this code to the init field of a unit

[this,"LEAN","FULL",{fired == 1 || getdammage _this >0}] call BIS_fnc_ambientAnimCombat;

Now if you fire a weapon within approx 160 meter radius of the game logic the unit will break out of the animation state. This will work for any unit or player that fires a weapon. This was quick and dirty test but using event handlers to break out of the animation state can create a lot of options.

One other idea just popped into my head, if you have a group of units you could use the count of the alive units in the group as a condition. If you have a group of units in an animated state around if one dies then the others would react to it.

Hope it gives you a few ideas.

Share this post


Link to post
Share on other sites
try changing ratio between x and y

setVectorDirAndUp [[x,y,0],[0,0,1]];

Hi I have the same problem but I cant find the combination the soldier has the same direction as the chair

here a picture of my problema

if any have a simple solution thanks

http://es.tinypic.com/r/5zek5t/8

Sorry my bad English

Thanks

Edited by ltluis

Share this post


Link to post
Share on other sites

I wrote a script for sitting on a chair (plastic chair is creating into script)

Unit is sitting with safe animation

Parameters are: unitname,coords,angle

// _p=[_sol2,[14613.1,16696.6,0],5] execVM "guard_onchair.sqf";

_un=_this select 0;
_pos=_this select 1;
_deg=_this select 2;

_chair1=createVehicle ["Land_ChairPlastic_F", _pos, [], 0, "CAN_COLLIDE"];
_chair1 setDir (_deg-90);

_un setBehaviour "SAFE";
_un switchmove "InBaseMoves_SittingRifle1";

_un disableAI "anim"; 
_un attachTo [_chair1, [0, 0, -0.5] ];
_un setVectorDirAndUp [[1,0,0],[0,0,1]];

  • Like 1

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  

×