Two buttons used to open one door;
- Code: Select all
BtnOSP1:
logic:
actions:
- type: oneshot
name: BtnOSP1
oneshot:
animation: ButtonTouch
BtnOSP2:
logic:
actions:
- type: oneshot
name: BtnOSP2
oneshot:
animation: ButtonTouch
BtnSndEm1:
type: soundemit
sound:
flags:
- is3dsound
file: switch
volume: 0.55
minfdist: 5
maxfdist: 50
type: SoundFX
BtnSndEm2:
type: soundemit
sound:
flags:
- is3dsound
file: switch
volume: 0.55
minfdist: 5
maxfdist: 50
type: SoundFX
Door5:
animations:
- name: AnimDoor5
autostart: 0
loop: 0
Button1:
logic:
modifiers:
- cursor: poised
flags:
- localelement
activators:
- type: objectinvolume
remote: BtnRgn1
triggers:
- any
conditions:
- type: activator
activators:
- type: picking
- type: objectinbox
satisfied: true
actions:
- type: responder
ref: :MoveDoor
actions:
- type: responder
name: MoveDoor
responder:
states:
- cmds:
- type: oneshotmsg
params:
receivers:
- oneshotmod:BtnOSP1
callbacks:
- marker: TouchButton
receiver: respondermod:MoveDoor
user: 0
waiton: -1
- type: animcmdmsg
params:
receivers:
- 006D:Door5
animname: AnimDoor5
cmds:
- setforewards
- continue
waiton: 0
- type: soundmsg
params:
receivers:
- 0011:BtnSndEm1
cmds:
- play
- setvolume
volume: 1
waiton: -1
nextstate: 1
waittocmd:
- key: 0
msg: 0
- cmds:
- type: oneshotmsg
params:
receivers:
- oneshotmod:BtnOSP1
callbacks:
- marker: TouchButton
receiver: respondermod:MoveDoor
user: 0
waiton: -1
- type: animcmdmsg
params:
receivers:
- 006D:Door5
animname: AnimDoor5
cmds:
- setbackwards
- continue
waiton: 0
- type: soundmsg
params:
receivers:
- 0011:BtnSndEm1
cmds:
- play
- setvolume
volume: 1
waiton: -1
nextstate: 0
waittocmd:
- key: 0
msg: 0
curstate: 0
flags:
- detecttrigger
Button2:
logic:
modifiers:
- cursor: poised
flags:
- localelement
activators:
- type: objectinvolume
remote: BtnRgn2
triggers:
- any
conditions:
- type: activator
activators:
- type: picking
- type: objectinbox
satisfied: true
actions:
- type: responder
ref: :MoveDoor
actions:
- type: responder
name: MoveDoor
responder:
states:
- cmds:
- type: oneshotmsg
params:
receivers:
- oneshotmod:BtnOSP2
callbacks:
- marker: TouchButton
receiver: respondermod:MoveDoor
user: 0
waiton: -1
- type: animcmdmsg
params:
receivers:
- 006D:Door5
animname: AnimDoor5
cmds:
- setforewards
- continue
waiton: 0
- type: soundmsg
params:
receivers:
- 0011:BtnSndEm2
cmds:
- play
- setvolume
volume: 1
waiton: -1
nextstate: 1
waittocmd:
- key: 0
msg: 0
- cmds:
- type: oneshotmsg
params:
receivers:
- oneshotmod:BtnOSP2
callbacks:
- marker: TouchButton
receiver: respondermod:MoveDoor
user: 0
waiton: -1
- type: animcmdmsg
params:
receivers:
- 006D:Door5
animname: AnimDoor5
cmds:
- setbackwards
- continue
waiton: 0
- type: soundmsg
params:
receivers:
- 0011:BtnSndEm2
cmds:
- play
- setvolume
volume: 1
waiton: -1
nextstate: 0
waittocmd:
- key: 0
msg: 0
curstate: 0
flags:
- detecttrigger
When I click on the left button the avatar goes to the right button and does his animation and the door opens.
When I click on the left button again, the same thing happens, only the door closes, ergo the left button is never used.
Now that's the problem.
Regards,
Frits
EDIT: I have figured something out, I have to change the ref: MoveDoor also for each button. Now the avatar stays near the button I have clicked on.
But now I have to use an SDL var to know the position of the door (or maybe the state of the button?), here I need some help. I know how to create an SDL file and a PAK file, but how must I change the script to implement the SDL var?
And the PAK file, can it be just a 'standard' file?