Author Topic: spawn placeable near another?  (Read 311 times)

Legacy_lordofworms

  • Sr. Member
  • ****
  • Posts: 422
  • Karma: +0/-0
spawn placeable near another?
« on: September 28, 2010, 10:44:06 pm »


               Is it posible to spawn another placeable always (if looking from a top down view) on top of it?

so for example looking straight down X is the placeable I spawn at a waypoint, and "N" is where I would always want to spawn the additional placeable (without resorting to using another waypoint, since the first one randomly changes its position.


                        Looking Top-Down

                                             N
                                             |
                                  W---   X  ---- E
                                             |
                                             S

? possible I hope using vectors and other stuff I know nothing about? 'Image
               
               

               
            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
spawn placeable near another?
« Reply #1 on: September 28, 2010, 11:10:10 pm »


               Don't have a scripted solution for you, just can say that yes, this is possible to be done using vectors and locations.
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
spawn placeable near another?
« Reply #2 on: September 28, 2010, 11:12:02 pm »


               I haven't tested this but this is the gist of it:


void main()
{
object oArea = GetArea(OBJECT_SELF);
vector vVector = GetPosition(OBJECT_SELF) + Vector(1.0, 0.0, 0.0);//east
//vector vVector = GetPosition(OBJECT_SELF) + Vector(-1.0, 0.0, 0.0);//west
//vector vVector = GetPosition(OBJECT_SELF) + Vector(0.0, 1.0, 0.0);//north
//vector vVector = GetPosition(OBJECT_SELF) + Vector(0.0, -1.0, 0.0);//south
location lSpawn = Location(oArea, vVector, 0.0);
object oObject = CreateObject(OBJECT_TYPE_PLACEABLE, "res ref", lSpawn);
}


And of course you could replace OBJECT_SELF with something more specific. And you could change the distance from 1, -1 to whatever you want(2,3,4,-2,-3,-4,etc).

Hope that helps
               
               

               
            

Legacy_lordofworms

  • Sr. Member
  • ****
  • Posts: 422
  • Karma: +0/-0
spawn placeable near another?
« Reply #3 on: September 29, 2010, 10:55:30 pm »


               awesome!! that did the trick exactly as I wanted. I can't thank you enough!