Aller au contenu

Photo

spawn placeable near another?


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
lordofworms

lordofworms
  • Members
  • 252 messages
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 IPB

#2
_Knightmare_

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

#3
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
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

#4
lordofworms

lordofworms
  • Members
  • 252 messages
awesome!! that did the trick exactly as I wanted. I can't thank you enough!