Aller au contenu

Photo

Door Transition Events - Enable a Map Pin (solved)


  • Veuillez vous connecter pour répondre
9 réponses à ce sujet

#1
Darin

Darin
  • Members
  • 282 messages
 Apparently, in NWN1, you could fire a script when a door transitions; is there any way to do so in NWN2?  If not, when does OnUsed() event for a door fire?

Trying to use GetTransitionTarget(OBJECT_SELF) to allow me to enable a map note on the other side of the door (because you know where you just cam from; so Kitchen to Basement would enable a note in the basement that states "to kitchen" and vice versa).

Hint - this failed (in door on used script):
  • void main()
  • {
  •       SetMapPinEnabled(GetTransitionTarget(OBJECT_SELF));
  • }

Modifié par EpicFetus, 09 juin 2013 - 11:49 .


#2
kevL

kevL
  • Members
  • 4 075 messages
this is typically bizarre.

Here's the script I used:

void main()
{
  object oDebug = GetFirstPC(FALSE);
  SendMessageToPC(oDebug, "run ( kg01_to_kg09_ou ) " + GetName(OBJECT_SELF));

  object oWp = GetTransitionTarget(OBJECT_SELF);
  SendMessageToPC(oDebug, ". Transition Target = " + GetName(oWp));

  SetMapPinEnabled(oWp, TRUE);
}

- first i put it in onUsed, and the mapnote did not enable but the transition worked.
- then i put it in onClicked, and the mapnote enabled but the transition didn't work.


Thinking back in the foggy haze of memory to NwN.. i remember having to jump through a whackload of hoops, as it were, to get event scripts on doors to happen when transitioning. Or something like that: iirc, when using a transition script then the alloted transition action won't work; in other words, you have to script the transition manually, alongside enabling the mapnote,


( or you could enable the mapnote in an onEnter script in the next area )

#3
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
I think I tried what kevL did, putting the script in the on-clicked event. Then I just added a line in the script to manually do the transition. (DoPartyTransition?).

Eventually, I think I just painted down a little trigger that activated the map note pin instead.

#4
MasterChanger

MasterChanger
  • Members
  • 686 messages
The question about door events is an interesting one in its own right, but if you're considering any map overhauls, you should probably consider Lance B's system: http://nwvault.ign.c...I.Detail&id=157

It includes Fog of War, but I think he also allows players to add their own map pins, which the default NWN2 map doesn't. And he's done the XML work already, which is always a frustrating and thankless task!

#5
diophant

diophant
  • Members
  • 116 messages
In my mod, I'm using the onEnter script of the areas. If the PC enters, get the closest waypoint, check that the distance between the waypoint and the PC is <= 2.0, and enable the map pin.

#6
Darin

Darin
  • Members
  • 282 messages
onenter can work, i do a lot of stuff there already, what's one more line...

#7
Darin

Darin
  • Members
  • 282 messages
OnEnter, or OnClientEnter?

#8
Darin

Darin
  • Members
  • 282 messages
Works in OnClient; have this in my generic "include" file:

// *** void OnClientEnterFunctions(object oArea)) *** //
void OnClientEnterFunctions(object oArea)
{
// May 30th, 2013
/*
Runs generic stuff that should be run on all OnClientEnters
*/
// Make sure time is not blank...
if(GetLocalInt(oArea,"nTimeLeft")==0)
SetTimeLeft(oArea);

//open door and set map pin
object oPC = GetFirstEnteringPC();
object oDoor = GetNearestObjectToLocation(OBJECT_TYPE_DOOR,GetLocation(oPC));
object oMap = GetNearestObjectToLocation(OBJECT_TYPE_WAYPOINT,GetLocation(oDoor));


SendMessageToPC(oPC,GetTag(oMap));
if(GetDistanceBetween(oDoor,oMap)<=3.5)
SetMapPinEnabled(oMap,TRUE);
if(GetDistanceBetween(oPC,oDoor)<=3.5)
AssignCommand(oDoor,ActionOpenDoor(oDoor));

}

#9
Tchos

Tchos
  • Members
  • 5 080 messages
It's good to use OnClientEnter, because it fires after all party members have spawned into that location, unlike OnEnter. Some scripts can fail if they involve party members, and they were fired from OnEnter.

#10
Darin

Darin
  • Members
  • 282 messages
Yeah, that's why I have custom OnClients for each area, and nothing in OnEnter... the above worked really well, but had to use the door instead of the PC due to waypoints in the middle of the room being the target instead