OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: cliff on 20 Sep 2003, 17:52:50
-
IÂ'm working on a hostage rescue in a forest, and trying to make the hostage appear randomly each mission by using a placement radius of about 300, the same size as the forest.
The problem is that the game engine will not allow random placement of objects in a forest. I assume this is because the forest is a object itself and therefore OFP cant place a object inside another object, if you follow me...
If I use this in a field, for example, the hostages location is randomised, but in the forest it remains at the center of the placement radius.
Bit of a bore in multiplayer Coop to find the hostage at the same spot every time...
So how do I get around this?
A "random placement" script?
-
place this in the init line of the unit
this setpos [(getpos this select 0 + random 100), (getpos this select 1 + random 100), 0]
on the map place the unit at the bottom left corner of the area you want him to appear in (as the above will add a random x and y amount, but not subtract) and his position will be randomised 100m in the positive x and y directions.
if it doesn't work just play with it! you get the idea anyway
-
Thanks for that quick and accurate reply, sometimes I tend to look for hard answers first, like writing a script for this, and then thereÂ's this obvious answer :D
Perhaps I need some of that nice old drug called sleep, to get me thinking again...
/cliff
-
wow, cool
-
anoder way is 2 use da placement radius bar in da unit placment menu ;)
btw - if ur prob have ended - solve da thread ;D
LCD OUT
-
placement radius is always the best way but i think cliff was saying that it doesn't seem to work in the forests. can't see why not but haven't tried it myself.
-
Well, my guess is because the forest is considered as one big object in itself, the game wonÂ't place another object in it in order to avoid collisions.
(unless you force it to, like using setpos)
/cliff