Sound Flags

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!

Re: Sound Flags

Postby Aloys » Fri Mar 28, 2008 6:45 pm

Oh my god.. :shock: I don't want to sound like a partycrasher, I swear I don't. But, I just read the last couple pages, and at this precise moment I'm totally scared by the huge amount of work that needs to be done just to get a door to open and an avatar to play the corresponding animation..
As a '3D artist' (at least as far as Age creation is concerned) this amount of code just scares me. I guess I will totally have to wait and hope that you guys can produce a more 'practical' solution to such 'simple' problems; because as it stand, even as someone who feels quite dedicated to Age creation I just don't feel able anymore to fully create a whole Age, even a small one, with that kind of work as part of the process. Of course, not all Ages need to have doors, or avatar animations; but then again I always design my Ages thinking that all Plasma features are accessible to me, or at least will be at some point.
Now I guess I'll just stop typing before I sound like an annoying whinner. ;)

And to end on a more happy note: nice work guys (especially Andy) on getting all this to work! :)
User avatar
Aloys
 
Posts: 1968
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: Sound Flags

Postby D'Lanor » Fri Mar 28, 2008 6:58 pm

Aloys wrote:Oh my god.. :shock: I don't want to sound like a partycrasher, I swear I don't. But, I just read the last couple pages, and at this precise moment I'm totally scared by the huge amount of work that needs to be done just to get a door to open and an avatar to play the corresponding animation.

Actually the alcscript part for that can be 4 lines of quickscript. What got this started was that andy wanted a sound to go with it. And there was no quickscript for that. Hopefully someone will turn this into a quickscript (hint hint). I would give it a try if I felt qualified but since I never got it to work at all...
Last edited by D'Lanor on Fri Mar 28, 2008 7:30 pm, edited 1 time in total.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Sound Flags

Postby Aloys » Fri Mar 28, 2008 7:02 pm

Well, that's a relief! :) '4 lines' sounds much easier to deal with. :) (I haven't tried to dwelve into the advanced function of Alcscript yet)
User avatar
Aloys
 
Posts: 1968
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: Sound Flags

Postby andylegate » Fri Mar 28, 2008 9:55 pm

It can be done, .....I think anyway. I mean I've looked at the python script file of the plug in for quickscripts, and I see how they have things laid out. I'd offer to do a quick script for clickable sounds, BUT.......

While I have what is called a "high pattern recognition" and "high deductive reasoning" I can use those to tease info out of things like Python and ALC. But trying to put in my own quickscript......I just don't know python enough to attempt it.

But D'Lanor is right. What made my script so long is that I wanted to make a door move, when a button was pushed, sounds with it, and also animate the avatar, all with that one click.

Now, the thing that is hard, and really needs to be worked on (my own hint, hint) is to find a way to make mesh objects move using Blender, and ALCscripting, instead of how we do it right now, which is with some very long, and complex Python files. That's not how Cyan did it. They used 3DSMax along with what ever other tools they have.
I don't know if Blender can do this, I would think it can, as you're suppose to do animation in it for making stuff, and for the BGE. So I would think the possibility is there, but they have to figure out what all is going on with Plasma and how it knows to move things in an Age. Then reverse engineer that back and figure out a way for the Plugin and Blender to do it. Then things will get better.

Unfortunately, the developers were asked by Cyan way back when to keep Plasma's inner workings to themselves, so unfortunately there maybe a lot more help out there, but the info is not going to go out (legal problems, I really do understand that, really, just a shame is all).

Keep in mind though.....Age creation is advancing at a furious rate, compared to maybe a year ago? Yes?

We'll get the bugs worked out. Promise.

You see, you guys have me. And I tend to jump up and down looking to do things all the time, and get explinations on how to do things. And everytime, I get help and answers, sometimes it takes a while, but they do happen.......most likely to shut me up! :D
But hey! That's good, right? I mean everyone sees the answers then. :)

