Jump to content
Sign in to follow this  
GCB38

Buildings that receive damage from one source?

Recommended Posts

Im Making a mission that is similar to say a game of rush from BF3 and im wanting to know how i would make it to where the transmitter tower north of Agia Marina is only takes damage from/is destroyed when a satchel/explosive charge is detonated at its base. I also want to make it work for other buildings (e.g. the gas station South West of Agia and the military compound West of said gas station.

Thank you for any answers you can give. ^_^

Share this post


Link to post
Share on other sites

Attach a handleDamage event handler to it.

Something like this, this code may not be exactly what you need.

mytower addEventHandler["handleDamage",
{
_source = _this select 4;
if(_source == "SatchelCharge_Remote_Ammo") then
{
	1;
}
	else
{
	0;
};
};
];

Course you will have to figure out how to attach the eventhandler to those objects, one way is the use of nearObject & the ID of it's location which can be found through the editor by pressing ID and zooming in on the location of it.

Share this post


Link to post
Share on other sites

Thanks, but me being me, it keeps giving me an error saying I'm "missing ]" so i nubbed it up and messed with everything i could, taking out some stuff and putting in some stuff with no successful result.

Other than that ill assume that

A) I'm putting this in a module

B) I substitute myTower with nearObject 134313 <--(the obj. ID)

C) I have no idea what I'm doing :I

Sorry to have to be walked through this and hopefully I'll wake up tomorrow morning with the slightest sense of what to do.

Also: while u guys are helping me out, I've dug around the interwebs looking for a way to make per-team markers (for briefings) and have come up with nothing. i was just hoping I wouldn't have to bother u guys too much with just one thread, but hey, I guess that's why these forums exist.

Share this post


Link to post
Share on other sites

mytower addEventHandler["handleDamage",
{
   _source = _this select 4;
   if(_source == "SatchelCharge_Remote_Ammo") then
   {
       1;
   }
       else
   {
       0;
   };
} //No ; needed here
]; 

Hopefully fixed Tonic's code.

I wouldn't recommend to search objects by ID now since IDs usually change with game updates during alpha\beta, better find approximate tower coordinate and use

((nearestObjects [[1000,1000,0], ["Land_TTowerBig_1_F"], 100]) select 0)

with [1000,1000,0] being approximate tower coordinate and "Land_TTowerBig_1_F" tower class that you need. (http://community.bistudio.com/wiki/nearestObjects)

Also you'll need to put that into some logic object's init line (you'll need to remove my // comment first then) or in mission's init.sqf

Share this post


Link to post
Share on other sites

Alright, thanks guys. Ur both so awesome. It works now. All i need now is to just find the class names and coordinates of the gas station and the military HQ building and do the same.

Share this post


Link to post
Share on other sites

Well for the classnames:

"Land_FuelStation_Feed_F" <-- Pump

"Land_FuelStation_Shed_F" <-- Gas station structure

"Land_Cargo_HQ_V1_F" <-- Cargo HQ

And lol Samatra, I forgot EVH's don't use ; after } :P

Share this post


Link to post
Share on other sites

False alarm. Something odd has happened. When I add the module in, it causes nearby triggers I have tethered to the buildings via group management to not deactivate when each building is destroyed.

Example: the tower

Module:

((nearestObjects [[3000,6000,25], ["Land_TTowerBig_1_F"], 500]) select 0) addEventHandler["handleDamage", 
{      _source = _this select 4;      
if(_source == "SatchelCharge_Remote_Ammo" ||  _source == "DemoCharge_Remote_Ammo") then      
{          
   1;      
}          
   else      
{         
   0;      
};  
}  
];

Trig.:

Activation: Static Object

Cond: this

On act: tele1 = BluTele addAction ["Teleport - Agia Marina","teleport.sqf",["Agia"]];

On deact: hint "Objective 1 Destroyed! Blufor is forced into a retreat!"; BluTele removeAction tele1;

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  

×