Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Few questions
Re: Few questions [message #408905 is a reply to message #408903] Sat, 31 October 2009 06:43 Go to previous messageGo to previous message
cAmpa is currently offline  cAmpa
Messages: 597
Registered: March 2006
Karma:
Colonel
Hubba wrote on Sat, 31 October 2009 13:56

cAmpa wrote on Sat, 31 October 2009 05:41

Hubba wrote on Sat, 31 October 2009 12:21

Quote:



When you change character, you are an entirely new GameObject *, so the script that was attached to you previously is destroyed, because the object that the script was attached to no longer exists.
When you purchase a vehicle, the script is attached to the vehicle, if you killed the vehicle then you would no longer get the message. The same principle can be applied to changing your character, it's kinda like you killed your character by getting a new one.
You can never permanently attach a script to a players character, unless they are gauranteed to never be killed.
You can however, keep re-attaching the same script to a player whenever they are created.




So what should i attach the script to? Should i create a invisible object and attach the script to it and then when everything is done it would destroy the invisible object?

--------------------------------------
Another question
How can i check if a player has a weapon?
bool Has_Weapon(GameObject *obj,const char *weapon)

I tried something like this:
if(Has_Weapon(obj,"POW_Railgun_Player")){
//Do something...
}

But it doesn't seem to work Huh






You checked for a powerup, not for a weapon.




Oops didn't notice that, Thanks cAmpa Smile
If someones wondering it should be "Weapon_Railgun_Player" instead of "POW_Railgun_Player"
----------------------------------
Another question:
Is there a way to check if a character has a "fly suit"

My fly command looks like this:
class flyChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
	GameObject *obj = Get_GameObj(ID);

        Toggle_Fly_Mode(obj);

     }
};
ChatCommandRegistrant<flyChatCommand> flyChatCommandReg("!fly",CHATTYPE_ALL,0,GAMEMODE_AOW);




bool Get_Fly_Mode(GameObject *obj); //is this infantry flying via Set_Fly_Mode

Just search in the engine files headers, like "engine_obj2.h".


Bückstabü!
 
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: CnC Reborn : Jumpjet Animation Test
Next Topic: PimPen Harvy
Goto Forum:
  


Current Time: Sun Dec 15 08:51:54 MST 2024

Total time taken to generate the page: 0.01024 seconds