Throwing stuff..
by Phil Carlisle · in Torque Game Engine · 12/28/2002 (4:38 pm) · 7 replies
Ive got a function I need to make work.. its meant to throw a bomb from my inventory (i.e. it doesnt exist, its just a value from my inventory).
function serverCmdThrowBomb(%client)
{
echo("Got a command to throw a bomb\n");
//%client.player;
}
anyone any idea how to fill in the rest to throw a "Bomb" item when this function gets called?
Phil.
function serverCmdThrowBomb(%client)
{
echo("Got a command to throw a bomb\n");
//%client.player;
}
anyone any idea how to fill in the rest to throw a "Bomb" item when this function gets called?
Phil.
About the author
Recent Threads
#2
where one is how many of the object you want to throw
and data is the datablock name
12/28/2002 (11:25 pm)
function serverCmdThrow(%client,%data)
{
%client.getControlObject().throw(%data, 1 );
}where one is how many of the object you want to throw
and data is the datablock name
#3
If you want it to detonate, just have it spawn a projectile and decrease the amount in your inventory.
12/30/2002 (6:20 pm)
do you just want to throw it so it can be picked back up, or do you want to throw it and have it detonate, like a grenade?If you want it to detonate, just have it spawn a projectile and decrease the amount in your inventory.
#4
12/31/2002 (7:29 am)
The ShapeBase::throw() command Ken is refering to is a script function in fps/server/sctipts/inventory.cs, in case you want to see how it's done.
#5
I think its a bug because the mInitialPosition variable wasnt updated when the onAdd function was called, normally explosions are triggered off of projectiles, but projectile's explode function calls a function on the explosion which updates mInitialPosition and mInitialNormal.. (setInitialDefault or something).
I added a line that initialised the explosion position during onAdd and it worked fine from there.
Thanks for the suggestions.
Phil.
12/31/2002 (8:11 am)
I figured out the throw syntax eventually with a lot of help on IRC, but then found that explosions wouldnt work properly if you created them by hand.I think its a bug because the mInitialPosition variable wasnt updated when the onAdd function was called, normally explosions are triggered off of projectiles, but projectile's explode function calls a function on the explosion which updates mInitialPosition and mInitialNormal.. (setInitialDefault or something).
I added a line that initialised the explosion position during onAdd and it worked fine from there.
Thanks for the suggestions.
Phil.
#6
01/01/2003 (10:18 am)
Phil... the explosion object is not network aware, and cannot normally be create from scripts on the server (I might have fixed that, but can't remember off hand). Explosions are usually created on the client by ghosted objects. That could be part of your problem.
#7
01/01/2003 (10:20 am)
ah, re-reading your last post... I guess I didn't fix it :)
Torque Owner Edward Smith
Silencersoft