Author Topic: Allowed Resting Trigger  (Read 591 times)

Legacy_Snottling

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Allowed Resting Trigger
« on: August 14, 2010, 03:21:32 am »


               Hey hey! How does the Allowed Resting Trigger work? I thought it was a simple matter of putting the trigger where you wanted PC's to rest in a no-rest area, but nope, I can't get it to work. Any ideas?

Thanks 'Posted
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Allowed Resting Trigger
« Reply #1 on: August 14, 2010, 06:52:24 am »


               AFAIK there isnt "Allowed Resting" trigger in standard NWN trigger blueprints. Only X0_SAFEREST which I guess should be if you are using the x2 ambush rest system.

Anyway if you want to restrict resting to small area, you must not checked No Resting flag on area, because it dont work the way you think. Al resting system work reverse, they disallow you to rest if you are not in resting zone and the game engine hopefully do not strip boosts from you if the rest is canceled in first second.

BTW I got Allow Resting Trigger, see this code:
Trigger OnEnter

void main()
{
object oPC = GetEnteringObject();
 if(GetIsPC(oPC))
 {
 SetPanelButtonFlash(oPC,PANEL_BUTTON_REST,TRUE);
 DelayCommand(10.0,SetPanelButtonFlash(oPC,PANEL_BUTTON_REST,FALSE));
 }
}

The trigger OnEnter script is not needed actually, it will work right without it, as you can see everything this trigger does is to flash rest button so player will know, he just entered resting area. However the trigger tag must be REST_ZONE !

Then this code goes into OnPlayerRest event:

void main()
{
object oRestZone, oPC = GetLastPCRested();
 switch(GetLastRestEventType())
 {
 case REST_EVENTTYPE_REST_STARTED:
 DeleteLocalInt(oPC,"PC_Damage");
 oRestZone = GetNearestObjectByTag("REST_ZONE",oPC);
  if(oRestZone != OBJECT_INVALID && !GetIsInSubArea(oPC,oRestZone))
  {
  // The resting system has objections against resting here and now
  // Probably because there is an ambush already in progress
  DelayCommand(0.1,FloatingTextStrRefOnCreature(84142,oPC));
  AssignCommand(oPC,ClearAllActions());
  }
 }
}

As you can see it just cancel the rest if player is not in allow resting trigger
               
               

               
            

Legacy_Snottling

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Allowed Resting Trigger
« Reply #2 on: August 14, 2010, 12:59:58 pm »


               Thanks, I will try it out.