Jump to content
Sign in to follow this  
Vicarious

1.56 New features HELP

Recommended Posts

It's actually always a good idea to make a copy of it and put into your own mission. Because you might want to apply some changes to it, or have some debugging output from it. Remember that BIS own debugging output doesn't produce anything for us, it's an inert command for end users. So you might want to change debugLog to diag_log.

Another good reason for doing so is the learning value. Keep reading it until you understand what it does (at least for these simple ones). Look up the commands it's using and check how they work. And by looking at good code, your own code might end up looking prettier as you pick up how to make it look good.

Just put it as yourmissiondir/functions/filename.sqf or something like that.

Edited by CarlGustaffa

Share this post


Link to post
Share on other sites

So, are you saying that I take my little code snippet:

waituntil {!isnil "bis_fnc_init"};

[rasman,500,42] call bis_fnc_destroyCity;

put it into its own file (e.g. mymissiondir/functions/filename.sqf) , call it from another file (which one?) from within an "init field" (note to self: look this one up) so that I can "compile preprocess it" (note to self: look this one up too) so that it creates the destroyed city *before* my mission starts?

What does shk's code above have to do with this?

----edit----

Okay, I now know what an init field is - I think I just need to figure out where I put it and in what order, relative to everything else in the mission, to make sure it runs before everything else.

----edit again----

Based on this information, it looks like I should not try to call the function from init.sqf - I should to call it from the mission.sqf before anything else?

Or, based on this information, I can call it call it from init.sqf, provided I use the "compile preProcessFileLineNumbers" command?

----and again----

I'm still trying to figure out what shk's code does and where it goes. :confused:

Edited by KaBoNG

Share this post


Link to post
Share on other sites

Compile it at the beginning, like pretty high up in your init.sqf. Then spawn it quickly after that. If you don't want to see the destruction, use some kind of black screen intro where sound is turned off. When destruction complete (wait for dust to settle), fade in image and sound. That's a key feature of having an intro - hide stuff that you don't want to show.

If you start a mission with the function manager in, activate via script the command:

0 = [] call BIS_fnc_help

In the third box, scroll down to PMC_Environment and select BIS_fnc_destroyCity. Copy that script to your editor, and now compare it to shk's script above. Look familiar? :) Note that the description seems a little off. It returns true, not the particle effect arrays it claims (or I'm just too tired to see it right now).

@shk:

Not a good idea to remove comments. If for a complex script all I have to do is to read the comments to get an idea of the interface, it saves me a lot of effort on having to actually read the code.

@anarcho:

Seed seems to be just a randomizer on which structures are destroyed. If you keep sending the same seed, the same structures would get destroyed over and over again, which are none. So if you want random massive destruction, you may have to obtain some random value first, and then increase it by 1 per iteration the destruction runs.

Can someone please explain to me the lines (keep in mind default seed is 1138):

if (_seed < 0) then {_seed = 1138;};

_seed =  round(_seed % 42);
if (_seed == 0) then {_seed = 42;};

Why such high number if it does % 42? And why not 1 + floor(_seed % 41) or ceil(_seed % 42)? Why 42, where does it come from? I'm kinda tired here though, so I may not see the obvious :p

Share this post


Link to post
Share on other sites

42 is the answer to life, the universe, and everything.

1138 is a reference to the film THX 1138. There is another reference to 1138 in PMC00 (the intro mission for PMC) in the briefing notes.

It's typical programmer humor.

Share this post


Link to post
Share on other sites

How can i delete 3D Text created with SaOk's script ?

And does anyone know how to use the voice samples from the PMC Campaign ?

Share this post


Link to post
Share on other sites

To disable the 3dText later, change the "true"-loops in 3dtextguard.sqf and 3dtext.sqf to follow some variable like:

while {isNil"VarA"} do {.....};

Then it goes away when you create that variable (VarA=true; )

Share this post


Link to post
Share on other sites
42 is the answer to life, the universe, and everything.

1138 is a reference to the film THX 1138. There is another reference to 1138 in PMC00 (the intro mission for PMC) in the briefing notes.

It's typical programmer humor.

Okay - so Suma (or someone ar BIS) is having some fun. Does this variable (seed) actually do anything?

Share this post


Link to post
Share on other sites
Okay - so Suma (or someone ar BIS) is having some fun. Does this variable (seed) actually do anything?

Of course it does:

Seed seems to be just a randomizer on which structures are destroyed.

Share this post


Link to post
Share on other sites

Anyone knows already the paths of the custom videos ?

Like:

\ca\video_pmc\CP00_Reynolds_b.ogv

