Welcome to the Iron Front Fan Forums!
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
Foxsch

Avatar / Picture

Colonel
Registered:
Posts: 463
Reply with quote  #1 
Hi, one of the continual problems I have faced, putting complex mission together, has been using appropriate animations. They have thrown up so many issues as I have tried to incorporate them, that I rarely try to add them now, believing that unless they are used in cut-sequences, the amount of work they create far outweighs their aesthetic use during a mission. As the missions are played it is even possible a player will not even notice that they are taking place! All that aside; placing a Unit into a Chair. As far as I am aware this is a very limited exercise. The empty chairs available in the editor do not allow it, and the only real option is to create a vehicle: 'FoldChair_with_Cargo' which does allow use as a 'vehicle', and Units can be placed into them as Cargo. Drawback for WWII period mission editing is that the Chair is of the alloy-steel folding variety, suited to far more recent scenario's, looking quite out-of-place in a WWII setting. I cannot create from the p3d modelling world, and I have (to-date) not tried disassembling the p3d's in the game to mod them. My experience has been limited to using lines of texture modification such as setObjectTexture and so forth. Has anybody thought about creating or modifying any of the wooden chairs available in the editor to a 'cargo' standard model, such as the 'FoldChair_with_Cargo'? It would be an invaluable asset for WWII Mission Editing, and of course if anybody knows of any way to do this without modding the period-looking chairs already available, I'd be more then happy to hear about how that can be done.

  Cheers!

     Happy Editing : -)

   Foxsch

Screenshot:

[FoldingChair1944] 

Authentic 1944? I'd pose not ~ 

__________________
Mission Repository - http://www.missionrepository.com

0
BRS

Captain
Registered:
Posts: 194
Reply with quote  #2 
Heya Foxsch [smile]

Hope the below script will help you ahead.

Place a WoodChair to the map and name it!!
I used the name  chair_1 for this.
In the soldiers ini line I wrote then:
nul = [this, chair_1] execVM "BS_Place_Soldier_on_Chair.sqf";
I used two animations which are taken by random.
I did this to handle different ways for animations and to show the how to.
It could be expanded if needed.
BTW: I placed 10 chairs and 10 pilots same time and give each of them the ini line. It worked so far.
Only tested in SinglePlayer mode.

as usual: place the BS_Place_Soldier_on_Chair.sqf into your mission folder
and call it as shown above.

//===================================================================================================================
//   Script to place a soldier onto a chair
//  
//  by BS 2014
//
//  Note:  You may use this script as it is or change at your convenience. 
//  Would be nice seeing a credit note if you'll use this script for your missions.
//
//  Usage: nul = [unit, object_to_sit_on] execVM "BS_Place_Soldier_on_Chair.sqf";
// 
//  inside soldier units ini line(s) place:
//  nul = [this, Name of Chair] execVM "BS_Place_Soldier_on_Chair.sqf";
//======================================================================================================================
if ((!isServer) && (player != player)) then
{
  waitUntil {player == player};
};  
private ["_unit","_chair","_pos","_type","_dir","_debug"];
_debug = false;
// Soldier
_unit = _this select 0;
if (isnull (_unit)) exitWith { hintsilent "no Soldier to sit down"; };
// chair
_chair = _this select 1;
if (isnil ("_chair")) exitWith { hintsilent "no chair to place a soldier"; };
_type = typeOf _chair;
if (_debug) then
{
  hintsilent format ["Type: %1\n",_type];
  sleep (1);
};
if ( _type == "WoodChair" )  then
{
  _unit disableAI "FSM";
  _unit disableAI "MOVE";
  _dir = getDir (_chair);
  _pos = getPosATL (_chair);
  
  if ( random (1) > 0.5 ) then
  {
    _unit switchMove "sitUnarm_L_idleLoop";
    _unit setDir (_dir - 90);
    _unit disableAI "ANIM";
  }
  else
  {
    _unit switchMove "miles_c0briefing_odpovedel_loop";
    _unit setDir ( -_dir );
  };
  
  _unit setPosATL (_pos); 
};
0
Foxsch

Avatar / Picture

Colonel
Registered:
Posts: 463
Reply with quote  #3 
That's perfect BS ~ Thank you very much : -) I will be using the script in a Mission, and I will credit you accordingly.

Maybe an idea, for non-script writers like myself idk, to point out where options can be found?

I had planned to add animations into a Trigger around the figure when he is 'discovered', and I realise I can add an alternative 'idle' animation in place of the one you have used for the >0.5 random feature you have written:


if ( random (1) > 0.5 ) then
  {
    _unit switchMove "sitUnarm_L_idleLoop";
    _unit setDir (_dir - 90);
    _unit disableAI "ANIM";
  }


Although this isn't entirely clear for me ~ Is it written such that there is a 1 in 2 chance of the unit sitting at 90 degree's to the Azimuth of the placed chairs Azimuth? (I did need to knock 90 degrees off the direction of the wooden chair (screenshot) to get the positioning without the unit sitting at that degree) and also, how would the:


  else
  {
    _unit switchMove "miles_c0briefing_odpovedel_loop";
    _unit setDir ( -_dir );
  };


section of the script become active?

I am having him get up, saluting and then wandering around and off, after he has been discovered via a proximity Trigger (without giving too much of the Mission line away : -)
He now looks more comfortable and genuine:

[USPilotSeated] 

Thanks Again BS!!!

__________________
Mission Repository - http://www.missionrepository.com

0
BRS

Captain
Registered:
Posts: 194
Reply with quote  #4 
I hope I translate your questions well.

Quote:
where options can be found?

I use this link: https://community.bistudio.com/wiki/Category:Scripting_Topics

Quote:
and I realise I can add an alternative 'idle' animation in place of the one you have used

Sorry for the possible confusion (overhead) I produced by this.
The way I inserted this two animations is a way how I insert variants while playing missions again and again.
There is a good chance that the script will take the first OR  the second animation. This is useless for your mission, it just need one single animation.
But maybe the idea behind my code could be better seen if you'll make a little test mission and place 10 -named- chairs in a row or two rows a 5 chairs and place 10 pilots, one for each chair.
The name of the chair must be different for each singe pilot in his ini line for this. If you'll start the mission all 10 pilots will sit on their chair, but with a good chance of different animations then.
This will look more real. If you want try it out.
As said, for your briefing it would be better to change the code a little and just take the one and only animation you need. See code below.
Quote:
Although this isn't entirely clear for me ~ Is it written such that there is a 1 in 2 chance of the unit sitting at 90 degree's to the Azimuth of the placed chairs Azimuth?

While playing around with my code I saw that some of the soldiers sitting animation are different in angle. Therefore the animations I used needed different dirs. If you'll use other animations as I did and your pilot has the wrong dir you can adapt it as seen in the code by changing the dir value.
Here is the code to use one single animation as you'll need it:

//===================================================================================================================
//   Script to place a soldier onto a chair
//  
//  by BS 2014
//
//   Note:  You may use this script as it is or change at your convenience. 
//  Would be nice seeing a credit note if you'll use this script for your missions.
//
//  Usage: nul = [unit, object_to_sit_on] execVM "BS_Place_Soldier_on_Chair_V2.sqf";
// 
//  inside soldiers units ini line(s) place:
//  nul = [this, Name of Chair] execVM "BS_Place_Soldier_on_Chair_V2.sqf";
//======================================================================================================================
if ((!isServer) && (player != player)) then
{
  waitUntil {player == player};
};  
private ["_unit","_chair","_pos","_type","_dir"];
// Soldier
_unit = _this select 0;
if (isnull (_unit)) exitWith { hintsilent "no Soldier to sit down"; };
// chair
_chair = _this select 1;
if (isnil ("_chair")) exitWith { hintsilent "no chair to place a soldier"; };
_type = typeOf _chair;                   // only usable for this type of chair
if ( _type == "WoodChair" )  then
{
  _unit disableAI "FSM";
  _unit disableAI "MOVE";
  _dir = getDir (_chair);
  _pos = getPosATL (_chair);
  
  _unit switchMove "sitUnarm_L_idleLoop"; // insert your animation here
  _unit setDir (_dir - 90);               // if needed play around here until pilot sits in the correct dir
  _unit disableAI "ANIM";                 // needed if your animation will end and the pilot stands up again
                                          // if you want that disable or remove the line
  
  _unit setPosATL (_pos); 
};


I hope I answered to your questions well. If not feel free to ask ahead.
And.. btw: In most cases you don't need a script. You can place most of these commands into the soldiers/objects ini lines.
I just like this scripting way and learn each time while playing around with this [smile]
0
Foxsch

Avatar / Picture

Colonel
Registered:
Posts: 463
Reply with quote  #5 
That all makes sense BS thank you. I doubt I'll need to test the script using the multiple unit approach as you suggest - it seems to be working fine for what I need [cool]
__________________
Mission Repository - http://www.missionrepository.com

0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.