Oh, and hey. Aloys. Don't let it scare you off. I'm telling you, when I first clicked on my door button, saw the avie do it, heard the click and sliding sound, and saw the door move in my own Age, it just freakin rocked!!!!
"I'm still trying to find the plKey for Crud!"
Image
Blender Age Creation Tutorials
3DS Max Age Creation Tutorials
User avatar
andylegate
 
Posts: 2348
Joined: Mon Oct 01, 2007 7:47 am

Re: Sound Flags

Postby Goofy » Sat Mar 29, 2008 8:46 am

I have a few questions. Where can I find something on how to setup a clickable in general. Because the way I see it doors and buttons are basicly clickables just with different behaviors programed for them. I just want to make a clickable button.
We keep moving forward,
openning up new doors and doing new things,
Because we're curious... and curiosity keeps
leading us down new paths

Walt Disney

Keep moving forward
Goofy
 
Posts: 162
Joined: Mon Oct 01, 2007 8:51 pm

Re: Sound Flags

Postby D'Lanor » Sat Mar 29, 2008 9:57 am

Goofy wrote:I have a few questions. Where can I find something on how to setup a clickable in general. Because the way I see it doors and buttons are basicly clickables just with different behaviors programed for them. I just want to make a clickable button.

Place your object inside a region and make sure it has bounds on. The alcscript for a simple clickable without avatar animation is:

Code: Select all
<clickable object>:
    quickscript:
        simpleclick:
            pythonfile: <python filename without .py>
            region: <region name>


Previously in this thread we had a discussion about enabling the actor button for clickables. I find that I always have to set actor on for an hotspot to appear at all, but for andy it works without that. :? I guess my setup must be borked somehow.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Sound Flags

Postby andylegate » Sat Mar 29, 2008 11:04 am

I'm not sure why that is either.

I'm afraid that the delay thing is not working. When I added it (changed things around like you showed) my door went back to not working.

I've been messing around with it. Python log shows different errors depending on what I do. Latest error, is this:

(03/29 08:56:11) DEBUG: xAgeSDLBoolShowHide.EnableObject: Attempting to enable drawing and collision on activedoor...
(03/29 08:56:33) OnNotfiy: id= 1
(03/29 08:56:33) ID of Clickable logicmod: 1
(03/29 08:56:33) Message: <PlasmaTypes.ptAttribString instance at 0x22CCAF30>
(03/29 08:56:33) Value of message: 'doorbutton'
(03/29 08:56:33) OnNotfiy: id= 1
(03/29 08:56:33) ID of Clickable logicmod: 1
(03/29 08:56:33) Message: <PlasmaTypes.ptAttribString instance at 0x22CCAF30>
(03/29 08:56:33) Value of message: 'doorbutton'
(03/29 08:56:35) Processing activedoor
(03/29 08:56:35) Traceback (most recent call last):
(03/29 08:56:35) File ".\python\zcdoorclick.py", line 87, in OnTimer
(03/29 08:56:35) PtAtTimeCallback(self.key,self.DoorTimerInterval,self.DoorOpenTimerID)
(03/29 08:56:35) AttributeError: zcdoorclick instance has no attribute 'DoorOpenTimerID'


Here's the python:

Code: Select all
# emacs-mode: -*- python-*-
from Plasma import *
from PlasmaTypes import *
from PlasmaKITypes import *
from PlasmaVaultConstants import *
from PlasmaNetConstants import *
import xLocalization
import string
import time

DoorStateOpen = 1
DoorStateClosing = 2
DoorStateClosed = 3
DoorStateOpening = 4

actClickableObject = ptAttribActivator(1, 'Act: Clickable Object')
ObjectMsg = ptAttribString(2, 'Object String')

