Jump to content
Sign in to follow this  
victim913

Functions and Destroy City

Recommended Posts

I am kind of lost with Functions and what they do and how they work. Learning scripting a little here and there, I still don't know much. But I want to use the BIS_fnc_destroyCity. I just don't know where or how.

I know this:

[position,areaSize,seed,blacklist] call BIS_fnc_destroyCity

I saw the wiki about it and it gives this:

["destroyBase",500,42,[bis_vila]] call bis_fnc_destroyCity

First, where do I put this?

Second: For position it gives "destroyBase". Is that some code or something?

I'm assuming since it's to destroy the city, I don't have some building that I add and name it "destroyBase".

Can I put a marker, then name it "marker1" and put this stuff in it's init?

I know what the numbers mean, but I don't know what blacklist is.

I would like to know this stuff but if worst comes to worst, at least someone can tell me exactly what to put and where for it to work. For now I want some city in Chernarus. I can play with the numbers.

And do I need functions manager or something?

Thanks, and anything else I left out

Share this post


Link to post
Share on other sites

You can call this from a script or trigger.

["destroyBase",500,42,[bis_vila]] call bis_fnc_destroyCity

"destroyBase" : in this case is a marker. You can place a marker down in the city and that will be the epicenter of destruction. you can also use a location or object.

[bis_vila] : is an array of buildings that will not be destroyed.

The last three parameters are optional. It will use the defaults if you do not define them. So all you really need to do use this function is define the location.

place a marker down named "doomedcity"

then execute this in a trigger

["doomedcity"] call bis_fnc_destroyCity;

Share this post


Link to post
Share on other sites

G'day victim913,

I am kind of lost with Functions and what they do and how they work. Learning scripting a little here and there, I still don't know much.

I still don't know much, even with almost 2 years of experience. Don't worry yourself, the key is to keep hammering away at it and believe me, you'll learn. However to answer your question, functions are like a machine that accept input(s) processes it/them and produces an output. Functions always produce one value. So in this case the inputs (which are called parameters) are given to the BIS_fnc_destroyCity function, the processing is the destruction of the target buildings and the produced output is a boolean (true or false) true when completed.

If you want to learn more about functions have a look through the scripting guide by Taurus posted here: http://forums.bistudio.com/showthread.php?t=94015&highlight=taurus+scripting+guide Belive me, it is an excellent guide and will be of much use to you.

But I want to use the BIS_fnc_destroyCity. I just don't know where or how.

I know this:

[position,areaSize,seed,blacklist] call BIS_fnc_destroyCity

I saw the wiki about it and it gives this:

["destroyBase",500,42,[bis_vila]] call bis_fnc_destroyCity

First, where do I put this?

Second: For position it gives "destroyBase". Is that some code or something?

I'm assuming since it's to destroy the city, I don't have some building that I add and name it "destroyBase".

Can I put a marker, then name it "marker1" and put this stuff in it's init?

I know what the numbers mean, but I don't know what blacklist is.

I would like to know this stuff but if worst comes to worst, at least someone can tell me exactly what to put and where for it to work. For now I want some city in Chernarus. I can play with the numbers.

And do I need functions manager or something?

Thanks, and anything else I left out

My advice to you, if your new to scripting, would be to start with simple scripts like creating triggers and destroying vehicles with script commands, to give yourself some exposure to the scripting in ArmA 2. For example, my very first script was for an IED that was triggered by a vehicle passing by.

Put a trigger down and put yourself in the trigger (you know what I mean ;P). Synchronise the trigger to you and in the onAct field of the trigger add:

_nil  = [] call BIS_fnc_help;

Now run the mission when the help module comes up, look under BIS find PMC_Environment and you should find the BIS_fnc_destroyCity function. This will give some information on some of the parameters the function requires.

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

[position,areaSize,seed,blacklist] call BIS_fnc_destroyCity

- position should be a marker that you put down on the map (in the wiki it was called destroyBase) and you write it into the function as a string like this "awsome_marker"

- areaSize, is the diameter of the destruction

- not quite sure what a seed is but use what it says on the bis wiki first then toy around with it a bit and see what happens/changes.

- a blacklist is an Array of specific buildings that you don't want to be destroyed. Buildings like:

["KFC", "mcdonalds", "Bohemia Interactive hq"]

to add this you will need to look up the classnames of the buildings - but don't worry about that now.

So basically to get this to work do the same thing as above but:

