Animation interplay

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!
ekimmai
Posts: 79
Joined: Mon Apr 14, 2008 5:04 am
MOULa KI#: 0
Location: Winchester, UK

Re: Animation interplay

Post by ekimmai »

Okay thankyou very much D'L, I will give this a try over the next few days if possible. Really appreciate your help.

Ekimmai
ekimmai
Posts: 79
Joined: Mon Apr 14, 2008 5:04 am
MOULa KI#: 0
Location: Winchester, UK

Re: Animation interplay

Post by ekimmai »

Okay, I've tried adding the necessary code for my first animation as a test but it doesn't seem to cope with saving colour states. Truth is I am out of my depth so think I will resort to making a plea for coding help on the Python forum page....


Code: Select all

# Pedestal Rises and Button 3 goes Green


PedRegion:
   animations:
        - name: PedRgnUp
          autostart: 0
          loop: 0
    logic:
        modifiers:
          - tag: ActToggle
            flags:
              - multitrigger
            activators:
              - type: objectinvolume
                triggers:
                  - enter
            conditions:
              - type: volumesensor
                satisfied: true
                direction: enter
            actions:
              - type: pythonfile
                ref: $BoolToggle
             - type: responder
                ref: :PedUp
        actions:
          - type: pythonfile
            tag: BoolToggle
            pythonfile:
                file: xAgeSDLBoolToggle
                parameters:
                  - type: activator
                    ref: logicmod:$ActToggle
                  - type: string
                    value: PedUpsdl
                  - type: skip
                  - type: skip
                  - type: string
                    value: PedUpsdl
          - type: responder
            name: PedUp
            responder:
               states:
                - cmds:
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:PedRegion
                        animname: PedRgnUp
                        cmds:
                         - continue
                     waiton: -1
                   - type: soundmsg
                     params:
                        receivers:
                          - 0011:emitscreen
                        cmds:
                          - play
                          - setvolume
                        volume: 0.6
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:FloorPanel
                        animname: FPanelDown
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:FloorFlap1
                        animname: Flap1Open
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:FloorFlap2
                        animname: Flap2Open
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:PedestalFloor
                        animname: PFloorUp
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:PedestalFoot
                        animname: PedFUp
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:PedestalBase
                        animname: PedBUp
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:PedestalRamp
                        animname: PedRUp
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:Pedestal
                        animname: PedUp
                        cmds:
                         - continue
                     waiton: -1
                  - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:PedestalBlocker
                        animname: PedBlockUp
                        cmds:
                         - continue
                     waiton: -1
                  - type: animcmdmsg
                     params:
                        receivers:
                         - 0043:ButtonMat3-ButtonLayer3
                        cmds:
                         - continue
                     waiton: -1
D'Lanor
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Animation interplay

Post by D'Lanor »

You are missing the xAgeSDLBoolRespond pythonfilemod. You are toggling the sdl state but there is nothing to respond to it. In effect this is still the old situation.

Your modifier actions should only contain pythonfilemods. Remove the responder from the actions and add it to the xAgeSDLBoolRespond pythonfilemod.

Code: Select all

          - type: pythonfile
            pythonfile:
                file: xAgeSDLBoolRespond
                parameters:
                  - type: string
                    value: PedUpsdl
                  - type: responder
                    ref: $PedUp
                  - type: responder
                    ref: $???
                  - type: bool
                    value: false
                  - type: bool
                    value: true


The global python file xAgeSDLBoolRespond requires 2 responders btw.

For a one way toggle you can use xAgeSDLBoolSet instead of xAgeSDLBoolToggle. The parameters for xAgeSDLBoolSet are:

Code: Select all

          - type: pythonfile
            tag: BoolSet
            pythonfile:
                file: xAgeSDLBoolSet
                parameters:
                  - type: activator
                    ref: logicmod:$ActToggle
                  - type: string
                    value: PedUpsdl
                  - type: skip
                  - type: skip
                  - type: skip
                  - type: skip
                  - type int
                    value: 1
                  - type: string
                    value: PedUpsdl


This will always set the sdl value to 1 and not toggle it.

You will still need a second responder for xAgeSDLBoolRespond though. You must make a responder with a full reversed animation since this is the key for saving the state. This reversed responder is run in fast forward mode at link in!
"It is in self-limitation that a master first shows himself." - Goethe
ekimmai
Posts: 79
Joined: Mon Apr 14, 2008 5:04 am
MOULa KI#: 0
Location: Winchester, UK

Re: Animation interplay

Post by ekimmai »

