Question about event triggering.

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.
Post Reply
User avatar
dendwaler
Posts: 936
Joined: Mon Jun 22, 2009 10:49 am
MOULa KI#: 0
Location: Nederland

Question about event triggering.

Post by dendwaler »

Hi all,
I want to trigger events just by entering a region.
Not using a button, but just the fact that the avatar enters a defined "volume in space" it triggers a oneshot event.
Can be a sound or an animation.

Is that possible?
Can anyone give me a script for this?
Thx in advance.
Those wonderfull Worlds are called " Ages" , because that is what it takes to build one.



Watch my latest Video Or even better..... watch the Cathedral's Complete Walkthrough made by Suleika!
D'Lanor
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Question about event triggering.

Post by D'Lanor »

There is a QuickScript for a region that triggers an avatar animation (oneshot).

Edit: And here is the longer version...

Code: Select all

<region>:
    logic:
        modifiers:
          - flags:
              - multitrigger
            activators:
              - type: objectinvolume
                triggers:
                  - enter
            conditions:
              - type: volumesensor
                satisfied: true
                direction: enter
            actions:
              - type: responder
                ref: <responder name>
This triggers a responder to which you can assign anything you want.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
dendwaler
Posts: 936
Joined: Mon Jun 22, 2009 10:49 am
MOULa KI#: 0
Location: Nederland

Re: Question about event triggering.

Post by dendwaler »

I am aware of that, but unfortunately its not the avatar that has to be animated.
To be more exact , I want a sound that starts to play when the avatar enters a space volume.
But the sound will still be heard when the avatar leaves this space.

This cannot be done with soundregions, because they will stop abruptly when you leave the region.

Edit,
Sorry I did not see your edit, because i was writing the post above.
Okay then I edit this post as well.

I think your answer, answers my question, I will give this a try.
Thx, ronal 'D
Those wonderfull Worlds are called " Ages" , because that is what it takes to build one.



Watch my latest Video Or even better..... watch the Cathedral's Complete Walkthrough made by Suleika!
User avatar
dendwaler
Posts: 936
Joined: Mon Jun 22, 2009 10:49 am
MOULa KI#: 0
Location: Nederland

Re: Question about event triggering.

Post by dendwaler »

Me again, :oops:

Sorry , but my understanding of Alcscript and Python is still minimal.
I tried the following but it did not work.

Code: Select all

Rgn_Snd:
    logic:
        modifiers:
          - flags:
              - multitrigger
            activators:
              - type: objectinvolume
                triggers:
                  - enter
            conditions:
              - type: volumesensor
                satisfied: true
                direction: enter
            actions:
              - type: responder
                ref: Snd_Emit

Snd_Emit:		
	type: soundemit
	sound:
		flags:
			- is3dsound
			- localonly
		file: <soundfile>
		volume: 1
		minfdist: 50
maxfdist: 100
type: ambient 

I thought the code - ref: <responder name> -
should be : ref: :<responder name>
Or this line should be:
name: <random>

Then i made the next:

Code: Select all

Rgn_Snd:
    logic:
        modifiers:
          - flags:
              - multitrigger
            activators:
              - type: objectinvolume
                triggers:
                  - enter
            conditions:
              - type: volumesensor
                satisfied: true
                direction: enter
            actions:
              - type: responder
                ref: Music
                responder:
                states:
                  - cmds:
                  - type: soundmsg
                    params:
                            receivers:
                              - 0011:Snd_Emit	                      
                flags:
                  - detecttrigger		
			
Snd_Emit:		
	type: soundemit
	sound:
		flags:
			- is3dsound
			- localonly
		file: Cathedral_S_A
		volume: 1
		minfdist: 50
                                 maxfdist: 100	
	                type: ambient 
Still no result.
Can you give me more clues?
Those wonderfull Worlds are called " Ages" , because that is what it takes to build one.



Watch my latest Video Or even better..... watch the Cathedral's Complete Walkthrough made by Suleika!
D'Lanor
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Question about event triggering.

Post by D'Lanor »

You did not define a responder to play the sound. It is not possible to run a sound emitter directly.

Code: Select all

Rgn_Snd:
    logic:
        modifiers:
          - flags:
              - multitrigger
            activators:
              - type: objectinvolume
                triggers:
                  - enter
            conditions:
              - type: volumesensor
                satisfied: true
                direction: enter
            actions:
              - type: responder
                ref: Resp_Snd
        actions:
          - type: responder
            name: Resp_Snd
            responder:
                states:
                  - cmds:
                      - type: soundmsg
                        params:
                            receivers:
                              - 0011:Snd_Emit
                            cmds:
                              - play
                        waiton: -1
                    nextstate: 0
                    waittocmd: 0
                curstate: 0
                flags:
                  - detecttrigger
Sorry, I thought you had seen enough AlcScript by now to figure out the rest.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
dendwaler
Posts: 936
Joined: Mon Jun 22, 2009 10:49 am
MOULa KI#: 0
Location: Nederland

Re: Question about event triggering.

Post by dendwaler »

Sorry, I thought you had seen enough AlcScript by now to figure out the rest.
I wished , this was true.
Its realy very hard for me to understand Alcscript and python is even worse.
The mistakes i can make , I do make.
It withholds me a bit from making better puzzles in my ages, because i never get the code working.

Thx for your help again D'lanor, this one works as it should.
I can realy use this on many places.
So it helped me a lot.
Those wonderfull Worlds are called " Ages" , because that is what it takes to build one.



Watch my latest Video Or even better..... watch the Cathedral's Complete Walkthrough made by Suleika!
Post Reply

Return to “Scripting”