Home   Help Search Login Register  

Author Topic: Getting Fog.fsm in init.sqs to persist  (Read 2403 times)

0 Members and 1 Guest are viewing this topic.

76

  • Guest
Getting Fog.fsm in init.sqs to persist
« on: 09 Jun 2012, 03:35:20 »
Firstly Im a noob at this so I thought asking the pros would be a second great step.

I'm using the Fog.fsm (low ground fog script) to run in my mission.
Problem is I'm not sure how to make it persistent, it runs fine on first spawn but after first death (second respawn) it stops working...

this is the line that runs in the init.sqs...

;Fog
[player,100,7,14,3,8,-0.3,0.05,0.6,1,1,1,13,12,15,true,0.4,0.5,0.05,0,0,0,0,24] execFSM "Fog.fsm"

Is there a way to make it continue or initialize after every spawn or just be persistent ??

Thanks in advance :)

Offline F2kSel

  • Members
  • *
Re: Getting Fog.fsm in init.sqs to persist
« Reply #1 on: 11 Jun 2012, 02:45:33 »
Hard to say without knowing how the respawn script works. Some have options to add scripts to the players init and in others the script will have to be restarted after the player respawns by adding the code to the script.

Re: Getting Fog.fsm in init.sqs to persist
« Reply #2 on: 01 Jul 2012, 14:20:06 »
You can try something like this (untested code follows) if there's no teamswitching or fancy custom respawn scripts in the mission.
Code: [Select]
In your init.sqs:
nul = execVM "FSMRunner.sqf";

FSMRunner.sqf:
if (!alive player) then {
   sleep playerRespawnTime;
   waitUntil {sleep 0.2; alive player};
};
player addEventHandler ["killed", {nul = execVM "FSMRunner.sqf"}];
[player,100,7,14,3,8,-0.3,0.05,0.6,1,1,1,13,12,15,true,0.4,0.5,0.05,0,0,0,0,24] execFSM "Fog.fsm";