class zcdoorclick(ptModifier):
    __module__ = __name__

    def __init__(self):
        ptModifier.__init__(self)
        self.id = 51110001
        self.version = 1
        self.AgeName = None
        self.doorcollider = None
        self.activedoor = None
        self.StartTime = 0
        self.DoorState = DoorStateClosed
        self.XWidth = 4.5
        self.XClosedPos = 353.072
        self.XOpenPos = self.XClosedPos + self.XWidth
        self.DoorTimerInterval = .03
        self.DoorOpenTimerId = 1
        self.DoorCloseTimerId = 2
        self.DoorMoveDuration = 2.0
        #Avatar Delay
        self.DelayInterval = 2.0
        self.DelayTimerId = 3

    def OnFirstUpdate(self):
        self.AgeName = PtGetAgeName()
       
    def OnServerInitComplete(self):
        # Obtain the gate collision object
        self.doorcollider = PtFindSceneobject("doorcollider",self.AgeName)
        if self.doorcollider == None:
            print 'OnServerInitComplete - could not find doorcollider!'
        # Obtain the visible gate object
        self.activedoor = PtFindSceneobject("activedoor",self.AgeName)
        if self.activedoor != None:
            # Turn off its physics, since we will be moving it
            self.activedoor.physics.suppress(true)
        else:
            print 'OnServerInitComplete - could not find activedoor!'


    def OnNotify(self, state, id, events):
        print 'OnNotfiy: id=',
        print id
        print 'ID of Clickable logicmod:',actClickableObject.id
        if (id == actClickableObject.id):
            print "Message:",ObjectMsg
            print "Value of message: '%s'"%(ObjectMsg.value)
                     # Register a timer callback for opening the gate
            PtAtTimeCallback(self.key,self.DelayInterval,self.DelayTimerId)


    def OnTimer(self, id):
        if (id == self.DelayTimerId):
            # Check for the button press
            if ObjectMsg.value == "doorbutton" and self.activedoor != None:
                print "Processing activedoor"
                # Close the gate, if it is open
                if self.DoorState == DoorStateOpen:
                    self.StartTime = time.clock()
                    self.DoorState = DoorStateClosing
                    # Enable the gate collider, to prevent access during the close
                    self.doorcollider.physics.suppress(false)
                    PtAtTimeCallback(self.key,self.DoorTimerInterval,self.DoorCloseTimerId)
                     # Register a timer callback for closing the gate
               # Open the gate, if it is closed
                elif self.DoorState == DoorStateClosed:
                    self.StartTime = time.clock()
                    self.DoorState = DoorStateOpening
                    PtAtTimeCallback(self.key,self.DoorTimerInterval,self.DoorOpenTimerID)

            # Calculate the Z position of the gate, based on the
            # duration since the button press
        elif (id == self.DoorOpenTimerId):
            currentTime = time.clock()
            xPos = self.XClosedPos + ((currentTime - self.StartTime)/self.DoorMoveDuration)*self.XWidth
            oldPos = self.activedoor.position()
            newPos = ptPoint3(xPos,oldPos.getY(),oldPos.getZ())
            # Warp the visible gate object to the new position
            self.activedoor.physics.warp(newPos)
            if xPos >= self.XOpenPos:
                self.DoorState = DoorStateOpen
                # Turn off the collider - the gate is now open
                self.doorcollider.physics.suppress(true)
            else:
                PtAtTimeCallback(self.key,self.DoorTimerInterval,self.DoorOpenTimerId)
        elif (id == self.DoorCloseTimerId):
            currentTime = time.clock()
            # Calculate the Z position of the gate, based on the
            # duration since the button press
            xPos = self.XOpenPos - ((currentTime - self.StartTime)/self.DoorMoveDuration)*self.XWidth
            oldPos = self.activedoor.position()
            newPos = ptPoint3(xPos,oldPos.getY(),oldPos.getZ())
            # Warp the visible gate object to the new position
            self.activedoor.physics.warp(newPos)
            if xPos <= self.XClosedPos:
                self.DoorState = DoorStateClosed
            else:
                PtAtTimeCallback(self.key,self.DoorTimerInterval,self.DoorCloseTimerId)


