Вот смотрите два скрипта:
первый от рычага, второй от двери.
Рачаг повесил на стену, дверь посреди прохода. Проверил в игре - не работает.
Что там не так?
scn RFSwitch03SCRIPT
; activates parent after a 2 sec delay
short open
short next
short busy
float timer
ref mySelf
ref myParent
begin onActivate
if busy == 0
if open == 0
playgroup forward 1
set open to 1
set next to 1
set timer to 2
else
playgroup backward 1
set open to 0
set next to 1
set timer to 0.5
endif
set busy to 1
endif
end
begin gameMode
if next == 1 && timer <= 0
set mySelf to getSelf
set myParent to getParentRef
myParent.activate mySelf 1
set next to 0
endif
if isAnimPlaying == 0 && busy == 1
set busy to 0
endif
if timer > 0
set timer to timer - getSecondsPassed
endif
end
begin onReset
reset3DState
set next to 0
set open to 0
set busy to 0
end
===================
scn RFWHallPortcullis01SCRIPT
; activated by linked child
; activates optionally linked parent after 1 sec delay
short init
short open
short next
short busy
float timer
ref mySelf
ref myParent
begin onActivate
if isActionRef player == 1
if open == 0
message " This gate is opened elsewhere."
endif
elseif isActionRef mySelf == 0 && busy == 0
if open == 0
playgroup forward 0
set open to 1
enableLinkedPathPoints
else
playgroup backward 0
set open to 0
disableLinkedPathPoints
endif
set next to 1
set timer to 1
set busy to 1
endif
end
begin gameMode
if init == 0
; set up ref vars
set mySelf to getSelf
set myParent to getParentRef
; prepare linked pathsgrid points
disableLinkedPathPoints
set init to 1
endif
; daisy-chain activation
if next == 1 && timer <=0
set next to 0
myParent.activate mySelf 1
endif
if timer > 0
set timer to timer - getSecondsPassed
endif
if isAnimPlaying == 0 && busy == 1
set busy to 0
endif
end
begin onReset
reset3DState
set open to 0
set busy to 0
set next to 0
disableLinkedPathPoints
end
Отредактировано Ezhik (2010-04-08 13:13:56)