Jump to content
Sign in to follow this  
redmotion

Trying to scatter a load of dead civilians around a position

Recommended Posts

_howManyMen = _defaultgroupsize + floor (random _defaultgroupsize + 4);

bodiesGroup =  createGroup civilian;

//Create the Dead
for "_x" from 1 to _howManyMen do
{
_unit = bodiesGroup createUnit [_tkCivs select (floor random (count _tkCivs)) , _locationPosition , [], 100, "NONE"];
_unit = setDamage 1.0;
};

I'm getting an error with setDamage. Not sure why. It says "Error missing ;". _tkCivs is an array listing all civilian character names.

 _tkCivs = ["TK_CIV_Takistani01_EP1", "TK_CIV_Takistani02_EP1", etc etc 

PS: Also have a similar problem with the "sleep" command. I have "sleep 10;", it gives "generic error in expression". It is an sqf file. No clue why its not working!

Thanks.

Share this post


Link to post
Share on other sites

You don't get why you get error at setDamage????? You assign _unit to the result of setDamage 1.0;. You probably meant to _unit setDamage 1.0;.

Can't say why you get error at the sleep command since you don't show the script. Maybe you forgot at closing ) ] } ?

Share this post


Link to post
Share on other sites

EDIT: FIXED. I think the issue with SLEEP may be to do with using "compile preprocessFile ". If I use execVM instead I'm getting the fade out effects working as I want.

Ugh! Thats one of my more embarissing late-night "don't have a clue" posts... Anyway, that was the problem. Got it working on the dead bodies front. Thanks for that... :) Doh!

I still cannot make sleep work though....

I've got a lot of seperate scripts that can be called in any order depending on conditions. Most are .sqfs calling other .sqfs.

So in one of these scripts after preprocessing some files and placing bodies and enemies, I then put in the task title last thing. (currently part of a task generation sqf but may be moved to a seperate "mission opening titles" script)

The fade in works, but the fade out doesn't happen, the screen just goes black and fades in straight away. The code below gives me errors for both lines with "sleep".

What I'd really like to do is fade to black, advance time forward while the screen is blank, wait for a few secs, start the titles and then fade in as they appear.

//titles

titleText ["", "BLACK OUT", 5];
sleep 5;

skipTime random 8;

_DateStamp=Date;

// date related calcs go here

playerDay = _jdNow - _jdStart + 1;

_dayCount = format ["Day:%1", playerDay ];

[ str(_dayCount), str(_TimeStr), str(_taskTitle) ] spawn BIS_fnc_infoText;

titleText ["", "BLACK IN", 2];
sleep 2;

I can get the fade out to work using a seperate sqs as in:

_Handle = player execVM "fadeOut.sqs";

waitUntil {scriptDone _Handle};

The waitUntil doesn't seem to wait though... and in the sqs "~5" gives an error.

VERY frustrating.

Edited by redmotion

Share this post


Link to post
Share on other sites

your using the wrong codes.

sqs is [player] exec "fadeout.sqs"

sqf is handle=[player] execvm "fadeout.sqf"

There maybe a few variants. _handle may cause problems as it will be a local variable and only relevant in to the script calling it. If you want to use the handle code in other scripts it's better to use just handle then all scripts and triggers can see it.

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  

×