Home » Renegade Discussions » Mod Forum » Stealth command help
Re: Stealth command help [message #408166 is a reply to message #407893] |
Sat, 24 October 2009 05:44 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
Hubba
Messages: 40 Registered: October 2009
Karma: 0
|
Recruit |
|
|
Okey i have been trying to get it work but i dont know what is wrong.
I changed my level_load code to:
char message[256];
for (int a = 0; a < 128; a++){
IsPlayerStealth[a] = false;
sprintf(message,"msg Set all to false","");
Console_Input(message);
The message was just to see if it acctully load that part. I see the messages in console.
Then I changed join_hook
For (int a = 0; a < 128; a++){
if(IsPlayerStealth[a] == false){
Commands->Enable_Stealth(Get_GameObj(a),true);
char message[256];
sprintf(message,"msg Set stealth to all true","");
Console_Input(message);
}
I get the "Set stealth to all true" 128 times in console when some1 joins. But ofcourse you dont get stealth when you join because you change character to "GDI Soldier or Nod Soldier" after the stealth code.
But then if another player joins he should see the other guy stealth since "isPlayerStealth" is still false to the first guy.
Now i'm really confused this should work...
Btw when is script 4.0 gonna be realesed?
[Updated on: Sat, 24 October 2009 05:47] Report message to a moderator
|
|
|
Re: Stealth command help [message #408167 is a reply to message #408166] |
Sat, 24 October 2009 05:47 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/20886.jpg) |
cAmpa
Messages: 597 Registered: March 2006
Karma: 0
|
Colonel |
|
|
Hubba wrote on Sat, 24 October 2009 14:44 | Okey i have been trying to get it work but i dont know what is wrong.
I changed my level_load code to:
char message[256];
for (int a = 0; a < 128; a++){
IsPlayerStealth[a] = false;
sprintf(message,"msg Set all to false","");
Console_Input(message);
The message was just to see if it acctully load that part. I see the messages in console.
Then I changed join_hook
For (int a = 0; a < 128; a++){
if(IsPlayerStealth[a] == false){
char message[256];
sprintf(message,"msg Set stealth to all true","");
Console_Input(message);
Commands->Enable_Stealth(Get_GameObj(a),true);
}
I get the "Set stealth to all true" 128 times in console when some1 joins. But ofcourse you dont get stealth when you join because you change character to "GDI Soldier or Nod Soldier" after the stealth code.
But then if another player joins he should see the other guy stealth since "isPlayerStealth" is still false to the first guy.
Now i'm really confused this should work...
Btw when is script 4.0 gonna be realesed?
|
It will work and probably crash.
Quote: | GameObject *obj = Get_GameObj(a);
if (obj)
{
Commands->Enable_Stealth(obj,true);
}
|
Bückstabü!
|
|
|
Re: Stealth command help [message #408168 is a reply to message #408167] |
Sat, 24 October 2009 06:02 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
Hubba
Messages: 40 Registered: October 2009
Karma: 0
|
Recruit |
|
|
Hmm... Ok got it to work like this:
player 1 joins the game and is Un-Stealthed
player 2 joins the game and player 1 gets a Stealth suit
But player 2 can still see player 1 un-stealthed.
Why?
EDIT: added the join_hook as a command and it works.
So the problem is that player 1 gets the stealth suit. Because player 2 joins the game but the script goes on before player 2 is inside the game. So now i need a way to make players to be inside the game before the script start... hm. Any1 got any ideas?
[Updated on: Sat, 24 October 2009 06:10] Report message to a moderator
|
|
|
Re: Stealth command help [message #408309 is a reply to message #407893] |
Sun, 25 October 2009 13:17 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
Hubba
Messages: 40 Registered: October 2009
Karma: 0
|
Recruit |
|
|
Hmmm... still can't get it to work.
But does anyone know this? I want to check the current character a player has. I thought something like this:
if (obj = "CnC_Nod_Minigunner_0") {
...
}
Are there a site with all the functions/methods like Get_Player_ID, Get_Player_Name, Get_Player_Name_By_ID etc etc... ?
[Updated on: Sun, 25 October 2009 13:18] Report message to a moderator
|
|
|
|
Re: Stealth command help [message #408316 is a reply to message #408313] |
Sun, 25 October 2009 14:18 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
Hubba
Messages: 40 Registered: October 2009
Karma: 0
|
Recruit |
|
|
reborn wrote on Sun, 25 October 2009 14:44 | The method I posted should work, I just did not have time this morning to go through it. I would try to focus on the method I suggested rather than string comparisons.
What you would need to do BTW for the method you was just trying is get_preset_name, or something to that effect, then strstr.
http://www.cplusplus.com/reference/clibrary/cstring/strstr/
|
The problem is that the script goes on before the player is ingame. If the script would execute first when the player has fully loaded the game it would work i think.
|
|
|
Re: Stealth command help [message #408328 is a reply to message #407893] |
Sun, 25 October 2009 15:54 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
So you're saying that they need to actually have a GameObject themselves before you use the stealth command on someone else?
In that case you could still do it on player join, just make sure you do a conditional like:
if(Get_GameObj(ID)){
// The player that joined has a GameObject, so i'll do my little loop here now...
//my loop
}
else{
// That slow ass loading fucker doesn't have a GameOnbject yet
// So I will create an object myself here, and attach a script to it that has a timer on it.
//define and initialise the pos here
Vector3 pos;
pos.X = 0.0f;
pos.Y = 0.0f;
pos.Z = 0.0f;
//Code here to create a gameobject, something like GameObject *invis = Commands->Create_Object("InvisObject", pos);
//attach script to the object here
}
Your script should basically just have a created and timer_expired event that loops every 0.5 seconds or whatever, and each iteration of it should check to see if that player ID has a gameobject yet, if it does, then do the loop to -re-set the players to stealth, if not, then do the Command->start_timer to continue the loop again...
|
|
|
Re: Stealth command help [message #408330 is a reply to message #408328] |
Sun, 25 October 2009 17:08 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
nopol10
Messages: 1043 Registered: February 2005 Location: Singapore
Karma: 0
|
General (1 Star) |
|
|
SSGM has a script called MDB_SSGM_Player or something along that line that gets attached to every player GameObject, maybe you could try editing from there.
nopol10=Nopol=nopol(GSA)
|
|
|
Re: Stealth command help [message #408347 is a reply to message #408330] |
Sun, 25 October 2009 23:35 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
nopol10 wrote on Sun, 25 October 2009 19:08 | SSGM has a script called MDB_SSGM_Player or something along that line that gets attached to every player GameObject, maybe you could try editing from there.
|
Or attach your own script from the object hook to players (just like the script nopol mentioned) that has a static bool firstspawn; variable. So on the ::Created event you have a switch like set-up...
void hubbaplayer::Created(GameObject *obj){
staticbool firstspawn = false;
if(firstspawn == false){ // Code will only be called once when the player joins
// Do the loop here
firstspawn = true;
}
}
|
|
|
Re: Stealth command help [message #408379 is a reply to message #408347] |
Mon, 26 October 2009 09:01 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
Hubba
Messages: 40 Registered: October 2009
Karma: 0
|
Recruit |
|
|
reborn wrote on Mon, 26 October 2009 00:35 |
nopol10 wrote on Sun, 25 October 2009 19:08 | SSGM has a script called MDB_SSGM_Player or something along that line that gets attached to every player GameObject, maybe you could try editing from there.
|
Or attach your own script from the object hook to players (just like the script nopol mentioned) that has a static bool firstspawn; variable. So on the ::Created event you have a switch like set-up...
void hubbaplayer::Created(GameObject *obj){
staticbool firstspawn = false;
if(firstspawn == false){ // Code will only be called once when the player joins
// Do the loop here
firstspawn = true;
}
}
|
Ok now the player is "inside" the game before the script starts but it still wont work.
For example:
Player1 joins the game the script will set stealth suit to all players (i dont know why player1 dosent get one)
Player2 join the game after player1. Player1 get then a stealth suit and player2 wont get one. But player2 can still see player1 un-stealthed.
Now i dont know what to do...
[Updated on: Mon, 26 October 2009 09:34] Report message to a moderator
|
|
|
Re: Stealth command help [message #408394 is a reply to message #408379] |
Mon, 26 October 2009 11:44 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
I've kinda lost the plot with what it is you're doing now...
Basically you want a command that allows a player to purchase a stealth suit? You seem to of changed what your final goal is somewhere along the thread, unless I am reading your posts incorrectly?
|
|
|
Re: Stealth command help [message #408395 is a reply to message #408394] |
Mon, 26 October 2009 11:53 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/24628.jpg) |
Tupolev TU-95 Bear
Messages: 1176 Registered: April 2009 Location: Rìoghachd Aonaichte
Karma: 1
|
General (1 Star) |
|
|
i think it goes like this
A player goes and buys a stealth suit, he leaves but comes back to the game with the stealth suit
i think that is what he wants
Decent people = Reaver11, ErroR, all of the mods and admins, DRNG Naffets199, Amber, Dover, GEORGE ZIMMER,Zeratul, Starbuzzzz, kane,R315r4z0r,gnoepower, Danpaul88,HaTe,WNxVerty Tiberian Technologies Generalcamo, ![Surprised](images/smiley_icons/icon_surprised.gif) , ![Thumbs Up](images/smiley_icons/thumbup.gif) . If you want me to add you on the decent peoples list PM me.
Quotes or w/e Toggle
Zeratul2400 | .AIRCRAFT KILLER YOU AR NOT JUST A BIG JACKAS AND YOU THE BIG HEAD JUST YOU CREATE GLACIER FLAYING FUCK YOU BIG JAKAS YOUR MAPS IS BAD YOU WANT I WRUGHT THIS THE MAPS IS BAD HEY IS 1 YEAR
YOUR PROMESS A CON YARD WIRH A SINGLE PLAYER POWER PLANT IN ONE
MAPS AND IS DONT JUST ACK I TELL IT ALL REPLYER IN THIS FORUM I DESLIKE YOUâ„¢ 2003
|
Zeratul PT2 zeratul2400 wrote on Mon, 10 November 2003 09:49 | GENOCIDE YOU AR NOT JUST A BIG JACKAS AND YOU THE BIG HEAD JUST YOU CREATE DUSK FLAYING FUCK YOU BIG JAKAS YOUR MAPS IS BAD YOU WANT I WRUGHT THIS THE MAPS IS BAD HEY IS ONE YEAR YOUR PROMESS A WARPATH MOD WERKING BUT IT NO WORK AND DONT JUST GENOCIDE I TELL IT ALL REPLYER IN THIS FORUM I DESLIKE YOU.
|
lolnikki6ixx wrote on Wed, 09 June 2010 05:11 | With only 14 people living in Canada, the retarded one was bound to show up around here sooner or later.
|
HaTe wrote on Sun, 04 July 2010 16:17 |
Good-One-Driver wrote on Sun, 04 July 2025 01:37 | everything is possible just need to know how to code
|
Jumping from the empire state building onto concrete head first and surviving is possible if I know how to code? Wow, teach me please.
|
CarrierII wrote on Mon, 19 November 2007 22:35 | I am in a bad mood with you, you wasted my time.
|
Altzan wrote on Wed, 30 September 2009 14:10 |
Dreganius wrote on Wed, 30 September 2009 07:27 |
Good-One-Driver wrote on Wed, 30 September 2009 09:03 | lol fuckin russians damn communists
|
That was the worst comment to this thread ever.
|
Nightma12 wrote on Wed, 08 June 2011 14:27 | your mum is a stupid language
|
|
reborn wrote on Sun, 20 November 2011 11:54 | Liquedv2, yew need to branch out a little on your thinking. I'm sure you'll twig it soon enough, but you're barking up the wrong tree.
The map is budding with new ideas and great game-play, AitcraftKiller just has to get to the root of the problem, it seems to have him pretty stumped right now.
Leaf him alone, he's doing a good job. I'm going to go out on a limb here, and say this map isn't fir you.
Anyway, this thread is really starting to lumber along, all this over some sap's map? I thought the game was dead, but this thread at least is poplar. It makes me pine for the days of yonder.
At the end of the day, life's a Beech.. Who wood of thought it?
|
Ethenal wrote on Sun, 25 March 2012 16:53 |
Azazel wrote on Sun, 25 March 2012 10:20 | 6 Players don't know how to use a tank.
|
But 1 knows how to use triggerbot!
|
[Updated on: Mon, 26 October 2009 11:53] Report message to a moderator
|
|
|
Re: Stealth command help [message #408398 is a reply to message #408394] |
Mon, 26 October 2009 12:26 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
Hubba
Messages: 40 Registered: October 2009
Karma: 0
|
Recruit |
|
|
reborn wrote on Mon, 26 October 2009 19:44 | I've kinda lost the plot with what it is you're doing now...
Basically you want a command that allows a player to purchase a stealth suit? You seem to of changed what your final goal is somewhere along the thread, unless I am reading your posts incorrectly?
|
The thing i want is when a player buys a stealth suit using command !ss. And then if another player joins the game AFTER the first player have bought the stealth suit then he should see the first guy stealth.
But I have skipped the whole command thing for now. Just to make it as simple as possible. Because i can easily add that in if i get this first thing to work:
So this is what i have:
Global array
bool IsPlayerStealth[128]; // global array
Level_load hook sets IsPlayerStealth to false to all players.
for (int a = 0; a < 128; a++){
IsPlayerStealth[a] = false;
}
Then in join_hook if IsPlayerStealth == false (which all players are) then it will add stealth suit to all of them.
for (int a = 0; a < 128; a++){
if(IsPlayerStealth[a] == false){
Commands->Enable_Stealth(Get_GameObj(a),true);
}
}
But the problem is as i explained in the example before is that The other player that joins the game after the first player still will see the other player un-stealthed even if he gets a Stealth_suit.
+ I have also tried to use ObjectHookCall so the script gets called after the player is ingame. But that wont work either.
[Updated on: Mon, 26 October 2009 12:28] Report message to a moderator
|
|
|
Re: Stealth command help [message #408403 is a reply to message #407893] |
Mon, 26 October 2009 12:43 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
Why do you not just change the player to the SBH preset, and then re-grant them all the weapons and amount of ammo they previously had, and set there health/armor to what it was too? This way it just looks like a smooth transitional state change, and everyone see's them as stealth, even the non-scripts.dll users.
|
|
|
Re: Stealth command help [message #408406 is a reply to message #408403] |
Mon, 26 October 2009 12:48 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
Hubba
Messages: 40 Registered: October 2009
Karma: 0
|
Recruit |
|
|
reborn wrote on Mon, 26 October 2009 13:43 | Why do you not just change the player to the SBH preset, and then re-grant them all the weapons and amount of ammo they previously had, and set there health/armor to what it was too? This way it just looks like a smooth transitional state change, and everyone see's them as stealth, even the non-scripts.dll users.
|
Yes i know but i dont want them to turn into the Shb preset...
And i know it should work somehow for example it works on the "wittebolx" server if you have ever played. Well i guess i have to ask witte if he could share the way he do it.
|
|
|
Re: Stealth command help [message #408447 is a reply to message #408406] |
Mon, 26 October 2009 16:31 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
nopol10
Messages: 1043 Registered: February 2005 Location: Singapore
Karma: 0
|
General (1 Star) |
|
|
Attach a script to the player who has a stealth suit that Enable_Stealth on them every few seconds through a timer event. That's a cheap method of doing it.
nopol10=Nopol=nopol(GSA)
|
|
|
Re: Stealth command help [message #408492 is a reply to message #408447] |
Mon, 26 October 2009 23:24 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
nopol10 wrote on Mon, 26 October 2009 18:31 | Attach a script to the player who has a stealth suit that Enable_Stealth on them every few seconds through a timer event. That's a cheap method of doing it.
|
That's not a great idea. He would be better pursuing and debugging the array method and re-applying when they join.
|
|
|
Re: Stealth command help [message #408520 is a reply to message #407893] |
Tue, 27 October 2009 07:04 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
Hubba
Messages: 40 Registered: October 2009
Karma: 0
|
Recruit |
|
|
How can i add this to my join hook:
GameObject *obj = Get_GameObj(ID);
Attach_Script_Once(obj,"Test_hubba","");
Without getting errors? I need to declare the "ID" somehow.
When my join_hook looks like this:
void Player_Join_Hook(int i,const char *Nick) {
VetAddPlayer(i);
if (!Data->Plugins.empty()) {
std::vector<PluginInfo*>::const_iterator it;
for (it = Data->Plugins.begin();it != Data->Plugins.end(); ++it) {
if ((*it)->Type == Plugin) {
if ((*it)->PlayerJoinHookHandle) {
(*it)->PlayerJoinHookHandle(i,Nick);
}
}
}
}
if (Settings->GameMode == 2) {
CTF_Player_Join(i);
}
}
[Updated on: Tue, 27 October 2009 07:04] Report message to a moderator
|
|
|
Re: Stealth command help [message #408543 is a reply to message #407893] |
Tue, 27 October 2009 10:11 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
'i' in the join hooks function argument list is actually the ID.
However, I would be super careful assuming they have a GameObject * at that point...
Better to do:
if(Get_GameObj(i)){
//attach the script to the player
}
else{
//create an object yourself, then attach the script to that object which waits until the player has a gameobject and has loaded (like discussed earlier).
}
[Updated on: Tue, 27 October 2009 10:13] Report message to a moderator
|
|
|
Re: Stealth command help [message #408547 is a reply to message #408543] |
Tue, 27 October 2009 11:18 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
Hubba
Messages: 40 Registered: October 2009
Karma: 0
|
Recruit |
|
|
reborn wrote on Tue, 27 October 2009 11:11 | 'i' in the join hooks function argument list is actually the ID.
However, I would be super careful assuming they have a GameObject * at that point...
Better to do:
if(Get_GameObj(i)){
//attach the script to the player
}
else{
//create an object yourself, then attach the script to that object which waits until the player has a gameobject and has loaded (like discussed earlier).
}
|
Like :
if(Get_GameObj(i)){
Attach_Script_Once(i,"Test_hubba","");
}
?
error C2664: 'Attach_Script_Once' : cannot convert parameter 1 from 'int' to 'GameObject *'
1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
|
|
|
Re: Stealth command help [message #408550 is a reply to message #408547] |
Tue, 27 October 2009 11:30 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
Hubba wrote on Tue, 27 October 2009 13:18 |
Like :
if(Get_GameObj(i)){
Attach_Script_Once(i,"Test_hubba","");
}
?
|
No, like:
if(Get_GameObj(i)){
Attach_Script_Once(Get_GameObj(i),"Test_hubba","");
}
else{
//create an object yourself, then attach the script to that object which waits until the player has a gameobject and has loaded (like discussed earlier).
}
or:
GameObject *playerobject = Get_GameObj(i);
if(playerobject){
Attach_Script_Once(playerobject,"Test_hubba","");
}
else{
//create an object yourself, then attach the script to that object which waits until the player has a gameobject and has loaded (like discussed earlier).
}
|
|
|
Re: Stealth command help [message #408554 is a reply to message #407893] |
Tue, 27 October 2009 11:56 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
Hubba
Messages: 40 Registered: October 2009
Karma: 0
|
Recruit |
|
|
Thanks that works and i know that i have to make an object.
So in ur earlier post you said i had to make something like this:
else {
Vector3 pos;
pos.X = 0.0f;
pos.Y = 0.0f;
pos.Z = 0.0f;
GameObject *invis = Commands->Create_Object("InvisObject", pos);
//Attach script to check if gameobject exists
}
Now i just how to think how to make the script for that.
EDIT-------------------------------------------------------------
Shit i got already a problem. The script wont attach to the invis object.
else {
Vector3 pos;
pos.X = 0.0f;
pos.Y = 0.0f;
pos.Z = 0.0f;
GameObject *invis = Commands->Create_Object("InvisObject", pos);
Attach_Script_Once(invis,"Test_hubba1","");
}
[Updated on: Tue, 27 October 2009 12:10] Report message to a moderator
|
|
|
|
Re: Stealth command help [message #408565 is a reply to message #408560] |
Tue, 27 October 2009 13:10 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to next message](/theme/Renegade_Forums/images/down.png) |
Hubba
Messages: 40 Registered: October 2009
Karma: 0
|
Recruit |
|
|
reborn wrote on Tue, 27 October 2009 13:29 | It absolutely will attach to an invis object. Did you remember the scripts registrant?
//edit
I see what you're doing wrong.. It's "Invisible_Object", not "Invis_Object".
|
That did the trick.
Okey i got it work. But i want you to take a look:
Join_hook
if(Get_GameObj(i)){
Attach_Script_Once(Get_GameObj(i),"Test_hubba","");
}
else {
Vector3 pos;
pos.X = 0.0f;
pos.Y = 0.0f;
pos.Z = 0.0f;
GameObject *invis = Commands->Create_Object("Invisible_Object", pos);
Attach_Script_Once(invis,"Test_hubba1","");
Test_hubba1
void Test_hubba1::Created(GameObject *obj){
Commands->Start_Timer(obj,this,1.0f,1);
}
void Test_hubba1::Timer_Expired(GameObject *obj,int ID)
{
if(Get_GameObj(ID)){
for (int a = 0; a < 128; a++){
if(IsPlayerStealth[a] == true){
Commands->Enable_Stealth(Get_GameObj(a),true);
}
}
}
else {
Attach_Script_Once(obj,"Test_hubba1","");
}
}
Test_hubba
void Test_hubba::Created(GameObject *obj){
Commands->Start_Timer(obj,this,5.0f,1);
}
void Test_hubba::Timer_Expired(GameObject *obj,int number)
{
if (number == 1){
for (int a = 0; a < 128; a++){
if(IsPlayerStealth[a] == true){
Commands->Enable_Stealth(Get_GameObj(a),true);
}
}
}
}
Now it depends on how fast you load. If i put in hubba_test1 the timer to for example 0.5 then it would be way to fast. But 1.0 works for me. But if we got a really slow player then it wouldnt work? Well i could put the timer to like 5.0 like i have in hubba_test then i would get most of the players.
Yes i dont really know if i coded anything right in hubba_test1 so if you could take a look it would be nice.
[Updated on: Tue, 27 October 2009 13:15] Report message to a moderator
|
|
|
Re: Stealth command help [message #408570 is a reply to message #408565] |
Tue, 27 October 2009 13:30 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to previous message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
Hubba wrote on Tue, 27 October 2009 15:10 |
reborn wrote on Tue, 27 October 2009 13:29 | It absolutely will attach to an invis object. Did you remember the scripts registrant?
//edit
I see what you're doing wrong.. It's "Invisible_Object", not "Invis_Object".
|
That did the trick.
Okey i got it work. But i want you to take a look:
Join_hook
if(Get_GameObj(i)){
Attach_Script_Once(Get_GameObj(i),"Test_hubba","");
}
else {
Vector3 pos;
pos.X = 0.0f;
pos.Y = 0.0f;
pos.Z = 0.0f;
GameObject *invis = Commands->Create_Object("Invisible_Object", pos);
Attach_Script_Once(invis,"Test_hubba1","");
Test_hubba1
void Test_hubba1::Created(GameObject *obj){
Commands->Start_Timer(obj,this,1.0f,1);
}
void Test_hubba1::Timer_Expired(GameObject *obj,int ID)
{
if(Get_GameObj(ID)){
for (int a = 0; a < 128; a++){
if(IsPlayerStealth[a] == true){
Commands->Enable_Stealth(Get_GameObj(a),true);
}
}
}
else {
Attach_Script_Once(obj,"Test_hubba1","");
}
}
Test_hubba
void Test_hubba::Created(GameObject *obj){
Commands->Start_Timer(obj,this,5.0f,1);
}
void Test_hubba::Timer_Expired(GameObject *obj,int number)
{
if (number == 1){
for (int a = 0; a < 128; a++){
if(IsPlayerStealth[a] == true){
Commands->Enable_Stealth(Get_GameObj(a),true);
}
}
}
}
Now it depends on how fast you load. If i put in hubba_test1 the timer to for example 0.5 then it would be way to fast. But 1.0 works for me. But if we got a really slow player then it wouldnt work? Well i could put the timer to like 5.0 like i have in hubba_test then i would get most of the players.
Yes i dont really know if i coded anything right in hubba_test1 so if you could take a look it would be nice.
|
hubba_test1 is not correct, infact it's wrong on several levels...
I am watching a movie and do not have time to correct it for you right now. However, the following is something that when I was first looking at the API and trying to figure shit out, I would of appreciated someone showing me...
void Test_hubba1::Created(GameObject *obj){
Commands->Start_Timer(obj,this,1.0f,1); //number 1 at the end is kinda like a unique timer event...
}
void Test_hubba1::Timer_Expired(GameObject *obj,int number){
if(number == 1){ // this here is your number 1 from the previous comment
// do some crap here, check if the dude has a GameObject yet...
Commands->Start_Timer(obj,this,1.0f,1); // omg, it will loop again every second forever...
}
}
void Test_hubba1::Created(GameObject *obj){
Commands->Start_Timer(obj,this,1.0f,1);
Commands->Start_Timer(obj,this,10.0f,2);
Commands->Start_Timer(obj,this,50.0f,3);
}
void Test_hubba1::Timer_Expired(GameObject *obj,int number){
if(number == 1){// this is triggered after a seconds...
}
else if(number == 2){// this is triggered after 10 seconds...
}
else if(number == 3){// this is triggered after 50 seconds...
}
}
void Test_hubba1::Created(GameObject *obj){
Commands->Start_Timer(obj,this,1.0f,1); //number 1 at the end is kinda like a unique timer event...
}
void Test_hubba1::Timer_Expired(GameObject *obj,int number){
if(number == 1){
if(1 == 1){ // Just an example conditional.. you could for example check to see if the player is a gameobject here!!! :0
printf("1 equals 1");
Commands->Start_Timer(obj,this,1.0f,1);
}
else{// one does not equal 1, this is a break in the timer loop... The conditional does not pass, and there is no timer start in this statment
}
}
}
|
|
|
Goto Forum:
Current Time: Fri Aug 16 15:22:20 MST 2024
Total time taken to generate the page: 0.01304 seconds
|