IRONFRONT FANS FORUM
Register Latest Topics
 
 
 


Reply
  Author   Comment  
BRS

Captain
Registered:
Posts: 197
Reply with quote  #1 
I did a few little scripts to insert some more 'life' into my missions.
Here is one I made for the IF44 land toilet and I thought it's something to share with all of the vanilla IF44 users.
Insert the BS_land_toilet.sqf script into your mission folder and write into player units ini line(s):
nul = [this, 2] execVM "BS_land_toilet.sqf";
You ever noticed that you can open the door of a land toilet? Yes you can [smile]
This script wait until you'll open a land toilet and if you near enough it will spawn a swarm of flyes then. But this could be a dangerous action too, there is a very little chance that you run into a build in trap...
Give it a try, take it as it is, have fun.. [smile]


Code:

//===================================================================================================================
//   Script to put some hordes of flies into a Land_toilet while opening the door
//  By some chance there will be a  build in trap.
//  by BS 2013
//
//   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 = [object_to_scan_from, radius_to_scan] execVM "BS_land_toilet.sqf";
// 
//  inside player units ini line(s) place:
//  nul = [this, 2] execVM "BS_land_toilet.sqf";
//======================================================================================================================
private ["_center_object","_spawn_fly","_source","_interval","_toilets","_radius","_active","_traps","_hm","_anim"];
private ["_date"];
// Player
_center_object = _this select 0;
if (isnull (_center_object)) exitWith { hintsilent "no Object to check from found"; };
_radius = _this select 1;
if (isnil ("_radius")) then
{
 _radius = 2.15;
};
if ( _radius < 0.1 ) then
{
  _radius = 0.1;
};
if ( _radius > 2.15 ) then
{
  _radius = 2.15;
};
_interval = 5; // secs
_hm = 999;
//=====================================================================
// the bad thing starts here
_spawn_fly =
{
  if ((!isServer) && (player != player)) then
  {
    waitUntil {player == player};
  };  
  private ["_body","_a","_time"];
  
  _body = _this select 0;
  _time = _this select 1;
  _source = "#particlesource" createVehicle getPosATL (_body);
  _source setParticleParams [["\ca\characters2\OTHER\FLY.p3d",1,0,1,0],"","spaceObject",1,4,[0,-0.1,-0.7],[0,0,0.15],1,1.30,1,0,[0.03,0.03,0.03,0],[[0,0,1,0],[0,0,1,1]],[1.5,0.5],0.01,0.08,"","",_body];
  _source setDropInterval 0.01;
  _a = createSoundSource["Sound_Flies",getPos ( _body ),[],0];
  sleep ( _time - 0.5);
  if (alive _source) then {deleteVehicle _source};
  if (alive _a) then {deleteVehicle _a};
}; 
//=====================================================================
// The main script starts here
  _date = date; //[year, month, day, hour, minute]
  _active = [];
  _toilets = [];
  _traps = [];
  _anim = [];
  
while {true} do
{
  _toilets = getposATL _center_object nearobjects ["land_toilet", _radius];
  
  if (count _toilets == 0) then
  {
    _anim =[];
    _anim set[0,1];
    _hm = 999;
  };
  
  for "_i" from 0 to count _toilets -1 do
  {
    _anim set [_i, (_toilets select _i) animationPhase "door_0_anim"];
    if ( _anim select _i < 0.5 ) then
    {
      _active set [_i,0];
      _traps set [_i, 0];
    };
    // ignore destroyed toilets
    if ( !alive (_toilets select _i)) then
    {
      _active set [_i,2];
    };
  };
  // That's the absolut evil part now
  if (_hm == 999) then
  {
    _hm = round (random (100));
  };
  for "_i" from 0 to count _toilets -1 do
  {  
    // to give the player a good chance to survive don't go below 85% here
    if ( ( ((_anim select _i) > 0.5) AND (_hm > 85) AND ( (_traps select _i) == 0) ) ) then
    {
      "lib_f1" createVehicle getPosASL (_toilets select _i);
      _traps set [_i, 1];
    };
    
    // exclude winter time for the next part
    if ( (((_date select 1) > 3) AND ((_date select 1) < 11)) ) then
    {
      if ( (_anim select _i) > 0.95 AND (_active select _i) < 1 ) then
      {
        if ( (_active select _i) == 0 ) then
        {
          _active set [_i,1];
          nul = [ (_toilets select _i), _interval] spawn _spawn_fly;
        };
      };
      sleep 0.1;
    };
  };
sleep 0.35;
};
_active = [];
_toilets = [];
_traps = [];
_anim = [];
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.