Unfortunately I'm a little out of it right now. I just spend the last 6 hours working on our Van, tearing the engine apart so that I could get the A/C compress removed and the bypass pully in place. It's all back together now, but I'm very tired and sore. ooch.
"I'm still trying to find the plKey for Crud!"
Image
Blender Age Creation Tutorials
3DS Max Age Creation Tutorials
User avatar
andylegate
 
Posts: 2348
Joined: Mon Oct 01, 2007 7:47 am

Re: Sound Flags

Postby D'Lanor » Sat Mar 29, 2008 11:07 am

andylegate wrote:It can be done, .....I think anyway. I mean I've looked at the python script file of the plug in for quickscripts, and I see how they have things laid out. I'd offer to do a quick script for clickable sounds, BUT.......

While I have what is called a "high pattern recognition" and "high deductive reasoning" I can use those to tease info out of things like Python and ALC. But trying to put in my own quickscript......I just don't know python enough to attempt it.

But D'Lanor is right. What made my script so long is that I wanted to make a door move, when a button was pushed, sounds with it, and also animate the avatar, all with that one click.

Wel, I did it! I added sound to the simpleclick quickscript. :) And my clickable was still clickable and did everything it did before. It came out in the logfile like this:

Code: Select all
  [QuickScript - Simple Clickable]
Resulting Code for .logic.modifiers:
- tag: AutoClick
  cursor: poised
  flags:
    - localelement
  activators:
    - type: objectinvolume
      remote: RgnCloud
      triggers:
        - any
  conditions:
    - type: activator
      activators:
        - type: picking
    - type: objectinbox
      satisfied: true
    - type: facing
      satisfied: true
      directional: true
  actions:
    - type: pythonfile
      ref: $AutoClick
    - type: responder
      ref: $SoundResp

Resulting Code for .logic.actions:
- type: pythonfile
  tag: AutoClick
  pythonfile:
      file: PradGameState
      parameters:
        - type: activator
          ref: logicmod:$AutoClick
        - type: string
          value: LinkSphere
        - type: behavior
          ref: oneshotmod:$AutoClick
- type: oneshot
  tag: AutoClick
  oneshot:
      animation: ButtonTouch
      seektime: 1.0
      remote: LinkInPointCloud
- type: responder
  tag: SoundResp
  responder:
    states:
      - cmds:
          - type: soundmsg
            params:
                receivers:
                  - 0011:RingClickEmit
                cmds:
                  - play
                  - setvolume
                volume: 1
            waiton: -1
        nextstate: 0
        waittocmd: 0
    curstate: 0
    flags:
      - detecttrigger


So far so good, only... it did not play the sound. :?
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Sound Flags

Postby andylegate » Sat Mar 29, 2008 11:12 am

Let's see.....isn't that last flag suppose to be detect_trigger instead of detecttrigger? The first way is how it's in mine.
"I'm still trying to find the plKey for Crud!"
Image
Blender Age Creation Tutorials
3DS Max Age Creation Tutorials
User avatar
andylegate
 
Posts: 2348
Joined: Mon Oct 01, 2007 7:47 am

Re: Sound Flags

Postby D'Lanor » Sat Mar 29, 2008 11:15 am

andylegate wrote:I'm not sure why that is either.

I'm afraid that the delay thing is not working. When I added it (changed things around like you showed) my door went back to not working.

I've been messing around with it. Python log shows different errors depending on what I do. Latest error, is this:

That is a simple typo. self.DoorOpenTimerID shoud be self.DoorOpenTimerId

andylegate wrote:Let's see.....isn't that last flag suppose to be detect_trigger instead of detecttrigger? The first way is how it's in mine.

But it isn't in the sound region quickscript from which I copied most of this. I asked about that before, but nobody has answered yet.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

PreviousNext

Return to Building

Who is online

Users browsing this forum: No registered users and 1 guest