// Chicken Drunkard

ON INIT {
 SET £friend "TAVERN"
 INVENTORY ADDMULTI "JEWELRY\\GOLD_COIN\\GOLD_COIN" 7
 INVENTORY ADD "PROVISIONS\\FOOD_CHICKEN\\FOOD_CHICKEN"
 INVENTORY ADD "PROVISIONS\\BOTTLE_WINE\\BOTTLE_WINE"
 SET §reflection_mode 0
 SET §drinking 0			// Used to know if npc is drinking and player cannot talk to him.
 ACCEPT
}

ON INITEND {
 TWEAK TORSO "human_villager_chest2"
 TWEAK LEGS  "human_villager_legs3"
 TWEAK HEAD "human_villager_head4"
 TWEAK SKIN "npc_human_villager4_gary" "npc_human_villager4_anon1"
 ATTACH MUG_FULL_0006 "BEER_ATTACH" SELF "left_attach"
 SET £attached_object "MUG_FULL_0006"
 LOADANIM ACTION2 "human_normal_sit_cycle"
 LOADANIM ACTION3 "human_normal_drink_cycle2"
 SET £misc [customer_tavern_reflection_male_4]
 SETWEAPON DAGGER
 SENDEVENT -ir DURABILITY 100 "60"
 SET_NPC_STAT damages 12
 PLAYANIM -l ACTION2
 SET §frozen 1
 TIMERdrink -i 0 20 GOTO DRINK
 PHYSICAL OFF
 ACCEPT
}

ON CHAT {
 IF (^SPEAKING == 1) ACCEPT
 IF (§enemy == 1) ACCEPT
 IF (§drinking == 1) ACCEPT
 SPEAK [customer_tavern_reflection_male_4] NOP
 ACCEPT
}

>>DRINK
  IF (^SPEAKING == 1) ACCEPT
  IF (#SHUT_UP == 1) ACCEPT
  RANDOM 50 {
    SET §drinking 1
    PLAYANIM -2e ACTION3 GOTO DRINK2
    ACCEPT
  }
  ELSE {
    SPEAK [customer_tavern_reflection_male_4] NOP
    ACCEPT
  }
 ACCEPT

>>DRINK2
 SET §drinking 0
 PLAYANIM -2e NONE PLAYANIM -l ACTION2
 ACCEPT