Difference between revisions of "Useful Scripts"
Jump to navigation
Jump to search
no edit summary
imported>Skingrad24 |
imported>Henning |
||
Line 1: | Line 1: | ||
= GECK = | = GECK = | ||
==Timed Doors== | |||
Script Type:Object | |||
<small>To be placed on an [[activator]], Uses Persistent References to design Objects.</small> | |||
<pre> | |||
ScriptName VaultpTimedDoor ;By BEArbiter | |||
;Explaination: | |||
;This script is to make TimedDoors, Elevators,... | |||
;Once you press the button, Isactivated is set to 1, so pressing the button againt won't do anything, it need to be Reset to 0 | |||
; | |||
;Then, each 1 second, One or more Door will be | |||
;opened/closed. When All the door have been activated, the script | |||
;will reset the Activator. | |||
;It use Persitent Reference of the doors, So You need one | |||
;Script per Activator/Elevator,.... | |||
; | |||
;A Timing Issue Is possible(if you place Two or more activator | |||
;and activate both at little interval), It can be | |||
;Solve by Create An Global Variable instead of Isactivated | |||
;Then, all the button witch use a copy of this | |||
;script won't be useable while a Door is opened | |||
float timer | |||
;For a Global Variable, Go to Global, create a | |||
;new short var named isactivated and delete theses line: | |||
int isactivated | |||
:<end of delete action> | |||
Begin Onactivate | |||
;If the button have been pressed before and | |||
;not been reseted, the activator won't do anything | |||
if isactivated == 0 | |||
set isactivated to 1 | |||
Activate | |||
else | |||
;If you want the Activation to do something | |||
endif | |||
end | |||
begin gamemode | |||
If isactivated == 1 | |||
if timer < 8 | |||
if timer < 1; | |||
elseif Timer < 2;After One second, do the following | |||
if Door1.GetOpenState == 3 | |||
Door1.SetOpenState 1 | |||
;Door3.SetOpenState 1 | |||
;You can Activate more than one door at a time. | |||
elseif Door1.GetOpenState == 1 | |||
Door1.SetOpenState 0 | |||
;Door3.SetOpenState 0 | |||
Endif | |||
Elseif Timer < 3 | |||
If Door2.GetOpenState == 3 | |||
Door2.SetOpenState 1 | |||
Elseif Door2.GetOpenState == 1 | |||
Door2.SetOpenState 0 | |||
Endif | |||
Elseif Timer < 4 | |||
If Door3.GetOpenState == 3 | |||
Door3.SetOpenState 1 | |||
Elseif Door3.GetOpenState == 1 | |||
Door3.SetOpenState 0 | |||
Endif | |||
Endif | |||
Else | |||
Set isactivated to 0 | |||
Set timer to 0 | |||
Endif | |||
Endif | |||
End | |||
</pre> | |||
==Light switch== | ==Light switch== |