Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Stealth command help
Re: Stealth command help [message #407939 is a reply to message #407923] Wed, 21 October 2009 18:26 Go to previous messageGo to previous message
YazooGang is currently offline  YazooGang
Messages: 742
Registered: August 2008
Location: US
Karma:
Colonel
Reattaching the script when player joins is a hard thing i would ignore that.
Here is what i got and hope it works!

I havent compiled or tested this so please tell me if somethings word ok?
Ok, so what this does is when you type in command !ss it takes your money and attaches you a "Hubba_Stealth" scripts. The script is a timer and what this does is activates a timer that is over in 0.01 and it enables Stealth event in your character and then it starts another timer that is over in 3 seconds. So, why is the first one 0.01(sec) and this one is 3(sec) because when you type in !ss you will have to wait 3 seconds to have a stealth event. So now when you type in !ss you will have it in less than a second. So, then when 3 seconds is over it will give you stealth effect again replace or whatever the original one and start another time. This will loop untill you die. So, when a person joins, your chars stealth will be enabled in every 3 seconds and that new person will see you as a stealth soldier. Good luck!



gmmain.CPP (replace the original command with this)

class StealthChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
	GameObject *obj = Get_GameObj(ID);
	float Credits = Commands->Get_Money(obj);

	if(Credits >= 1000){	
		Commands->Give_Money(obj,-1000,false);
			char message[256];
				sprintf(message,"msg %s bought a Stealthsuit", Get_Player_Name_By_ID(ID));
				Console_Input(message); 
					//Commands->Enable_Stealth(obj,true);
					Commands->Attach_Script(obj,"Hubba_Stealth","");
		}
	else {
	Console_Input(StrFormat("ppage %d You need $1000.",Get_Player_ID(obj)).c_str());  
	}
}
};
ChatCommandRegistrant<StealthChatCommand> StealthChatCommandReg("!ss",CHATTYPE_ALL,0,GAMEMODE_AOW);


gmmain.CPP - add this also

void Hubba_Stealth::Created(GameObject *obj)
{
Commands->Start_Timer(obj,this,0.01,1);
}	

void Hubba_Stealth::Timer_Expired(GameObject *obj,int number)
{
 	if (number == 1){
	Commands->Enable_Stealth(obj,true);

 Commands->Start_Timer(obj,this,3,1);
	}
}
ScriptRegistrant<Hubba_Stealth> Hubba_Stealth_Registrant("Hubba_Stealth","");


gmmain.H - add this also, its for the script Hubba_Stealth

class Hubba_Stealth : public ScriptImpClass {
void  Created(GameObject *obj);
void Timer_Expired(GameObject *obj,int number);
};



And last thing is to test it out. If it works have fun, no credits needed.

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: I need of a modified scripts.dll
Next Topic: Level Edit Problem
Goto Forum:
  


Current Time: Sat Dec 21 19:26:17 MST 2024

Total time taken to generate the page: 0.01524 seconds