- put the trigger and yourself close to some buildings.

- put a marker down called "KABOOM_marker"

- and in the onAct of the trigger put this:

_nil = ["KABOOM_marker",500,42, []] call bis_fnc_destroyCity;

- press preview and enjoy

I know I wrote a damn essay here but I really reckon this is all worth saying.

Good Luck and never give up,

undercoverbrother

Share this post


Link to post
Share on other sites

Does this function only work on OA maps? (Not able to try it right now).

Share this post


Link to post
Share on other sites
Does this function only work on OA maps? (Not able to try it right now).

All I know is that the bis wiki says it was introduced in ArmA 2 OA version 1.56 so anything anything else other than ArmA 2 OA version 1.56 and above will not recognise the function.

undercoverbrother

Share this post


Link to post
Share on other sites

it works on chernogorsk, ive used it myself, however it appears the seed value has minimal effect as to the frequency of buildings being destroyed on that map. But it did make it look like a dump.

Share this post


Link to post
Share on other sites

I did get it working, in fact on chernogorsk, but I can't get it to destroy more than about 30-40% of the buildings. I don't mind the ones that are still standing but have damage marks, but I want it all destroyed. It doesn't make sense that a building in the middle of the block is completely leveled but the building touching it look new.

Has anyone been able to get te entire city destroyed or at least get a higher percentage destroyed? I saw a thread talking about the same thing but as usual it didn't finish. Someone probably found the answer and was satisfied and didn't bother finishing it. Then we end up with all kinds of threads about the same thing and then people get scolded for not searching even if they did.

So, anyone know how to increase the rate of destruction? The seed is just some randomness thing. I assume if you use the same number all the time, the same buildings will be destroyed?

Also, what is the number minimum and maximum for seed?

I want to see if we can at least get the most out of this thread for future seekers.

Thanks

Share this post


Link to post
Share on other sites

Just a quick script:

private ["_cityPos","_nearHouses","_percent"];

_cityPos = _this select 0;
_dst = _this select 1;
_percent = _this select 2;

//building damage
_nearHouses =  nearestObjects[_cityPos, ["house"], _dst];
{
   if (round(random 100) <= _percent) then
   {    
       _x setDamage 1;
   }
   else
   {
       _x setDamage 0.8;
   };
}foreach _nearHouses;

Save it as destroyCity.sqf, then you can call it

[position,radius,percentage] execVM "destroyCity.sqf";

eg: [getMarkerPos "someCity",500,80] execVM "destroyCity.sqf";

percentage means that around the x percent of houses will be totally destroyed, the rest is heavily damaged.

This is just a quick script, may contain some errors, haven't really tested it. :)

Share this post


Link to post
Share on other sites

Has anyone got the blacklist to work with this? I looked up the classname of the OA Mosque but when I call the function, I get an error about the mosque name being an undefined variable. The destruction part works fine, but the blacklist is ignored.

To start with I was calling it like this. SR_Destroy was a game logic.

[sR_Destroy,500,42] call bis_fnc_destroyCity;

then I decided I didn't want one of the Mosque's walls to be destroyed so I tried this;

[sR_Destroy,500,42,[Land_A_Mosque_big_wall_EP1]] call bis_fnc_destroyCity;

Wall still falls. I tried making SR_Destroy a marker, tried putting quotes around the center, the classname and both, wall still falls. Putting quotes around the marker/object name breaks the script and nothing happens except the 'undefined..' error. Putting quotes around the blacklist items does nothing.

Actually just now I changed the random seed to the default 1138, and the wall wasn't touched. Then I tried some other values and it seems like certain values favour certain objects. The blacklist is still ignored though. Can anyone throw any light on this?

Edited by 2nd Ranger

Share this post


Link to post
Share on other sites

I still haven't gotten this to work correctly. It just does what it wants. Changing values don't change anything. Maybe the size, but I tried it on Chernarus and some buildings are not destroyable to begin with. But anywhere else I have not gotten any accuracy. That is why I want BI to unblock the headers on their pbo's so I can see how they did it.

Share this post


Link to post
Share on other sites

some buildings in chernarus are missing damage models, and certain buildings like the bank building in chernogorsk and the factory are indestructible (to my tests at least, i have not been able to destroy them)

however you can add more immersion by calling bis_effects_burn on some buildings so they look like they are on fire (mind how many you put down because all the smoke particles can lag alot)

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  

×