Author Topic: Projectiles not spawning in the correct position  (Read 996 times)

Here's the entire function I'm working with
Code: [Select]
function armageddon_spawnProjectile(%intensity)
{
%scale = vectorScale("1 1 1",getRandom(5 + %intensity,15 + %intensity) / 10);
%pos = getRandom(-1000,1000) SPC getRandom(-100,100) SPC 200;
%vel = getRandom(-20,20) SPC getRandom(-20,20) SPC -1 * (%intensity * getRandom(10,20));
%client = findclientbyname("treynolds416");
echo("fired at " @ %vel @ " fired from " @ %pos @ " at scale " @ %scale);
%p = new Projectile()
{
scale = %scale;
dataBlock = tankShellProjectile;
initalPosition = %pos;
initialVelocity = %vel;
sourceObject = %client.player;
sourceSlot = 0;
client = %client;
};
MissionCleanup.add(%p);
}

I've tried it with and without the sourceObject, sourceSlot, and client fields (even though I shouldn't need them). What's happening is that the tank projectile spawns at exactly 0 0 0 and explodes instantaneously. Scaling seems to work just fine, but the explosion never changes position. Clearly, something is wrong with the initiailPosition and (probably) the initialVelocity fields. The echoes look fine, I'm not sure what's going on

You need to set position and rotation too

You need to set position and rotation too
Did not work

rotation @ "0", "0 0 0 0", and "1 0 0 -90"
position @ %pos

You need to set position and rotation too

.. no? All you need is the datablock field. The others are optional.

.. no? All you need is the datablock field. The others are optional.
...he wants to spawn it at a certain position

...he wants to spawn it at a certain position

Yes? Technically, all you need for that is datablock and initialPosition. You said position and rotation were required (which are completely ignored).

It's because he misspelled initialPosition as "initalPosition".

It's because he misspelled initialPosition as "initalPosition".
oh god

It's because he misspelled initialPosition as "initalPosition".
figures