Okay, I feel like I am making some headway with the code updates for the first simple push-button triggered animation, and yet I cannot get even the doorbuttontouch animation to work despite the cursur being poised ready to click. I have followed the code given and looked at the code on http://www.guildofwriters.com/wiki/Savi ... %27_States, but still no success. Please tell me where it is going wrong: :cry:
(I haven't included all the animation code for each object). One line is commented out because it differs between versions of the code but I tried with and without.

Also D'L, for the BoolSet alternative where is the responder triggered? There are 2 for xAgeSDLBoolRespond but seemingly none for xAgeSDLBoolSet so how does it know whihc animations to trigger?
THANKS

Code: Select all

# Button 3 pressed - opens/shuts Door3

Button3:
    visual:
      matanims:
         - mat: ButtonMat3
           flags:
            - stopped
    logic:
        modifiers:         
         - tag: AutoClick
            cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: ButtonRgn3
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: pythonfile
                ref: $BoolToggle
        actions:
          - type: pythonfile
            tag: BoolToggle
            pythonfile:
                file: xAgeSDLBoolToggle
                parameters:
                  - type: activator
                    ref: logicmod:$AutoClick
                  - type: string
                    value: D3sdl
                  - type: skip
                  - type: skip
                  - type: string
                    value: D3sdl
         

ButtonOneshot3:
   logic:
      actions:
         - type: oneshot
           name: ButtonOneshot3
           oneshot:
             animation: DoorButtonTouch
               
DoorRight3:
    animations:
        - name: DoorR3Open
          autostart: 0
          loop: 0
         loopstart: 0
          loopend: 6
        - name: DoorR3Close
          autostart: 0
          loop: 0
          loopstart: 6
          loopend: 12
    logic:
        actions:
          - type: pythonfile
#            tag: BoolRespond
            pythonfile:
                file: xAgeSDLBoolRespond
                parameters:
                  - type: string
                    value: D3sdl
                  - type: responder
                    ref: :D3Open
                  - type: responder
                    ref: :D3Close
                  - type: bool
                    value: false
                  - type: bool
                    value: true
         - type: responder
            name: D3Open
            responder:
               states:
                - cmds:
               - type: oneshotmsg
                params:
                  receivers:
                   - oneshotmod:ButtonOneshot3
                   callbacks:
                     - marker: "DoorButtonTouch"
                     receiver: respondermod:D3Open
                     user: 0
                waiton: -1
                   - type: soundmsg
                     params:
                        receivers:
                          - 0011:emitbutton
                        cmds:
                          - play
                          - setvolume
                        volume: 0.6
                     waiton: 0
                   - type: soundmsg
                     params:
                        receivers:
                          - 0011:emitdoor3o
                        cmds:
                          - play
                          - setvolume
                        volume: 0.6
                     waiton: 0
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockPoleL
                        animname: LockPLUp
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockPoleR
                        animname: LockPRUp
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockBarL1
                        animname: LockBL1Up
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockBarL2
                        animname: LockBL2Up
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockBarL3
                        animname: LockBL3Up
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockBarR1
                        animname: LockBR1Up
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockBarR2
                        animname: LockBR2Up
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockBarR3
                        animname: LockBR3Up
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:DoorLeft3
                        animname: DoorL3Open
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:DoorRight3
                        animname: DoorR3Open
                        cmds:
                         - continue
                     waiton: -1
              nextstate: 1
              waittocmd:
               - key: 0 #cmds with waiton of 0
                msg: 0 #wait for callback for user 0
               curstate: 0
               flags:
                 - detecttrigger               
          - type: responder
            name: D3Close
            responder:
               states:
                - cmds:
               - type: oneshotmsg
                params:
                  receivers:
                   - oneshotmod:ButtonOneshot3
                   callbacks:
                     - marker: "DoorButtonTouch"
                     receiver: respondermod:D3Close
                     user: 0
                waiton: -1
                   - type: soundmsg
                     params:
                        receivers:
                          - 0011:emitbutton
                        cmds:
                          - play
                          - setvolume
                        volume: 0.6
                     waiton: 0
                   - type: soundmsg
                     params:
                        receivers:
                          - 0011:emitdoor3c
                        cmds:
                          - play
                          - setvolume
                        volume: 0.6
                     waiton: 0
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockPoleL
                        animname: LockPLDn
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockPoleR
                        animname: LockPRDn
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockBarL1
                        animname: LockBL1Dn
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockBarL2
                        animname: LockBL2Dn
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockBarL3
                        animname: LockBL3Dn
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockBarR1
                        animname: LockBR1Dn
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockBarR2
                        animname: LockBR2Dn
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:LockBarR3
                        animname: LockBR3Dn
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:DoorLeft3
                        animname: DoorL3Close
                        cmds:
                         - continue
                     waiton: -1
                   - type: animcmdmsg
                     params:
                        receivers:
                         - 006D:DoorRight3
                        animname: DoorR3Close
                        cmds:
                         - continue
                     waiton: -1
              nextstate: 0
              waittocmd:
               - key: 0
                msg: 0
               curstate: 0
               flags:
                  - detecttrigger
   
D'Lanor
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Animation interplay

Post by D'Lanor »

ekimmai wrote:Also D'L, for the BoolSet alternative where is the responder triggered? There are 2 for xAgeSDLBoolRespond but seemingly none for xAgeSDLBoolSet so how does it know whihc animations to trigger?
THANKS

I only have a few minutes so I cannot look at your full alcscript but I can answer this.

Neither xAgeSDLBoolSet nor xAgeSDLBoolToggle are triggering any responders. They only change sdl states. That is why you also need xAgeSDLBoolRespond in order to run responders when the sdl changes.
"It is in self-limitation that a master first shows himself." - Goethe
D'Lanor
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Animation interplay

Post by D'Lanor »

There is a fatal indentation error around where your - cmds: come in.
"It is in self-limitation that a master first shows himself." - Goethe
ekimmai
Posts: 79
Joined: Mon Apr 14, 2008 5:04 am
MOULa KI#: 0
Location: Winchester, UK

Re: Animation interplay

Post by ekimmai »

I think the indentation error is only in the pasted code (seems I cannot get it to paste correctly even on a second attempt).
Any other thoughts about where the problem might lie?

Thanks!!
E
Post Reply

Return to “Building”