Page 7 of 13

Re: Turtle Isle (age problems)

Posted: Thu Jan 27, 2011 2:42 am
by dendwaler
Thx D' Lanor!

It works ! ........like magic. :D

I am afraid that I will be back soon, with a new question.

Re: Turtle Isle (age problems)

Posted: Thu Jan 27, 2011 8:04 am
by dendwaler
I added a soundemitter called : Door1_se
How can I invoke a trigger for sound into the last script for opening the door,
in such way that it is in sync with the animation of the door?
My soundfile has the same timelength as the animation.

Thx in advance!

Re: Turtle Isle (age problems)

Posted: Thu Jan 27, 2011 11:00 am
by Jojon
Add a sound message to the same responder action lists that already contain your animation messages.

Code: Select all

                      - type: soundmsg
                        params:
                            receivers:
                              - 0011:Door1_se
                            cmds:
                              - play
                        waiton: 0

Re: Turtle Isle (age problems)

Posted: Thu Jan 27, 2011 1:32 pm
by dendwaler
Thx Jojon,

the sound is working!

1 problem remains with the door.
when i press the button the first time the door opens with sound.
when the sequence has ended and i press the second time the door does not open , the soundfile does play.
The third press, opens the door again with sound played.
and so on, every uneven presses are correct, even presses not.
Does it have to do something with "nextstate and cuurent state"?

Re: Turtle Isle (age problems)

Posted: Thu Jan 27, 2011 1:44 pm
by D'Lanor
Probably because of the waiton value 0. Try this.

Code: Select all

Door1:
    animations:
      - name: DoorOpen1
        autostart: 0
        loop: 0
    logic:
        actions:
          - type: responder
            name: DoorOpen
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:DoorButtonOneshot
                            callbacks:
                              - marker: DoorButtonTouch
                                receiver: respondermod:DoorOpen                   
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:Door1
                            animname: DoorOpen1   
                            cmds:
                              - continue
                        waiton: 0
                      - type: soundmsg
                        params:
                            receivers:
                              - 0011:Door1_se
                            cmds:
                              - play
                        waiton: -1
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger
          - type: responder
            name: DoorOpen.001
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:DoorButtonOneshot.001
                            callbacks:
                              - marker: DoorButtonTouch
                                receiver: respondermod:DoorOpen.001
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:Door1
                            animname: DoorOpen1   
                            cmds:
                              - continue
                        waiton: 0
                      - type: soundmsg
                        params:
                            receivers:
                              - 0011:Door1_se
                            cmds:
                              - play
                        waiton: -1
                    nextstate: 0
                    ncallbacks: 1
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger

Re: Turtle Isle (age problems)

Posted: Thu Jan 27, 2011 2:01 pm
by Jojon
Sounds more like dendwalder has added a new state for the sound.

The sound message should be part of the same commands list (" - cmds:") as the animation, the way D'Lanor shows -- not given a state entry of its own (you'd use more states if you want the type of behaviour described, e.g. if you want the button to toggle open and closed state for the door; press once to open and another time to close).

waiton: 0 should be correct, otherwise the sound will start too early.

Re: Turtle Isle (age problems)

Posted: Thu Jan 27, 2011 2:09 pm
by dendwaler
I replaced the script with yours D'lanor.
Unfortunately this makes no difference, except for the sound which starts exact now.

I want it to close automaticly, not a toggle for open and close.
In the end, i want that you can only open the door if you have touched all the journey clothes in my age.

In that way , with more players in the age the door can only be opened by those who have forfilled the journey task even with several people in the age.

Re: Turtle Isle (age problems)

Posted: Thu Jan 27, 2011 2:21 pm
by D'Lanor
Both Jojon's and mine should work if added to the same responder. The sound will NOT start too early in my example though. The FIRST message with waiton 0 holds any subsequent message.

I have no idea what went wrong. If it worked without sound it should work with it.

Re: Turtle Isle (age problems)

Posted: Thu Jan 27, 2011 2:26 pm
by dendwaler
If it worked without sound it should work with it.


Oh sorry, i was not clear in that.
Without the sound it did not work either.
I posted it worked in my enthousiasme, but did not immediately notice that it only responded on uneven presses :oops:

Re: Turtle Isle (age problems)

Posted: Thu Jan 27, 2011 2:28 pm
by D'Lanor
On second thought, are you sure your animation and sound are of the same length? Or does the animation have a static section at the end which is still "playing" even though it seems finished?

Edit: Oops, cross posted. Forget this then.