[ANSWERED]How to manipulate vectors/locations?

I want to spawn a scripthidden object certain meters away from the caller where the caller is facing. I want that distance between the caller and the scripthidden object fixed.

The problem that i have is that i don’t know how to manipulate the distances.

Edit: I found this library which contains a function to what i asked for.

Here is the code:

    vector vMyLocation = GetPosition(OBJECT_SELF);   
	float fAngle = GetFacing(OBJECT_SELF);
	vector vSpawn = VAtAngleToV(vMyLocation,15.0,fAngle);//This function is getting a position 15meters away from where the caller is looking at.
	location lSpawn = Location(GetArea(OBJECT_SELF),vSpawn,fAngle);

	object oPoint = CreateObject(OBJECT_TYPE_CREATURE, "c_invisiblenode" , lSpawn);

just a note The stock #include ‘x0_i0_position’ seems to have an alternate

// Returns location directly ahead of the target and facing same direction as
// the target.
location GetAheadLocation(object oTarget, float fDistance = DISTANCE_MEDIUM)
    float fDir = GetFacing(oTarget);
    return GenerateNewLocation(oTarget, fDistance, fDir, fDir);
1 Like

This looks really interesting and useful. Thanks for bringing it up, Chofranc.