/* _________________________________________________________________________ / \ << Legend of the Red Dragon ReVisited >> Author: Dom Queron, dom(at)gulbsoft(dot)de, http://www.gulbsoft.de Description: Generic Ambient Placeable OnUsed Script Holds several OnUse Scripts in order to cut down the number of scripts in the module. version: $v1.0 00-00-00 module information: http://gulbsoft.de/phpBB2x/g_viewcat.php?t=225 \_________________________________________________________________________/ */ void main() { string sTag = GetTag(OBJECT_SELF); //Chairs, Benches, Stools if (sTag == "lordo_chair" || sTag =="lordo_bench" || sTag == "lordo_thronea" || sTag == "lordo_stool" || sTag == "lordo_couch") { object oChair = OBJECT_SELF; if(!GetIsObjectValid(GetSittingCreature(oChair))) { string sName = GetName(GetLastUsedBy()); if (sTag == "lordo_thronea") AssignCommand(GetLastUsedBy(), ActionSpeakString("Thou mayst call us Lord " + sName )); AssignCommand(GetLastUsedBy(), ActionSit(oChair)); } return; } else if (sTag == "lordo_alekeg") { object oPC = GetLastUsedBy(); AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0f,3.0f)); if (GetLocalInt(OBJECT_SELF,"T1_OBJECT_ALELEFT")== -1) { DelayCommand(3.0f,FloatingTextStringOnCreature("Empty!",GetLastUsedBy(),FALSE)); return; } DelayCommand(1.0f,PlaySound("fs_water_hard1")); if (GetLocalInt(OBJECT_SELF,"T1_OBJECT_ALELEFT")==0) { SetLocalInt(OBJECT_SELF,"T1_OBJECT_ALELEFT",d6()+4); // generate 1d6+4 glasses of ale } int nLeft =GetLocalInt(OBJECT_SELF,"T1_OBJECT_ALELEFT"); //if detected use my version of ale flagged as stolen object oItem = CreateItemOnObject("lordi_aleflask", oPC, 1); if(oItem == OBJECT_INVALID) FloatingTextStringOnCreature("Spilled it!",oPC,FALSE); if (nLeft == 1) { SetLocalInt(OBJECT_SELF,"T1_OBJECT_ALELEFT",-1); DelayCommand(3.0f,FloatingTextStringOnCreature(GetName(oPC) +" pours the last ale!",oPC,FALSE)); } else { DelayCommand(3.0f,FloatingTextStringOnCreature(GetName(oPC) +" pours a fine ale",oPC,FALSE)); SetLocalInt(OBJECT_SELF,"T1_OBJECT_ALELEFT",nLeft-1); } } //Lecturn else if (sTag == "lordo_lecturn") { string sSnd ="as_pl_coughm2"; if (GetGender(GetLastUsedBy()) == GENDER_FEMALE) sSnd ="as_pl_coughf2"; AssignCommand(GetLastUsedBy(),PlaySound(sSnd)); AssignCommand(GetLastUsedBy(), ActionSpeakString("*Cough*")); AssignCommand(GetLastUsedBy(), ActionSpeakString("Blabla ... ")); AssignCommand(GetLastUsedBy(), ActionPlayAnimation(ANIMATION_LOOPING_TALK_NORMAL,1.0f,4.0f)); AssignCommand(GetLastUsedBy(), ActionSpeakString("... blablabla ... blabla ...")); AssignCommand(GetLastUsedBy(), ActionPlayAnimation(ANIMATION_LOOPING_TALK_FORCEFUL,1.0f,3.0f)); AssignCommand(GetLastUsedBy(), ActionSpeakString("bla! blabla bla!")); AssignCommand(GetLastUsedBy(), ActionPlayAnimation(ANIMATION_LOOPING_TALK_FORCEFUL,1.0f,2.0f)); AssignCommand(GetLastUsedBy(), ActionWait(1.0f)); AssignCommand(GetLastUsedBy(), ActionPlayAnimation(ANIMATION_FIREFORGET_BOW)); AssignCommand(GetLastUsedBy(), ActionDoCommand(PlaySound("as_pl_tavclap1"))); return; } else if (sTag == "lordo_stocks") { AssignCommand(GetLastUsedBy(),ActionPlayAnimation(ANIMATION_FIREFORGET_BOW,1.0f,10.0f)); AssignCommand(GetLastUsedBy(),ActionDoCommand(PlayVoiceChat(VOICE_CHAT_BADIDEA))); } else if (sTag == "lordo_pool") { AssignCommand(GetLastUsedBy(), ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0f,2.0f)); AssignCommand(GetLastUsedBy(), ActionWait(1.0f)); AssignCommand(GetLastUsedBy(), ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK)); DelayCommand(1.1f, PlaySound("fs_water_hard1")); DelayCommand(1.5f, PlaySound("fs_water_hard1")); DelayCommand(3.5f,SendMessageToPC(GetLastUsedBy(),"You drink and feel refreshed")); DelayCommand(3.5f, FloatingTextStringOnCreature ("*Gulp*", GetLastUsedBy())); return; } else if (sTag == "lordo_haybale1") { SetPlotFlag(OBJECT_SELF,FALSE); AssignCommand(GetLastUsedBy(), ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0f,2.0f)); effect eFlame2 = EffectVisualEffect(VFX_IMP_FLAME_M); effect eSmoke = EffectVisualEffect(VFX_FNF_SMOKE_PUFF); object oFlame = CreateObject(OBJECT_TYPE_PLACEABLE,"plc_flamesmall",GetLocation(OBJECT_SELF)); DelayCommand(1.0f,PlaySound("al_na_firesmldr")); DelayCommand(1.0f,ApplyEffectToObject(DURATION_TYPE_PERMANENT,eSmoke, OBJECT_SELF)); DestroyObject(oFlame,5.0f); DelayCommand(4.0f,ApplyEffectToObject(DURATION_TYPE_PERMANENT,eSmoke, OBJECT_SELF)); oFlame = CreateObject(OBJECT_TYPE_PLACEABLE,"plc_flamemedium",GetLocation(OBJECT_SELF)); DestroyObject(oFlame,8.0f); DelayCommand(4.0f,ApplyEffectToObject(DURATION_TYPE_PERMANENT,eFlame2, OBJECT_SELF)); DelayCommand(6.0f,ApplyEffectToObject(DURATION_TYPE_PERMANENT,eSmoke, OBJECT_SELF)); DelayCommand(7.0f,ApplyEffectToObject(DURATION_TYPE_PERMANENT,eFlame2, OBJECT_SELF)); DestroyObject(OBJECT_SELF,8.0f); oFlame = CreateObject(OBJECT_TYPE_PLACEABLE,"plc_weathmark",GetLocation(OBJECT_SELF)); DestroyObject(oFlame, 30.0f); } //Pool else if (sTag == "lordo_fountain") { int nCoins = GetLocalInt(OBJECT_SELF,"LORD_COINS_INSIDE"); DelayCommand(1.0f, PlaySound("fs_water_hard1")); AssignCommand(GetLastUsedBy(), ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0f,1.5f)); if (nCoins >0) { GiveGoldToCreature(GetLastUsedBy(),1); SendMessageToPC(GetLastUsedBy(),"You fish a goldpiece from the " +GetName(OBJECT_SELF)); DelayCommand(1.0f, PlaySound("fs_water_hard1")); DelayCommand(1.4f, PlaySound("fs_water_hard1")); DeleteLocalInt(OBJECT_SELF,"LORD_COINS_INSIDE"); return; } if (GetGold(GetLastUsedBy())>0) { DelayCommand(1.0f, FloatingTextStringOnCreature ("*Splash*", GetLastUsedBy())); DelayCommand(1.0f, PlaySound("as_na_splash2")); SendMessageToPC(GetLastUsedBy(),"You snip a goldpiece into the " +GetName(OBJECT_SELF)); SetLocalInt(OBJECT_SELF,"LORD_COINS_INSIDE",1); TakeGoldFromCreature(1,GetLastUsedBy()); return; } } // SUNDIAL else if (sTag == "lordo_sundial") { if (GetIsNight()) AssignCommand(GetLastUsedBy(), ActionSpeakString("It is a sundial, it won't work at night!")); else AssignCommand(GetLastUsedBy(), ActionSpeakString("The sun indicates that it is about " + IntToString(GetTimeHour()) + " hours" )); return; } // GONG else if (sTag == "lordo_gong") { effect eSpark = EffectVisualEffect(VFX_COM_SPARKS_PARRY); DelayCommand(0.5f,ApplyEffectToObject(DURATION_TYPE_INSTANT,eSpark,OBJECT_SELF)); DelayCommand(0.6f,PlaySound("as_cv_gongring2")); return; } // ALTAR else if (sTag == "lordo_altar") { string sDeity = GetDeity(GetLastUsedBy()) ; if (sDeity == "") sDeity = "omnipotent being"; AssignCommand(GetLastUsedBy(),ActionSpeakString("Oh " + sDeity + " bless your humble servant " +GetName( GetLastUsedBy()) + "!" )); AssignCommand(GetLastUsedBy(),ActionPlayAnimation(ANIMATION_LOOPING_WORSHIP,1.0f,10.0f)); AssignCommand(GetLastUsedBy(),ActionSpeakString("That's enough for today")); } // JUKEBOX else if (sTag == "lordo_jukebox") { if (GetGold(GetLastUsedBy()) <1) { AssignCommand(GetLastUsedBy(),ActionSpeakString("Hmm, it says 'insert gold coin'. Too bad I'm blank")); return; } TakeGoldFromCreature(1,GetLastUsedBy()); AssignCommand(GetLastUsedBy(), ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0f,3.0f)); effect eMusic = EffectVisualEffect(VFX_DUR_BARD_SONG); DelayCommand(3.0f,ApplyEffectToObject(DURATION_TYPE_PERMANENT, eMusic, OBJECT_SELF)); DelayCommand(5.0f,AssignCommand(OBJECT_SELF,PlaySound("as_cv_lute1"))); DelayCommand(9.0f,AssignCommand(OBJECT_SELF,PlaySound("as_cv_lute1b"))); DelayCommand(12.5f,AssignCommand(OBJECT_SELF,PlaySound("as_cv_lute1b"))); DelayCommand(15.0f,AssignCommand(OBJECT_SELF,PlaySound("as_cv_lute1"))); DelayCommand(2.0f, FloatingTextStringOnCreature("*1 gold inserted *", GetLastUsedBy())); DelayCommand(18.0f,RemoveEffect(OBJECT_SELF, eMusic)); return; } }