vilkatis Posted November 19, 2010 Share Posted November 19, 2010 I want to make a bottle of nuka cola change to a bottle of ice nuka cola if it is added to a fridgeand this is the script,that i added to the bottle scn NukaColaScriptfloat timerref rContainerfloat ncountBegin OnAdd set timer to 0 set rContainer to GetContainer if rContainer.GetIsID RefrigeratorWithFood ShowMessage NukaColaMessage set ncount to rContainer.GetItemCount NukaCola if ncount > 0 rContainer.additem MS05IceNukaCola ncount set ncount to rContainer.GetItemCount MS05IceNukaCola if timer < 3 set timer to timer + GetSecondsPassed else rContainer.removeitem NukaCola ncount endif endifendifEnd the problem is that the timer doesnt work in onAdd blocks..as it seemsi dont know what to do i tried making a gamemode block to run the timer..and it ends up crashing the gamehere it is scn NukaColaScript ref rContainerint nCheck Begin onAdd set nCheck to 1 set rContainer to GetContainer if rContainer.GetIsID RefrigeratorWithFood if (rContainer.GetItemCount NukaCola > 0) rContainer.additem MS05IceNukaCola 1 endif endifend float timer begin GameMode if nCheck == 1 if timer < 3 set timer to timer + GetSecondsPassed else if (rContainer.GetItemCount NukaCola > 0) removeme set nCheck to 0 set timer to 0 endif endif endifend Link to comment Share on other sites More sharing options...
Trueform Posted November 19, 2010 Share Posted November 19, 2010 Have you tried changing the script so that it works on the fridge rather than the bottle? It may need a bit of a shuffle around script-wise, but it's far easier in the long run :) Link to comment Share on other sites More sharing options...
vilkatis Posted November 19, 2010 Author Share Posted November 19, 2010 Thanks!Yeah i changed it and added the script to the fridge.i just didnt want it to run in a GameMode blockcan i possibly make it run differently?its my first time using scripts in fallout and i`m inclined to think that GameMode blocks run all the time,so they would slow the performance of the gameis there any check i can do so the script wouldn't run all the time? like only if the player is in vicinity of the fridge or something?or some other check.. Link to comment Share on other sites More sharing options...
Aragron Posted November 19, 2010 Share Posted November 19, 2010 "Fridge".getdistance player >= 50 (or other)something like that: begin gamemodeif Fridge.getdistance player >= 50return ;the script ends here,the game won't read the restelse ;or endifRest of your script Link to comment Share on other sites More sharing options...
vilkatis Posted November 19, 2010 Author Share Posted November 19, 2010 Kudos to you!Oh man thanks this is great ) Link to comment Share on other sites More sharing options...
Recommended Posts