Jump to content

Time to disable objects


shavkacagarikia

Recommended Posts

Something like this?

 

 

scn MyObjectScript (object script)

 

float timer

short bActivated

 

begin on activate

set bActivated to 1

end

 

begin gamemode

If bActivated == 1

if timer < 10

set timer to timer + GetSecondsPassed

else

MyREF.disable

set timer to 0

set bActivated to 0

endif

endif

end

Edited by GePalladium
Link to comment
Share on other sites

Something like this?

 

 

scn MyObjectScript (object script)

 

float timer

short bActivated

 

begin on activate

set bActivated to 1

end

 

begin gamemode

If bActivated == 1

if timer < 10

set timer to timer + GetSecondsPassed

else

MyREF.disable

set timer to 0

set bActivated to 0

endif

endif

end

scn 00deskactivate
short thing
Begin OnActivate
if thing == 0
th1.disable
th2.disable
th3.disable
th4.disable
th5.disable
th6.disable
deskch.activate
Set thing to 1
Return
ElseIf thing == 1
th1.enable
th2.enable
th3.enable
th4.enable
th5.enable
th6.enable
deskch.activate
Set thing to 0
Return
Endif
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

This script needs to be tested...

Avoid names starting by "00" geck doesn't like it.

 

scn MyObjectScript (object script)
float timer
short bActivated
short thing
begin on activate
set bActivated to 1
end
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
endif
endif
end
Edited by GePalladium
Link to comment
Share on other sites

 

This script needs to be tested...

Avoid names starting by "00" geck doesn't like it.

 

scn MyObjectScript (object script)
float timer
short bActivated
short thing
begin on activate
set bActivated to 1
end
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
endif
endif
end

 

well, thanks but it doesn't work.

Link to comment
Share on other sites

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 timer
short bActivated
short thing
begin onactivate player
set bActivated to 1
end
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
endif
endif
end
So, adapted to your mod, it does this:
scn MyObjectScript (object script)
float timer
short bActivated
short thing
begin on activate
set bActivated to 1
end
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
endif
endif
end

Edited by GePalladium
Link to comment
Share on other sites

 

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 timer
short bActivated
short thing
begin onactivate player
set bActivated to 1
end
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
endif
endif
end
So, adapted to your mod, it does this:
scn MyObjectScript (object script)
float timer
short bActivated
short thing
begin on activate
set bActivated to 1
end
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
endif
endif
end

 

i don't know whats wrong i tried but script can't be saved

scn mytestscript
float timer
short bActivated
short thing
begin on activate
set bActivated to 1
end
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
endif
endif
i checked objects have correct reference IDs i tried adding lines manually according to your code and it doesn't saves after i add
If bActivated == 1
if thing == 0
if timer < 10
set timer to timer + GetSecondsPassed
so i can't understand whats wrong
Link to comment
Share on other sites

Installe the geck power up, (find it on Nexus) it gives you script errors.

Don't forget the "end" at the end of the script

The best when you name a REF is to add "REF" at the end. For exemple MyObjectREF It's b

thank 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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...