shavkacagarikia Posted September 10, 2015 Share Posted September 10, 2015 Hello, any ideas how to make object to be disabled after some time, for example, 10 secons after it is activated? Link to comment Share on other sites More sharing options...
GePalladium Posted September 13, 2015 Share Posted September 13, 2015 (edited) Something like this? scn MyObjectScript (object script) float timershort bActivated begin on activate set bActivated to 1end begin gamemodeIf bActivated == 1 if timer < 10 set timer to timer + GetSecondsPassed else MyREF.disable set timer to 0 set bActivated to 0 endifendifend Edited September 13, 2015 by GePalladium Link to comment Share on other sites More sharing options...
shavkacagarikia Posted September 17, 2015 Author Share Posted September 17, 2015 Something like this? scn MyObjectScript (object script) float timershort bActivated begin on activate set bActivated to 1end begin gamemodeIf bActivated == 1 if timer < 10 set timer to timer + GetSecondsPassed else MyREF.disable set timer to 0 set bActivated to 0 endifendifendscn 00deskactivate short thing Begin OnActivate if thing == 0 th1.disableth2.disableth3.disableth4.disableth5.disableth6.disable deskch.activateSet thing to 1ReturnElseIf thing == 1 th1.enableth2.enableth3.enableth4.enableth5.enableth6.enable deskch.activateSet thing to 0 ReturnEndif End how to add that to this code, th1,2 etc are objects i want to be disabled after some time Link to comment Share on other sites More sharing options...
GePalladium Posted September 17, 2015 Share Posted September 17, 2015 (edited) This script needs to be tested...Avoid names starting by "00" geck doesn't like it. scn MyObjectScript (object script) float timershort bActivatedshort thing begin on activate set bActivated to 1end begin gamemode If bActivated == 1 if thing == 0 if timer < 10 set timer to timer + GetSecondsPassed else th1.disable th2.disable th3.disable th4.disable th5.disable th6.disable deskch.activate Set thing to 1 endif elseif thing == 1 th1.enable th2.enable th3.enable th4.enable th5.enable th6.enable deskch.activate Set thing to 0 set timer to 0 set bActivated to 0 endifendif end Edited September 17, 2015 by GePalladium Link to comment Share on other sites More sharing options...
shavkacagarikia Posted September 17, 2015 Author Share Posted September 17, 2015 This script needs to be tested...Avoid names starting by "00" geck doesn't like it. scn MyObjectScript (object script) float timershort bActivatedshort thing begin on activate set bActivated to 1end begin gamemode If bActivated == 1 if thing == 0 if timer < 10 set timer to timer + GetSecondsPassed else th1.disable th2.disable th3.disable th4.disable th5.disable th6.disable deskch.activate Set thing to 1 endif elseif thing == 1 th1.enable th2.enable th3.enable th4.enable th5.enable th6.enable deskch.activate Set thing to 0 set timer to 0 set bActivated to 0 endifendif end well, thanks but it doesn't work. Link to comment Share on other sites More sharing options...
GePalladium Posted September 17, 2015 Share Posted September 17, 2015 (edited) I tested it and it works as you asked... but obviously the ref are disable and enable immediatly. ^^If you want to have the time to see that your ref were disable, you have to add a also a timer between disable/enable. Edit here is the script I tested: scn ZZZMyObjectScript (object script) float timershort bActivatedshort thing begin onactivate player set bActivated to 1end begin gamemode If bActivated == 1 if thing == 0 if timer < 10 ;here add the seconds you want set timer to timer + GetSecondsPassed else ZZZAREF.disable ZZZBREF.disable set timer to 0 Set thing to 1 endif elseif thing == 1 if timer < 10 set timer to timer + GetSecondsPassed else ZZZAREF.enable ZZZBREF.enable set timer to 0 Set thing to 0 set bActivated to 0 endif endifendif end So, adapted to your mod, it does this: scn MyObjectScript (object script) float timershort bActivatedshort thing begin on activate set bActivated to 1end begin gamemode If bActivated == 1 if thing == 0 if timer < 10 set timer to timer + GetSecondsPassed else th1.disable th2.disable th3.disable th4.disable th5.disable th6.disable deskch.activate Set timer to 0 Set thing to 1 endif elseif thing == 1 if timer < 10 set timer to timer + GetSecondsPassed else th1.enable th2.enable th3.enable th4.enable th5.enable th6.enable deskch.activate set timer to 0 Set thing to 0 set bActivated to 0 endif endifendif end Edited September 17, 2015 by GePalladium Link to comment Share on other sites More sharing options...
shavkacagarikia Posted September 18, 2015 Author Share Posted September 18, 2015 I tested it and it works as you asked... but obviously the ref are disable and enable immediatly. ^^If you want to have the time to see that your ref were disable, you have to add a also a timer between disable/enable. Edit here is the script I tested: scn ZZZMyObjectScript (object script) float timershort bActivatedshort thing begin onactivate player set bActivated to 1end begin gamemode If bActivated == 1 if thing == 0 if timer < 10 ;here add the seconds you want set timer to timer + GetSecondsPassed else ZZZAREF.disable ZZZBREF.disable set timer to 0 Set thing to 1 endif elseif thing == 1 if timer < 10 set timer to timer + GetSecondsPassed else ZZZAREF.enable ZZZBREF.enable set timer to 0 Set thing to 0 set bActivated to 0 endif endifendif end So, adapted to your mod, it does this: scn MyObjectScript (object script) float timershort bActivatedshort thing begin on activate set bActivated to 1end begin gamemode If bActivated == 1 if thing == 0 if timer < 10 set timer to timer + GetSecondsPassed else th1.disable th2.disable th3.disable th4.disable th5.disable th6.disable deskch.activate Set timer to 0 Set thing to 1 endif elseif thing == 1 if timer < 10 set timer to timer + GetSecondsPassed else th1.enable th2.enable th3.enable th4.enable th5.enable th6.enable deskch.activate set timer to 0 Set thing to 0 set bActivated to 0 endif endifendif end i don't know whats wrong i tried but script can't be savedscn mytestscript float timershort bActivatedshort thing begin on activate set bActivated to 1end begin gamemode If bActivated == 1 if thing == 0 if timer < 10 set timer to timer + GetSecondsPassed else th1.disable th2.disable th3.disable th4.disable th5.disable th6.disable deskch.activate Set timer to 0 Set thing to 1 endif elseif thing == 1 if timer < 10 set timer to timer + GetSecondsPassed else th1.enable th2.enable th3.enable th4.enable th5.enable th6.enable deskch.activate set timer to 0 Set thing to 0 set bActivated to 0 endif endifendif i checked objects have correct reference IDs i tried adding lines manually according to your code and it doesn't saves after i addIf bActivated == 1 if thing == 0 if timer < 10 set timer to timer + GetSecondsPassedso i can't understand whats wrong Link to comment Share on other sites More sharing options...
GePalladium Posted September 18, 2015 Share Posted September 18, 2015 Installe the geck power up, (find it on Nexus) it gives you script errors.Don't forget the "end" at the end of the scriptThe best when you name a REF is to add "REF" at the end. For exemple MyObjectREF It's better. Link to comment Share on other sites More sharing options...
shavkacagarikia Posted September 18, 2015 Author Share Posted September 18, 2015 Installe the geck power up, (find it on Nexus) it gives you script errors.Don't forget the "end" at the end of the scriptThe best when you name a REF is to add "REF" at the end. For exemple MyObjectREF It's bthank you very much, with geck power up i figured out that on activate has to be written together like onactivate, also i had to check persistant reference boxes for my objects. now script works, so many thanks to you Link to comment Share on other sites More sharing options...
GePalladium Posted September 20, 2015 Share Posted September 20, 2015 You're welcome, glade it finally works! Link to comment Share on other sites More sharing options...
Recommended Posts