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 andylegate » Thu Mar 27, 2008 8:21 pm

Okay, couldn't resist, I went ahead and tried it.

I'm happy to report: everything works great!!

You can click on the button
The door opens and closes.
The whole thing makes a sound when I click on the button (which I used a file that sounds like a click, then dragging)
And the Avatar animates like he's pushing on a button. (and yes, it takes you out of 1st person to show you that, then puts you back into 1st again, which is great).

Things I learned today: WAY to numerous to even mention!

Things I learnd tonight:
selfanimations: you must have the Y arrow pointing 180 away from what you want the avie to face.

That I'll have to tweek some stuff, like where the button is (the avie grabbed the wall), the seek time for the animation (uhhhh......if I want the animation sooner, should I make the seek time bigger? or smaller?), my sound (need to make my own), speed in which the door opens and closes. All of which will be a piece of cake after what I just learned yesterday and today.

That seeing my avatar do something like that, have an action happen, and hear a sound for it in a Fan Made Age, FREAKIN ROCKS!!!!

This is going to make the temple entrance puzzle at the top of Zephyr Cove really cool. The idea is brick stones have to be moved to make the door open. Now I can do so with sound and animation! Yippy!!!

Okay, going to bed. I'll see y'all tomorrow.
"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 Trylon » Thu Mar 27, 2008 11:46 pm

D'Lanor wrote:That may be so but with the quickscript the oneshotmod works without any ResponderModifier. Nada. Zero. Should there really be 2 of them now? Considering that I am using the behavior to activate it...

Edit: Ok, I removed the oneshot from the modifiers actions. The prp looks better now. Still no hotspot though.

That last one did the trick - the "oneshot" modifier action actually is a shortcut that internally makes a nice respondermodifier for it.
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru

Re: Sound Flags

Postby D'Lanor » Fri Mar 28, 2008 6:36 am

andylegate wrote:Okay, couldn't resist, I went ahead and tried it.

I'm happy to report: everything works great!!

Could you post your working script? I am not asking you to type up the whole thing. You can save the alcscript to a text file from Blender and then copy/paste from there.
"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 » Fri Mar 28, 2008 8:28 am

Here you go, just saw your request now. I was working on finding a new animation, since the door activator is actually a lever, and not a button. I found the one I want to use, so you'll see a new animation in the script. Here it is as a quote, and I'll post a link to the text file too:

the text download link is here: dooraniclksndmvalc.txt

And the quote of it.

Code: Select all
doorbutton:  <-----object you click on
    logic:
        modifiers:
          - tag: DoorOpen     <-----just a reference name made up
            cursor: poised
            flags:
             - localelement
            activators:
             - type: objectinvolume
               remote: doorclick       <-- logic region surrounding the object that is clickable
               triggers:
                - any
            conditions:
             - type: activator
               activators:
                - type: picking
             - type: objectinbox
               satisfied: true
            actions:
             - type: responder
               ref: $SoundResp
             - type: pythonfile
               ref: $DoorOpen
             - type: oneshot
               ref: $DoorOpen
        actions:
          - type: pythonfile
            tag: DoorOpen
            pythonfile:
               file: zcdoorclick         <----Name of the python file used to make door move
               parameters:
                - type: activator
                  ref: logicmod:$DoorOpen
                - type: string
                  value: doorbutton      <--------name of object that is clicked on
          - type: oneshot
            tag: DoorOpen
            oneshot:
                animation: BlndFrntLeverUp <-name of avie animation. just drop the Male/Female part
                seektime: 1.0
                remote: dooranimat  <- Name of the empty put in to show where avie is for animation
          - type: responder
            tag: SoundResp
            responder:
               states:
                - cmds:
                   - type: soundmsg
                     params:
                        receivers:
                         - 0011:zcdoorsnd1          <---Name of the door sound emitter
                        cmds:
                         - play
                         - setvolume
                        volume: 1
                     waiton: -1
                  nextstate: 0
                  waittocmd: 0
               curstate: 0
               flags:
                - detect_trigger
"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 » Fri Mar 28, 2008 9:06 am

andylegate wrote:That I'll have to tweek some stuff, like where the button is (the avie grabbed the wall), the seek time for the animation (uhhhh......if I want the animation sooner, should I make the seek time bigger? or smaller?),

Smaller if you want it sooner. However I am not sure if seektime works. The quickscript sets it to 1 second but it never cuts off for me there. The avatar just keeps on seeking until it reaches the target spot. By tweaking the placement of my region, clickable and target (preventing the avatar to get behind the clickable) I have managed to cut that down to max 3 seconds. And then I have a timer set for the actions to start after 3 seconds.
"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 D'Lanor » Fri Mar 28, 2008 10:29 am

Ok, I just got home and tried your script. I only replaced my objectnames and left everything else as it was, no behavior.

Still no hotspot.

As soon as I revert to the quickscript: Bingo! The hotspot is back. And btw, the quickscript does not even mind the clickable sticking out of its region.

So the only way I am ever going to see anything happening at all is by using the quickscript in combination with the soundresponder logic. Maybe that will work better now that we have added the initial tag.
"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 » Fri Mar 28, 2008 11:11 am

Just thought of something.............

What version of the plugin are you using???

I downloaded the very latest and greatest from the trunk just this past week.

Could that be what is going on? Mine is working because of a fix that was done and is in the trunk, but your's is an older version without all the fixes? What do you think?

If everything is set right, and you used my script that we KNOW works.....that's the only thing that I can think that would be different between your set up and my set up, and that's the plugin.
"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 andylegate » Fri Mar 28, 2008 11:30 am

Hey D'Lanor.....

Didn't you say you had a python script that would delay? Could you post it here so I could look at it? I'm trying to figure out a way to delay the door opening by a couple of seconds. I already have the sound delay (that was simple, just add 2 seconds of silence at the begining of the sound file).
But I'm trying to figure out how to delay the door.
"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 » Fri Mar 28, 2008 12:04 pm

I modified the Python script you posted earlier to add the extra delay timer. You have to move some code from OnNotify to OnTimer.

Code: Select all
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):

    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 = 5.0
        # Delay for avatar animation
        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)
            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)
                    # Register a timer callback for closing the gate
                    PtAtTimeCallback(self.key,self.DoorTimerInterval,self.DoorCloseTimerId)
                # Open the gate, if it is closed
                elif self.DoorState == DoorStateClosed:
                    self.StartTime = time.clock()
                    self.DoorState = DoorStateOpening
                    # Register a timer callback for opening the gate
                    PtAtTimeCallback(self.key,self.DoorTimerInterval,self.DoorOpenTimerId)
"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 D'Lanor » Fri Mar 28, 2008 12:12 pm

andylegate wrote:Just thought of something.............

What version of the plugin are you using???

I downloaded the very latest and greatest from the trunk just this past week.

Could that be what is going on? Mine is working because of a fix that was done and is in the trunk, but your's is an older version without all the fixes? What do you think?

Yes, that could be the problem. I am basically running 1.3.0 with just my own two contributions added, and a workaround for the invisible avatar shadow (which should be fixed in the trunk by now).

Edit: Ok, I updated from the SVN. Got revision 111 and installed it. No change. The hotspot still got lost.

I did notice some z offset fixes for my transparent textures though. I bet the sprite which I deleted only yesterday would have looked good now. :cry:

Edit 2:Nope sprites still look bad and now that I look closer some transparent textures are kind of borked. They are playing chameleon against the fog. Now I remember why I was reluctant to upgrade to the bleeding edge version. :?
"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 5 guests

cron