I would like to enable a certain circumstance eg if a companion triggers a conversation; then that companion becomes oPC and the scripts inside that conversation only effect the companion; in this case a script that is potentially a trap.
so would this be the proper way? :
object oSpeaker = GetPCSpeaker();
object oPC = GetControlledCharacter(oSpeaker);
I have used GCC() for triggers but not so often in conversations for this type of "who is talking" instance.
GetControlledCharacter() or GetPCSpeaker() ?
Débuté par
Morbane
, avril 26 2012 08:36
#1
Posté 26 avril 2012 - 08:36
#2
Posté 26 avril 2012 - 09:38
What sort of trigger are ya using? offhand, I'd say GetPCSpeaker( ) would identify a companion, if a companion is the controlled conversationalist ..
needs test tho,
needs test tho,
#3
Posté 26 avril 2012 - 10:55
I guess I mis-stated my usage - the conv is indeed started by a trigger.
To be honest, I think I already solved this issue but I was looking for any possible alternatives that I may have overlooked.
To be honest, I think I already solved this issue but I was looking for any possible alternatives that I may have overlooked.
#4
Posté 26 avril 2012 - 01:41
so... what was the solution? What about oPC = GetLastSpeaker?
#5
Posté 27 avril 2012 - 08:02
I have to do some testing to be positive - I have rewired some ga_ scripts and have to build in a test into the scenario...
#6
Posté 27 avril 2012 - 02:46
The easiest way would be to use the tag of the companion, if in SP only. As far as I know, GetPCSpeaker() only works if the script is called from a conversation. IF you use GetPCSpeaker() in an OnEnter event of a trigger, it won't return anything.
If you are in MP, I believe that GetFirstEnteringPC() may be effective, but that may only work for OnClientEnter scripts. If GetFirstEnteringPC() does not work for triggers, then I would do this:
object oEnter = GetEnteringObject();
object oPC;
if (!GetIsPC(oEnter))
{return;}
else
{oPC=oEnter;}
This way, oPC becomes the first PC to enter the trigger.
Now, if you want to make sure that the original owned character doesn't trigger the trigger then use:
if ((!GetIsPC(oEnter))||
(GetIsOwnedCharacter(oEnter))
{return;}
This will make sure the script only runs for non-pc owned characters, so that only companions would fire it. Keep in mind, in an MP environment, it would not fire for the owned characters of your companions, so if in MP environment, if you only wanted the main PC to not trigger it, I think you would do this, not entirely sure and definitely not tested.
if ((!GetIsPC(oEnter))||
(GetFirstPC() == oEnter))
{return;}
You can try these. I've never scripted to your particular scenario before, but these seem like they should work.
If you are in MP, I believe that GetFirstEnteringPC() may be effective, but that may only work for OnClientEnter scripts. If GetFirstEnteringPC() does not work for triggers, then I would do this:
object oEnter = GetEnteringObject();
object oPC;
if (!GetIsPC(oEnter))
{return;}
else
{oPC=oEnter;}
This way, oPC becomes the first PC to enter the trigger.
Now, if you want to make sure that the original owned character doesn't trigger the trigger then use:
if ((!GetIsPC(oEnter))||
(GetIsOwnedCharacter(oEnter))
{return;}
This will make sure the script only runs for non-pc owned characters, so that only companions would fire it. Keep in mind, in an MP environment, it would not fire for the owned characters of your companions, so if in MP environment, if you only wanted the main PC to not trigger it, I think you would do this, not entirely sure and definitely not tested.
if ((!GetIsPC(oEnter))||
(GetFirstPC() == oEnter))
{return;}
You can try these. I've never scripted to your particular scenario before, but these seem like they should work.
Modifié par M. Rieder, 27 avril 2012 - 02:52 .
#7
Posté 27 avril 2012 - 06:10
Well I would like to reserve the choice of either the main PC or a companion - the reason being : the guinea pig factor : make the companion "taste the potion" or something similar...
So... in the instances I am trying to code for are trigger activated events and/or conversations designed to affect the controlled character. Not exclude any particular trigger enterer.
So... in the instances I am trying to code for are trigger activated events and/or conversations designed to affect the controlled character. Not exclude any particular trigger enterer.





Retour en haut







