Re: Few questions [message #408894 is a reply to message #408859] |
Sat, 31 October 2009 04:21 |
Hubba
Messages: 40 Registered: October 2009
Karma:
|
Recruit |
|
|
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?
--------------------------------------
[SOLVED]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
[Updated on: Fri, 06 November 2009 13:48] Report message to a moderator
|
|
|