Cloaking
by Charlie Higdon · in Torque Game Engine · 01/28/2009 (1:21 pm) · 5 replies
Are there any good resources or threads out there on cloaking?
I've looked through the resources and threads, the most promising thing I found was:
http://tdn.garagegames.com/wiki/Torque_Console_Objects_9#Cloaking
Just wondering if anyone knew much about this. I'm trying to set it up so I can press a key and have cloaking activate for my player until it drains the energy bar, hadn't decided whether to make it related to a weapon or item I pick up, or just an innate player ability.
I've looked through the resources and threads, the most promising thing I found was:
http://tdn.garagegames.com/wiki/Torque_Console_Objects_9#Cloaking
Just wondering if anyone knew much about this. I'm trying to set it up so I can press a key and have cloaking activate for my player until it drains the energy bar, hadn't decided whether to make it related to a weapon or item I pick up, or just an innate player ability.
#2
I would suggest chcking out the ShapeBase energy management code - right at the start of ShapeBase::processTick. You'd probably want to add a script callback when there is 0 energy.
To set up the system from scripts, you'd bind a 'cloak my player' function to a key press, and in that function, you set the player to cloaked and set their recharge rate to something negative so energy decreases over time. Then, when your '0 energy' callback is fired, use that function to uncloak the player and set their recharge rate back to zero.
01/29/2009 (1:09 pm)
Well, AFX isn't necessary if cloaking is in stock TGE. It's just figuring out to what extent it's working and how to set it up to link to the energy system.I would suggest chcking out the ShapeBase energy management code - right at the start of ShapeBase::processTick. You'd probably want to add a script callback when there is 0 energy.
To set up the system from scripts, you'd bind a 'cloak my player' function to a key press, and in that function, you set the player to cloaked and set their recharge rate to something negative so energy decreases over time. Then, when your '0 energy' callback is fired, use that function to uncloak the player and set their recharge rate back to zero.
#3
01/29/2009 (1:13 pm)
Fading/cloaking exists in both TGE and TGEa. Have you ever noticed that a corpse fades out before it disappears? Ever noticed that weapons and other items fade in as they respawn.
#4
%this.player.setShapeName("");
This will clear the players name above their heads.
Then maybe
%player.setShapeName(%this.name);
to get their name back.
01/29/2009 (1:26 pm)
doh, forgot about that... you'd probably want to also use;%this.player.setShapeName("");
This will clear the players name above their heads.
Then maybe
%player.setShapeName(%this.name);
to get their name back.
#5
01/29/2009 (1:28 pm)
and lookup getTransform(); for your cloaking method.
Torque Owner Jules
Something2Play