OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: bedges on 15 Sep 2005, 23:25:59

Title: everything in the circle...
Post by: bedges on 15 Sep 2005, 23:25:59
i'm scripting a little summ'n summ'n, akin to a nuke; basically it destroys everything in a circular area. the way i've done it to date is less than optimal.

basically i've defined the centre point and then go round in ever increasing circles finding the closest object and setting its damage to 1. naturally, to keep it fairly fast i've set the degrees to increment by about 11.25 and the radius by about 5. this along with the eye candy makes it almost perfect.

almost is not good enough, however, as in the case of closely placed objects, nearestobject picks one and leaves the other - if there are enough objects in the area, some are inevitably missed. this destroys the effect of an all-encompassing fireball, what with loons running about inside going "ha ha you missed me"...

is there a way of building a fine enough mesh, using maths, to catch all objects within a 50 metre radius, while maintaining script speed?
Title: Re:everything in the circle...
Post by: Tyger on 16 Sep 2005, 00:03:46
{_x setDammage 1} forEach thislist?
and setPos the trigger to teh impact spot?
Title: Re:everything in the circle...
Post by: bedges on 16 Sep 2005, 00:20:34
ah now, i should have explained, this is scripting only. nothing can be added to the editor. yep, a trigger would have been my guess too, but it needs to be exclusively scripted, so as to be addable to any mission/campaign without opening in the editor...

i'm currently gridifying the circle with half radii, quarter radii, eighth radii and so on. it's performing well enough, but as yet there are still those few good loons left standing...  :-\
Title: Re:everything in the circle...
Post by: Tyger on 16 Sep 2005, 00:39:55
eh, well im out then

All my ideas include at least one trigger.  :P
Title: Re:everything in the circle...
Post by: The-Architect on 16 Sep 2005, 01:02:44
I think that some stuff would survive the blast. Granted loons sticking their fingers up at you totally unharmed would'nt be right but some stuff surviving is ok I think. Couldn't you run another one quickly after the first?
Title: Re:everything in the circle...
Post by: bedges on 16 Sep 2005, 01:09:13
that's the ticket - inspiration! i'll increase the degree increment, thus speeding up the blast, but then do it twice or three times slightly offset. that should catch everything within the same time.

coolio  8)
Title: Re:everything in the circle...
Post by: RujiK on 16 Sep 2005, 04:11:25
 I have an idea. Once the script is entirely done do one last nearestobject check at the end of the script and then check the distance of that object from the center of the circle.
 If the distance equals less then the radius, then re-exec the script. This will remove any remaining objects for sure, however it wont really look like an explosion but will work as a debugger.
Title: Re:everything in the circle...
Post by: Tyger on 16 Sep 2005, 18:52:02
If it's used with a nuke they could die from the radiation ;D
Title: Re:everything in the circle...
Post by: Triggerhappy on 17 Sep 2005, 18:59:40
thats some fast-acting radiation there eh tyger? ;D