I cant use the OA depbo tools so it would be cool if someone would be able to write them down.

Also there are many cool sounds/tracks, a list of paths would be cool.

Edited by Wiggum

Share this post


Link to post
Share on other sites
To disable the 3dText later, change the "true"-loops in 3dtextguard.sqf and 3dtext.sqf to follow some variable like:

while {isNil"VarA"} do {.....};

Then it goes away when you create that variable (VarA=true; )

I need the text to go away as well. I tried isNil but nothing happened, so I used

while {!my_variable} do { 

However when I do this, the 3D effect is disabled but the text is burned onto the screen in the last position you saw it. Anyone know how to get rid of the 3D text after you've spawned it?

Share this post


Link to post
Share on other sites
I need the text to go away as well. I tried isNil but nothing happened, so I used

while {!my_variable} do { 

However when I do this, the 3D effect is disabled but the text is burned onto the screen in the last position you saw it. Anyone know how to get rid of the 3D text after you've spawned it?

I did it by putting this after the while-loop:

CONTROL ctrlsetfade 1;
CONTROL ctrlcommit 0.1;

I lack any experience with controls, so I have no idea how to actually delete the text permanently (This will make the text disappear, but it is still there...)

Share this post


Link to post
Share on other sites

Hi guys,

i wold like to return to the destroy fnc.

What i did until now:

init.sqf

fnc_Destroy=compile preprocessFile "destroy.sqf";

destroy.sqf

scriptName "destroy.sqf";
/*
Author: Karel Moricky

Description:
Destroys building in given area based on input seed.

Parameter(s):
_this select 0: OBJECT - Destruction center
_this select 1 (Optional): NUMBER - Destruction area diameter
_this select 2 (Optional): NUMBER - Random seed
_this select 3 (Optional): ARRAY - Array of blacklisted objects

Returns:
ARRAY - Particle sources
*/
if (!isserver) exitwith {debuglog "Log: [Functions] ERROR: 'BIS_fnc_destroyCity' cannot run on client.";};

private ["_center","_areaSize","_seed","_blacklist","_debug","_buildings","_pos","_posX","_posY","_posTotal","_seedLocal"];
_center = _this select 0;
_areaSize = if (count _this > 1) then {_this select 1} else {1000};
_seed = if (count _this > 2) then {_this select 2} else {1138};
_blacklist = if (count _this > 3) then {_this select 3} else {[]};
_debug = if (isnil "_debug") then {false} else {_debug};

if (typename _center == typename "") then {_center = markerpos _center};
if (typename _center == typename objnull) then {_center = position _center};

if (_areaSize < 0) then {_areaSize = 1000;};
if (_seed < 0) then {_seed = 1138;};

_seed =  round(_seed % 42);
if (_seed == 0) then {_seed = 42;};

_buildings = _center nearobjects ["house",_areaSize];
_buildings = _buildings - _blacklist;
{
_pos = position _x;
_posX = _pos select 0;
_posY = _pos select 1;
_posTotal = _posX + _posY;
_seedLocal = (_posTotal % _seed) / _seed;

if (_seedLocal < 0.5) then {
	//_x setdamage 1;
	for "_i" from 1 to 7 do {
		_x sethit [format ["dam%1",_i],1];
		_x sethit [format ["dam %1",_i],1];
	};
	if (_debug) then {_marker =_x call bis_fnc_boundingboxmarker; _marker setmarkercolor "colorred";};
} else {
	if (_seedLocal > 0.9) then {
		//_x hideobject true;
		_x setdamage 1;
		if (_debug) then {_marker =_x call bis_fnc_boundingboxmarker; _marker setmarkercolor "colorblue";};

	} else {
		_x setdamage 0.5;
		if (_debug) then {_marker =_x call bis_fnc_boundingboxmarker; _marker setmarkercolor "colorgreen";};
	};
};
} foreach _buildings;

true

The call:

go = [rasman,500,42] spawn fnc_Destroy

I tried this from the init.sqf aswell as from the mission within, in a unit init.

I cant get the city destroyed before the mission starts, means the player doesnt spawn into a destroyed enviroment.

Any concrete hints on that?

Share this post


Link to post
Share on other sites

As far as I know it is not possible to destroy the city before the mission starts.

Try to destroy an object ([0, 0, 0] nearestObject x setDamage 1) in init.sqf: It will happen after the mission starts.

Share this post


Link to post
Share on other sites

How does one make bis_fnc_destroyCity destroy ALL buildings in the indicated zone? I'm after total destruction, here :)

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  

×