here it is, it's pretty hilarious. can be tweaked to your liking...
import "std.zh" const int DRUNK_TIME = 3600; // how long to make Link drunk for per beer. const int DRUNK_EFFECT_CHANCE = 10; // percent chance that Link will be affected by Drunkeness effect that frame. Multiplied by DRUNK_TIME, so more drunk means more drunk. // set these to whatever you want drawn over Link to indicate the drunk effect. // they are currently set to draw directly over Link, so most of the tile should be transparent. const int DRUNK_ICON_LAYER = 7; // which layer to draw drunk effect onto. const int DRUNK_ICON_COMBO = 1536; // which combo to use for drunk effect, can be an animated combo. const int DRUNK_ICON_CSET = 0; // the cset of the drunk effect combo. const int CR_BEER = 7; //The number of beers counter. This is the Script1 counter. const int CR_DRUNKENESS = 8; //The counter to use for confusion. This is the Script2 counter. const int LM_DRUNKACT = 0; // index to Link->Misc[] array, if any other scripts use this change it accordingly const int LM_DRUNKACTTIME = 1; // index to Link->Misc[] array, if any other scripts use this change it accordingly global script Init { void run() { Game->MCounter[CR_DRUNKENESS]=65535; //Max Game->Counter[CR_DRUNKENESS] = 0; } } global script slot2 { void run() { while(true) { //Waitdraw(); UpdateDrunkeness(); Waitframe(); } } } void UpdateDrunkeness() { int random_act = 0; if(Game->Counter[CR_DRUNKENESS] == 0 && Game->Counter[CR_BEER] > 0){ Game->Counter[CR_BEER] = 0; } if(Link->Drunk > 0) { Game->Counter[CR_DRUNKENESS]=Link->Drunk; Link->Drunk=0; } if(Game->Counter[CR_DRUNKENESS]>0) { Game->Counter[CR_DRUNKENESS]--; Screen->FastCombo(DRUNK_ICON_LAYER, Link->X, Link->Y, DRUNK_ICON_COMBO, DRUNK_ICON_CSET, OP_OPAQUE); if(Link->Misc[LM_DRUNKACT] > 0){ if(Link->Misc[LM_DRUNKACTTIME] > 0){ Drunk_Action(); Link->Misc[LM_DRUNKACTTIME]--; }else{ Link->Misc[LM_DRUNKACT] = 0; } } // Game->Counter[CR_DRUNKENESS]%30 == 0 && if( Drunk_Effect() ) { Link->Misc[LM_DRUNKACT] = Rand(15); if(Link->Misc[LM_DRUNKACT] <= 11) Link->Misc[LM_DRUNKACTTIME] = 30; else Link->Misc[LM_DRUNKACTTIME] = 0; Drunk_Action(); } } } bool Drunk_Effect(){ return (Rand(100) <= DRUNK_EFFECT_CHANCE * (Max(1,Game->Counter[CR_DRUNKENESS]/DRUNK_TIME)) ); } void Drunk_Action(){ int temp = 0; if(Link->Misc[LM_DRUNKACT] <= 3){ Link->Dir = Link->Misc[LM_DRUNKACT]; }else if(Link->Misc[LM_DRUNKACT] <= 7){ if(Link->Misc[LM_DRUNKACT] == 4){ Link->InputDown = false; Link->InputLeft = false; Link->InputRight = false; Link->InputUp = true; }else if(Link->Misc[LM_DRUNKACT] == 5){ Link->InputUp = false; Link->InputLeft = false; Link->InputRight = false; Link->InputDown = true; }else if(Link->Misc[LM_DRUNKACT] == 6){ Link->InputUp = false; Link->InputDown = false; Link->InputRight = false; Link->InputLeft = true; }else{ Link->InputUp = false; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = true; } Link->Dir = Link->Misc[LM_DRUNKACT]-4; }else if(Link->Misc[LM_DRUNKACT] == 8){ Link->InputDown = false; Link->InputLeft = false; Link->InputRight = false; temp = Link->Dir; Link->InputUp; Link->Dir = temp; }else if(Link->Misc[LM_DRUNKACT] == 9){ Link->InputUp = false; Link->InputLeft = false; Link->InputRight = false; temp = Link->Dir; Link->InputDown; Link->Dir = temp; }else if(Link->Misc[LM_DRUNKACT] == 10){ Link->InputUp = false; Link->InputDown = false; Link->InputRight = false; temp = Link->Dir; Link->InputLeft; Link->Dir = temp; }else if(Link->Misc[LM_DRUNKACT] == 11){ Link->InputUp = false; Link->InputDown = false; Link->InputLeft = false; temp = Link->Dir; Link->InputRight; Link->Dir = temp; }else if(Link->Misc[LM_DRUNKACT] == 12){ Link->InputA = true; }else if(Link->Misc[LM_DRUNKACT] == 13){ Link->InputB = true; }else if(Link->Misc[LM_DRUNKACT] == 14){ Link->InputL = true; }else if(Link->Misc[LM_DRUNKACT] == 15){ Link->InputR = true; } } item script Remove_Drunkeness { void run() { Game->Counter[CR_DRUNKENESS]=NULL; } } item script Beer{ void run (int num_beer){ Game->Counter[CR_BEER] += num_beer; Game->Counter[CR_DRUNKENESS] += DRUNK_TIME * num_beer; Link->MP = Link->MaxMP; } }
and a demo
https://drive.google...iew?usp=sharing
edit: my code formatting was all screwed up, after fixing that the demo quest had disappeared. all good now.
Edited by justin, 16 December 2014 - 03:45 PM.