if(GetIsPC(oObject))
will return true if oObject is currently controlled by the PC.
if (oObject ==GetFirstPC())
will only return true if oObject is the actual player character.
if (GetIsPC(oObject)) is not the same as if(GetFirstPC()==oObject)
Débuté par
M. Rieder
, avril 20 2011 01:27
#1
Posté 20 avril 2011 - 01:27
#2
Posté 20 avril 2011 - 01:32
I think that if you used GetFirstPC(FALSE), then they would be the same. \\
I also believe that if(GetIsOwnedByPlaer(oObject)) would be the same as
if(oObject == GetFirstPC())
Just some refleciton on funcitons after some wierd behavior in scripts.
I also believe that if(GetIsOwnedByPlaer(oObject)) would be the same as
if(oObject == GetFirstPC())
Just some refleciton on funcitons after some wierd behavior in scripts.
#3
Posté 20 avril 2011 - 03:08
GetFirstPC() is part of a loop, it should not be used otherwise except for debug messages in single player. It should be followed by GetNextPC() and there are almost always some more accurate alternative to use instead.
Here is some info on how to reference objects depending on situation. The correct answer actually varies depending on what initiated the provided script.
GetControlledCharacter(oPC); // this is the actual character now controlled, so if you pass in oPC and its the players real character and he is controlling the familar, this will return the familar.
GetOwnedCharacter(oPC) // this does the opposite, pass in the familiar and it returns the original character in control
GetIsOwnedByPlayer(oPC) // this returns true if the object is the player, or something he controls like a familar
GetIsPC(oPC) // returns true if the player is possessing at the moment
GetIsDM(oPC) // returns true if a DM and not possessing something
GetIsDMPossessed(oPC) // returns true if possessed by a DM, use with previous function
GetMaster(oPC) // get the master of a given familar
GetAssociate(oPC) // with parameters gets familars or the like, etc. uses ASSOCIATE_TYPE_*
GetHenchman(oPC) // gets the henchman
GetFactionLeader( oPC ) // gets the leader, or the object set to be leader of the party
Here is some info on how to reference objects depending on situation. The correct answer actually varies depending on what initiated the provided script.
GetControlledCharacter(oPC); // this is the actual character now controlled, so if you pass in oPC and its the players real character and he is controlling the familar, this will return the familar.
GetOwnedCharacter(oPC) // this does the opposite, pass in the familiar and it returns the original character in control
GetIsOwnedByPlayer(oPC) // this returns true if the object is the player, or something he controls like a familar
GetIsPC(oPC) // returns true if the player is possessing at the moment
GetIsDM(oPC) // returns true if a DM and not possessing something
GetIsDMPossessed(oPC) // returns true if possessed by a DM, use with previous function
GetMaster(oPC) // get the master of a given familar
GetAssociate(oPC) // with parameters gets familars or the like, etc. uses ASSOCIATE_TYPE_*
GetHenchman(oPC) // gets the henchman
GetFactionLeader( oPC ) // gets the leader, or the object set to be leader of the party
Modifié par painofdungeoneternal, 20 avril 2011 - 03:19 .
#4
Posté 20 avril 2011 - 11:48
For single player games GetFirstPC() can be used as a "shortcut."
GetFirstPC() or GetFirstPC(TRUE) will return the players originally created character (the one they made when they first started the module).
GetFirstPC(FALSE) will return their currently controlled character (for example SoZ type party with multiple PC in the party). This will return the originally created PC if they happen to be controlling it at the time.
Personally I use:
object oMasterPC = GetFirstPC(TRUE);
object oPC = GetFirstPC(FALSE);
oMasterPC is where I save/get all variables that are to be stored. That way I know exactly which PC I am always dealing with (and therefor where to save or find variables). oPC is there for things like sending messages to the player or having something interact with the player's currently controlled character.
GetFirstPC() or GetFirstPC(TRUE) will return the players originally created character (the one they made when they first started the module).
GetFirstPC(FALSE) will return their currently controlled character (for example SoZ type party with multiple PC in the party). This will return the originally created PC if they happen to be controlling it at the time.
Personally I use:
object oMasterPC = GetFirstPC(TRUE);
object oPC = GetFirstPC(FALSE);
oMasterPC is where I save/get all variables that are to be stored. That way I know exactly which PC I am always dealing with (and therefor where to save or find variables). oPC is there for things like sending messages to the player or having something interact with the player's currently controlled character.
#5
Posté 20 avril 2011 - 12:27
Thanks for the info pain. I had always wondered about differences between single and multiplayer scripting. It is also good to know the implications of using different functions, especially for a novice like me.
Just to clarify,
GetOwnedCharacter(oPC) will only return true if oPC is the actual Player and not a controlled familiar or companion, right?
Just to clarify,
GetOwnedCharacter(oPC) will only return true if oPC is the actual Player and not a controlled familiar or companion, right?





Retour en haut






