Greetings,
I'm trying to make script using onExit event, but I found a problem I can't manage by myself.
The problem is, that in the case of taking control on NPC by DM, the DM avatar is calling Area onExit event. What's more - leaving NPC alone does not call onEnter script.
I have easy solution of the problem in my mind, but the real problem is how to recognize the event onExit with was called by taking control on NPC. Is there any way to do this?
Thanks for help, and sorry for my "English".
Yester
PS. Is there any reverse function of GetMaster()? I mean - the function with can found NPC possesed by given DM.
DM NPC control & onExit event
Débuté par
Yester
, août 07 2010 10:55
#1
Posté 07 août 2010 - 10:55
#2
Posté 07 août 2010 - 11:17
Not sure if this is the one you are looking for.
// Returns TRUE if the creature oCreature is currently possessed by a DM character.
// Returns FALSE otherwise.
// Note: GetIsDMPossessed() will return FALSE if oCreature is the DM character.
// To determine if oCreature is a DM character use GetIsDM()
int GetIsDMPossessed(object oCreature)
#3
Posté 07 août 2010 - 11:26
Thanks for answer,
I know about this function, but using this function i can only find a NPC controlled by DM, looping through all NPC around.
It's kind of ugly solution...
The question is how to find NPC controlled by DM without looping trough all creatures in module.
Hm... Maybe there is a script called when DM is entering into creature? I couldn't find anything like that, but if You know about this kind of script I will be grateful ;-)
I know about this function, but using this function i can only find a NPC controlled by DM, looping through all NPC around.
It's kind of ugly solution...
The question is how to find NPC controlled by DM without looping trough all creatures in module.
Hm... Maybe there is a script called when DM is entering into creature? I couldn't find anything like that, but if You know about this kind of script I will be grateful ;-)
#4
Posté 07 août 2010 - 01:02
Ok,
For now i use this ugly solution, but if sombody have idea to do this better - please write a note here.
IMHO ugly solution (but still solution):
In onExit script conditional:
And function oGetIsInside:
Thanks for help, and please write if You have any better ideas.
--
Yester
For now i use this ugly solution, but if sombody have idea to do this better - please write a note here.
IMHO ugly solution (but still solution):
In onExit script conditional:
if(!GetIsDM(oPC) || !GetIsObjectValid(oGetIsInside(oPC, lArea)))
And function oGetIsInside:
object oGetIsInside(object oMaster, location lMarker){
int nWO = 1;
object oCreature = GetNearestCreatureToLocation(CREATURE_TYPE_IS_ALIVE, TRUE, lMarker, nWO);
while(GetIsObjectValid(oCreature)){
if(GetMaster(oCreature)==oMaster){
return oCreature;
}else{
nWO++;
oCreature = GetNearestCreatureToLocation(CREATURE_TYPE_IS_ALIVE, TRUE, lMarker, nWO);
}
}
return OBJECT_INVALID;
}
Thanks for help, and please write if You have any better ideas.
--
Yester
#5
Posté 07 août 2010 - 04:18
The problem is, that in the case of taking control on NPC by DM, the DM avatar is calling Area onExit event.
You mean, that if DM use posses creature, that NPC will fire OnExit event in that moment?
if so, just simple check
should do the trick I thinkif(GetIsDMPossessed(oPC)) return;
#6
Posté 08 août 2010 - 02:27
Nope
The think is, that onExit in this moment is called by DM avatar, so GetIsDMPossessed(oPC) will return false.
Maybe my solution isn't great, but it works. The question is how to find creature possessed by DM if we have only DM avatar object ;-)
Or.. Maybe there is another option to find out if onExit is executed by DM, with is currently getting control over creature.
Anyway - thanks for answer
The think is, that onExit in this moment is called by DM avatar, so GetIsDMPossessed(oPC) will return false.
Maybe my solution isn't great, but it works. The question is how to find creature possessed by DM if we have only DM avatar object ;-)
Or.. Maybe there is another option to find out if onExit is executed by DM, with is currently getting control over creature.
Anyway - thanks for answer
#7
Posté 08 août 2010 - 03:24
I bet then exiting DM avatar is not PC...





Retour en haut






