Cloak for rw
by Michael Collins · in General Discussion · 01/23/2003 (2:56 pm) · 14 replies
I am working on a cloak for realmwars (you run into a trigger and it cloaks you for a while) I have most of it done exept i dont know how to turn it off :P Would i have a schedule like this?
%CloakSched = schedule(15000,0,"%client.player.setCloaked(false)",%client)
thx
-Mike
%CloakSched = schedule(15000,0,"%client.player.setCloaked(false)",%client)
thx
-Mike
About the author
#2
thx
-Mike
01/23/2003 (5:50 pm)
I have a mac lol, so if anyone could give me that script id be very thankful!thx
-Mike
#3
01/24/2003 (2:29 pm)
Michael I will mail it to you over the weekend.
#4
----
function CloakStaffImage::onFire(%this, %obj, %slot)
{
//if the player is cloaked, uncloak them and restor the recharge rate
if (%obj.isCloaked())
{
%obj.setCloaked(false);
%obj.setRechargeRate(%obj.getDatablock().rechargeRate);
}
else
{
%energy = %obj.getEnergyLevel();
//if they don't have enough energy to use just return
if (%energy<20)
{
%obj.playAudio(0,SpellError);
return;
}
%obj.setEnergyLevel(%obj.getEnergyLevel()-20);
//set them cloaked, change recharge rate to lose energy
//and schedule a check of energy
%obj.setCloaked(true);
%obj.setRechargeRate(-0.1);
schedule(1000,0,"checkCloakEnergy",%obj);
}
}
//checks the energy of a cloaked player, sets them
//back to uncloaked when energy runs out
function checkCloakEnergy(%obj)
{
//if their energy is <= uncloak them
if (%obj.getEnergyLevel()<=0 && %obj.getState() !$= "Dead")
{
%obj.setCloaked(false);
%obj.setRechargeRate(%obj.getDatablock().rechargeRate);
}
//otherwise schedule another check
else schedule(1000,0,"checkCloakEnergy",%obj);
}
-------------
Hope that helps.
01/25/2003 (1:59 pm)
Oops you don't have an email address. I will just paste teh relevant parts here (with some added comments for clarity):----
function CloakStaffImage::onFire(%this, %obj, %slot)
{
//if the player is cloaked, uncloak them and restor the recharge rate
if (%obj.isCloaked())
{
%obj.setCloaked(false);
%obj.setRechargeRate(%obj.getDatablock().rechargeRate);
}
else
{
%energy = %obj.getEnergyLevel();
//if they don't have enough energy to use just return
if (%energy<20)
{
%obj.playAudio(0,SpellError);
return;
}
%obj.setEnergyLevel(%obj.getEnergyLevel()-20);
//set them cloaked, change recharge rate to lose energy
//and schedule a check of energy
%obj.setCloaked(true);
%obj.setRechargeRate(-0.1);
schedule(1000,0,"checkCloakEnergy",%obj);
}
}
//checks the energy of a cloaked player, sets them
//back to uncloaked when energy runs out
function checkCloakEnergy(%obj)
{
//if their energy is <= uncloak them
if (%obj.getEnergyLevel()<=0 && %obj.getState() !$= "Dead")
{
%obj.setCloaked(false);
%obj.setRechargeRate(%obj.getDatablock().rechargeRate);
}
//otherwise schedule another check
else schedule(1000,0,"checkCloakEnergy",%obj);
}
-------------
Hope that helps.
#5
function cloakStaff::onFire
Should i put like
function cloak::onUse?
thx
-Mike
01/28/2003 (2:03 pm)
James, thx for the script....but i was wondering what function to put instead of function cloakStaff::onFire
Should i put like
function cloak::onUse?
thx
-Mike
#6
01/28/2003 (3:34 pm)
If you have a trigger that triggers the cloak, you should put the cloak logic in that trigger code right? I'm not sure if I understand exactly what you are asking. Wherever you activate the cloak you should schedule the termination.
#7
Also semi-related, is there a distance setting somewhere I'm missing for the names. I like to make it, whereas you have to be really close to see the player name, nt from across the map.
Thx
01/28/2003 (3:57 pm)
When ever I use cloak - I have an item thats a power-up. It goes in the inventory - when the player uses it - he cloaks for 20 seconds. Works great - all but the players name is still right on top of him - kinda makes the cloak useless. Anyone know of a quick way to toggle a single player's name - ie. during cloak his name won't show, then after cloak it will. Also semi-related, is there a distance setting somewhere I'm missing for the names. I like to make it, whereas you have to be really close to see the player name, nt from across the map.
Thx
#8
01/28/2003 (11:51 pm)
Tony you should check out guiShapeNameHud if you can do C++ programming, that is the code that handles the name drawing and it is pretty straightforward.
#9
Maybe I'll catch on someday, again thanks!
01/29/2003 (9:52 am)
Thanks James, unfortunely I haven't a clue on C++ much. I'll still look at the source. I'm more of a copy and paste, getting by... by the seat of my pants guy ;) Maybe I'll catch on someday, again thanks!
#10
For example, we are making it so that different team names are rendered in different colors, energy can be displayed along with names, and you can toggle who to show. (Everyone, just your team, etc)
We can add a distance control to the gui object and also the cloaking stuff. (People on your same team will still have their name appear, others won't)
We are making these changes for Realm Wars but we realize that everyone could benefit from them so we are willing to throw stuff in that helps out others also.
01/29/2003 (2:53 pm)
Tony we are working on some changes to the player name stuff.For example, we are making it so that different team names are rendered in different colors, energy can be displayed along with names, and you can toggle who to show. (Everyone, just your team, etc)
We can add a distance control to the gui object and also the cloaking stuff. (People on your same team will still have their name appear, others won't)
We are making these changes for Realm Wars but we realize that everyone could benefit from them so we are willing to throw stuff in that helps out others also.
#11
01/29/2003 (11:27 pm)
Sounds great James. Will they be included in the head for Torque?
#12
01/30/2003 (3:03 am)
The changes will be in the HEAD for RW, which you can access if you can access Torque. I don't know if they will end up in Torque itself.
#13
I do have a e-mail ;) its 09mcollins@davis.k12.ut.us
can you mail the script to me? Because when i copyed and pasted it didnt work.
thx
-Mike
01/30/2003 (2:38 pm)
Hey James, I do have a e-mail ;) its 09mcollins@davis.k12.ut.us
can you mail the script to me? Because when i copyed and pasted it didnt work.
thx
-Mike
#14
Tanks -
The_Force
06/19/2003 (1:00 pm)
Does the RW cloak use a texture like the Tribes 2 cloak? If it does, could someone tell me how to do add that code?Tanks -
The_Force
Torque Owner James Margaris
You can look at it there, what I do is set the elf cloaked then schedule a function that checks if the elf has energy. (The cloak drains energy) If that function fails it turns off the cloak, if it passes it schedules itself to check again.