Home   Help Search Login Register  

Author Topic: Setdammage for nearestobjects buildings  (Read 1338 times)

0 Members and 1 Guest are viewing this topic.

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Setdammage for nearestobjects buildings
« on: 03 Jul 2009, 06:48:57 »
Code: [Select]

_static = nearestobjects [_pos,["Building"], _dist];
{
      [_x,_letpos,_dist] spawn {
      _dude = _this select 0;
      _letpos = _this select 1;
      _dist = _this select 2;
      _dammage=(getdammage _dude)+((_statdist^2)/(((_dude distance _pos)^2)+1));
      _posr = [getpos _dude select 0,getpos _dude select 1,getpos _dude select 2];
       _scale=(random .1) + .95;
      _dude setdammage (_dammage * _scale);
      if ((_dammage * _scale) >=1) then
      {
      deletevehicle _dude;
      };
 } foreach _static;

The buildings stand firm.

How do I solve this?

Luke
Pesky Human!!
Wort Wort Wort.

Offline Trapper

  • Honoured Contributor
  • ***
  • I'm a llama!
Re: Setdammage for nearestobjects buildings
« Reply #1 on: 03 Jul 2009, 10:20:00 »
I don't know this kind of scripting. Maybe I'm completely wrong.

First of all this wasn't originally created for a building but for a character, was it? _dude?

Some variables are defined and never used?
_letpos, _dist, _posr

Other variables are used but aren't defined?
_statdist,
_pos probably fetched from the main script call?

Then there is this bracket open and I don't find a bracket closed for it:
[_x,_letpos,_dist] spawn {

I don't understand why you would use a deletevehicle command on a map object.

Following to your topic title I would just use one simple line for everything:
_static = nearestobjects [_pos,["Building"], _dist]
{_x setdammage 1} foreach _static


PS:
You don't have to explain this script to me if it's just beyond my knowledge and I was writing crap.  ;)
« Last Edit: 03 Jul 2009, 10:24:36 by Trapper »

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Setdammage for nearestobjects buildings
« Reply #2 on: 06 Jul 2009, 05:38:47 »
Okay, got it to work, but bridges, fences, and signs do not go down.

What class names do I use for those?

Thanx, as always.

Luke
Pesky Human!!
Wort Wort Wort.