Home   Help Search Login Register  

Author Topic: Random placement in forests?  (Read 663 times)

0 Members and 3 Guests are viewing this topic.

cliff

  • Guest
Random placement in forests?
« 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?



mikeb

  • Guest
Re:Random placement in forests?
« Reply #1 on: 20 Sep 2003, 18:07:16 »
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

cliff

  • Guest
Re:Random placement in forests?
« Reply #2 on: 20 Sep 2003, 18:22:13 »
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

Offline SickSidewinder

  • Members
  • *
  • I hump llamas
    • My New Site
Re:Random placement in forests?
« Reply #3 on: 20 Sep 2003, 23:19:45 »
wow, cool
My site
call Marge.
Re: Horror

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Random placement in forests?
« Reply #4 on: 21 Sep 2003, 19:29:33 »
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
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

mikeb

  • Guest
Re:Random placement in forests?
« Reply #5 on: 21 Sep 2003, 20:40:07 »
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.

cliff

  • Guest
Re:Random placement in forests?
« Reply #6 on: 21 Sep 2003, 21:24:48 »
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