gerg357 Posted November 13, 2016 Share Posted November 13, 2016 Scriptname HuntEvent2 extends ObjectReference Import Utility GlobalVariable property GameHour autoMessage Property huntmenu AutoMessage Property toolate2hunt AutoMessage Property foodhunt AutoMessage Property hawkhunt AutoMessage Property noarrows AutoMessage Property goldfound AutoMessage Property goodhunt AutoMiscObject Property Gold001 autoMessage Property potionfound AutoImageSpaceModifier Property FadeToBlackImod Auto ImageSpaceModifier Property FadeToBlackHoldImod Auto ImageSpaceModifier Property FadeToBlackBackImod Auto Potion Property FoodPheasant autoAmmo Property IronArrow autoIngredient Property HawkBeak autoIngredient Property HawkFeathers autoPotion Property RestoreHealth02 auto Event OnActivate(ObjectReference akActionRef) if akActionRef != Game.GetPlayer() ; do not let other NPCs trigger this return endif Float starthunt = 8.0 Float endhunt = 16.0 Float HT = GameHour.GetValue()if (Game.GetPlayer().GetItemCount(IronArrow) >= 20) if(HT >= starthunt) Int ihuntOption = huntmenu.Show() If (ihuntOption == 0) Game.FadeOutGame(true, true, 0.5, 8) FadeToBlackImod.Apply() utility.wait(2) GameHour.Mod(4.0) FadeToBlackImod.PopTo(FadeToBlackHoldImod) utility.wait(2) int huntchance = Utility.RandomInt(1, 11) ; int countfood; int countarrow; if(huntchance == 1) Game.GetPlayer().AddItem(FoodPheasant, 1) Game.GetPlayer().RemoveItem(IronArrow, 3) countfood = 1 countarrow = 3 foodhunt.Show(countfood,countarrow) elseif(huntchance == 2) Game.GetPlayer().AddItem(FoodPheasant, 2) Game.GetPlayer().RemoveItem(IronArrow, 3) countfood = 2 countarrow = 3 foodhunt.Show(countfood,countarrow) elseif(huntchance == 3) Game.GetPlayer().AddItem(FoodPheasant, 3) Game.GetPlayer().RemoveItem(IronArrow, 6) countfood = 2 countarrow = 6 foodhunt.Show(countfood,countarrow) elseif(huntchance == 4) Game.GetPlayer().AddItem(FoodPheasant, 2) Game.GetPlayer().RemoveItem(IronArrow, 6) countfood = 2 countarrow = 6 foodhunt.Show(countfood,countarrow) elseif(huntchance == 5) Game.GetPlayer().AddItem(FoodPheasant, 4) Game.GetPlayer().RemoveItem(IronArrow, 8) countfood = 4 countarrow = 8 foodhunt.Show(countfood,countarrow) elseif(huntchance == 6) Game.GetPlayer().AddItem(FoodPheasant, 2) Game.GetPlayer().RemoveItem(IronArrow, 2) countfood = 2 countarrow = 2 foodhunt.Show(countfood,countarrow) elseif(huntchance == 7) Game.GetPlayer().AddItem(HawkBeak, 2) Game.GetPlayer().AddItem(HawkFeathers, 2) Game.GetPlayer().RemoveItem(IronArrow, 8) countfood = 2 countarrow = 8 hawkhunt.Show(countfood,countarrow) elseif(huntchance == 8) Game.GetPlayer().AddItem(HawkBeak, 1) Game.GetPlayer().AddItem(HawkFeathers, 1) Game.GetPlayer().RemoveItem(IronArrow, 4) countfood = 1 countarrow = 4 hawkhunt.Show(countfood,countarrow) elseif(huntchance == 9) int goldchance = Utility.RandomInt(5, 75) Game.GetPlayer().removeItem(Gold001, goldchance) goldfound.Show(goldchance) elseif(huntchance == 10) int goldchance = Utility.RandomInt(75, 150) Game.GetPlayer().AddItem(RestoreHealth02, 1) Game.GetPlayer().removeItem(Gold001, goldchance) Game.GetPlayer().AddItem(HawkBeak, 1) Game.GetPlayer().AddItem(HawkFeathers, 1) Game.GetPlayer().AddItem(FoodPheasant, 1) countfood = 1 goodhunt.Show(goldchance,countfood) elseif(huntchance == 11) int potionchance = Utility.RandomInt(1, 3) Game.GetPlayer().AddItem(RestoreHealth02, potionchance) potionfound.Show(potionchance) endif FadeToBlackHoldImod.PopTo(FadeToBlackBackImod) FadeToBlackHoldImod.Remove() ;Game.FadeOutGame(False, true, 1, 2) endIf If (ihuntOption == 1) EndIf elseif(HT <= endhunt) toolate2hunt.Show() endif elsenoarrows.Show()endIfEndEvent My message box sometimes comes up twice or gets stuck.. and time issue I'm trying to make activator be active from 8 to 4 in game hour. Link to comment Share on other sites More sharing options...
irswat Posted November 14, 2016 Share Posted November 14, 2016 (edited) which message box? its very hard to read without inline text. Could you copy the code from whatever program you're writing in and paste it into a code box ? Edited November 14, 2016 by irswat Link to comment Share on other sites More sharing options...
irswat Posted November 14, 2016 Share Posted November 14, 2016 if((HT >= starthunt) && (HT<endhunt)) might you want this? also think about how time works. Lets say you can hunt between 8-6. This is in military format so 6 is really 18.00. You get to 24 at midnight, but then 1 am is actually later than 24... Here. Let me show you what I mean. This is from dawnfang/duskfang. At 6 pm the blade turns into night fang. At 6 am it turns into dawnfang. 3 conditionals are necessary: float TimeofDay=GameHour.GetValue() ;thanks to tonycubed2 for this ;daytime flag & time until update if (TimeofDay>=6.0 && TimeofDay<18.0) DayTime=1 TimeUntilUpdate=18.0-TimeofDay elseif (TimeofDay>=18.0 && TimeofDay<=24.0) DayTime=0 TimeUntilUpdate=30.0-TimeofDay ;shoutout to SarthesArai for spotting a bug with my maths elseif (TimeofDay<6.0) DayTime=0 TimeUntilUpdate=6.0-TimeofDay endif just something to keep in mind. Not sure what you are trying to do. Link to comment Share on other sites More sharing options...
gerg357 Posted November 14, 2016 Author Share Posted November 14, 2016 Activator that you click it asks to hunt it will fade out screen advance time 4 hours then pop up the results my time I think isn't working but looks right with numbers 8am is 8 and 4pm is 16 if it's clicked any time before 8 am or after 4 pm it should say you cant to that..seems like the first message box is glitching maybe I need to adjust the wait time ibdunno but it will let me click it twice on yea to hunt and it's doubling my results Link to comment Share on other sites More sharing options...
NexusComa Posted November 14, 2016 Share Posted November 14, 2016 Without loading this up ... I'd suggest you rem out the fades and just let it pop in and out as default until you find your bug. Link to comment Share on other sites More sharing options...
gerg357 Posted November 14, 2016 Author Share Posted November 14, 2016 What do you mean by pop in and out Link to comment Share on other sites More sharing options...
NexusComa Posted November 14, 2016 Share Posted November 14, 2016 (edited) Try this ... ( untested, will compile ) Scriptname HuntEvent2 extends ObjectReferenceImport UtilityGlobalVariable property GameHour autoMessage Property huntmenu AutoMessage Property toolate2hunt AutoMessage Property foodhunt AutoMessage Property hawkhunt AutoMessage Property noarrows AutoMessage Property goldfound AutoMessage Property goodhunt AutoMiscObject Property Gold001 autoMessage Property potionfound AutoImageSpaceModifier Property FadeToBlackImod AutoImageSpaceModifier Property FadeToBlackHoldImod AutoImageSpaceModifier Property FadeToBlackBackImod AutoPotion Property FoodPheasant autoAmmo Property IronArrow autoIngredient Property HawkBeak autoIngredient Property HawkFeathers autoPotion Property RestoreHealth02 autoFloat starthunt = 8.0Float endhunt = 16.0Int hunting = 0 Event OnInit() GoToState("Done")EndEventEvent OnActivate(ObjectReference akActionRef) if akActionRef != Game.GetPlayer() ; do not let other NPCs trigger this return endif Float HT = GameHour.GetValue() if (Game.GetPlayer().GetItemCount(IronArrow) >= 20) if (HT >= starthunt) if (hunting == 0) hunting = 1 Int ihuntOption = huntmenu.Show() If (ihuntOption == 0) Game.FadeOutGame(true, true, 0.5, :cool: FadeToBlackImod.Apply() utility.wait(2) GameHour.Mod(4.0) FadeToBlackImod.PopTo(FadeToBlackHoldImod) utility.wait(2) int huntchance = Utility.RandomInt(1, 11) ; int countfood int countarrow if(huntchance == 1) Game.GetPlayer().AddItem(FoodPheasant, 1) Game.GetPlayer().RemoveItem(IronArrow, 3) countfood = 1 countarrow = 3 foodhunt.Show(countfood,countarrow) elseif(huntchance == 2) Game.GetPlayer().AddItem(FoodPheasant, 2) Game.GetPlayer().RemoveItem(IronArrow, 3) countfood = 2 countarrow = 3 foodhunt.Show(countfood,countarrow) elseif(huntchance == 3) Game.GetPlayer().AddItem(FoodPheasant, 3) Game.GetPlayer().RemoveItem(IronArrow, 6) countfood = 2 countarrow = 6 foodhunt.Show(countfood,countarrow) elseif(huntchance == 4) Game.GetPlayer().AddItem(FoodPheasant, 2) Game.GetPlayer().RemoveItem(IronArrow, 6) countfood = 2 countarrow = 6 foodhunt.Show(countfood,countarrow) elseif(huntchance == 5) Game.GetPlayer().AddItem(FoodPheasant, 4) Game.GetPlayer().RemoveItem(IronArrow, :cool: countfood = 4 countarrow = 8 foodhunt.Show(countfood,countarrow) elseif(huntchance == 6) Game.GetPlayer().AddItem(FoodPheasant, 2) Game.GetPlayer().RemoveItem(IronArrow, 2) countfood = 2 countarrow = 2 foodhunt.Show(countfood,countarrow) elseif(huntchance == 7) Game.GetPlayer().AddItem(HawkBeak, 2) Game.GetPlayer().AddItem(HawkFeathers, 2) Game.GetPlayer().RemoveItem(IronArrow, :cool: countfood = 2 countarrow = 8 hawkhunt.Show(countfood,countarrow) elseif(huntchance == :cool: Game.GetPlayer().AddItem(HawkBeak, 1) Game.GetPlayer().AddItem(HawkFeathers, 1) Game.GetPlayer().RemoveItem(IronArrow, 4) countfood = 1 countarrow = 4 hawkhunt.Show(countfood,countarrow) elseif(huntchance == 9) int goldchance = Utility.RandomInt(5, 75) Game.GetPlayer().removeItem(Gold001, goldchance) goldfound.Show(goldchance) elseif(huntchance == 10) int goldchance = Utility.RandomInt(75, 150) Game.GetPlayer().AddItem(RestoreHealth02, 1) Game.GetPlayer().removeItem(Gold001, goldchance) Game.GetPlayer().AddItem(HawkBeak, 1) Game.GetPlayer().AddItem(HawkFeathers, 1) Game.GetPlayer().AddItem(FoodPheasant, 1) countfood = 1 goodhunt.Show(goldchance,countfood) elseif(huntchance == 11) int potionchance = Utility.RandomInt(1, 3) Game.GetPlayer().AddItem(RestoreHealth02, potionchance) potionfound.Show(potionchance) endif FadeToBlackHoldImod.PopTo(FadeToBlackBackImod) FadeToBlackHoldImod.Remove() ;Game.FadeOutGame(False, true, 1, 2) hunting = 0 endIf endif elseif(HT <= endhunt) toolate2hunt.Show() endif else noarrows.Show() endIfEndEventState Done ;do nothingEndState Also: you called Import UtilityThen still used the long form. Removed: If (ihuntOption == 1)EndIf Towards the end of the script.Not sure why that was there. Edited November 14, 2016 by NexusComa Link to comment Share on other sites More sharing options...
gerg357 Posted November 15, 2016 Author Share Posted November 15, 2016 Took out the fades and waits and it's working fine..hmm I'll tinker with it I guess Link to comment Share on other sites More sharing options...
NexusComa Posted November 15, 2016 Share Posted November 15, 2016 Hmm ... did you try the new script? ...You have to click the hide button after spoiler. Link to comment Share on other sites More sharing options...
gerg357 Posted November 15, 2016 Author Share Posted November 15, 2016 Sorry I hadn't tried yet I took mine removed the fades and waits and added a and statement that says if time is greater than 8 and less than 4pm then changed the bottom elseif to a else statement it works I just like the fade so it would fade out the screen change time do what it had to do then fade back in I'll check out the script too Link to comment Share on other sites More sharing options...
Recommended Posts