Page 8 of 20

Re: "The Cathedral" another building project

Posted: Sun Mar 17, 2013 7:46 am
by dendwaler
Thx a lot D'Lanor(and Sirius as well), i will try that.
I will post about the result as soon as i sucessfully implemented it.

Re: "The Cathedral" another building project

Posted: Mon Mar 18, 2013 4:51 am
by dendwaler
Unfortunately nothing happens.
I tried it the way you described without success.

Because i expected that this event would be triggered by an " objectinvolume " instead of an activator object.
I also tried it this way:
Nothing happens either.
To be sure i placed the triggering region named: Rgn_SpawnFromHere
and the destination object(empty) named: SpawnToMe
into the same prp file.
The Pythonfile is named: SpawnToMe.py

Code: Select all

Rgn_SpawnFromHere:
    logic:
        modifiers:
          - flags:
              - multitrigger
            activators:
              - type: objectinvolume
                triggers:
                  - enter
            conditions:
              - type: volumesensor
                satisfied: true
                direction: enter
			actions:
              - type: pythonfile
                pythonfile:
                file: SpawnToMe
                parameters:
                  - type: objectinvolume
                    ref: logicmod:Rgn_SpawnFromHere
                  - type: sceneobject
                    ref: scnobj:SpawnToMe

Re: "The Cathedral" another building project

Posted: Mon Mar 18, 2013 9:32 am
by Jojon
There seem to be an indentation level missing after "pythonfile:"
...and "flags:" should not be a list item (no "-").
...(last edit? :P) ...and the actual pythonfile action should be on the same level as the modifier, with the "action:" inside the modifier containing a reference to the actual action.

(..and as far as I hmm..."understand", the "activator" type reference is to the calling logicmod ( "Hello, Mr. Pythonfile; This is Green Button on the phone." ), regardless of what sort of interaction detection "activators" that logicmod may make use of, so it should still be "type: activator".)


EDIT: Does this work better?:

Code: Select all

Rgn_SpawnFromHere:
    logic:
        modifiers:
          - flags:
              - multitrigger
            activators:
              - type: objectinvolume
                triggers:
                  - enter
            conditions:
              - type: volumesensor
                satisfied: true
                direction: enter
            actions: pythonfile
            ref: $gospawn
        actions:
          - type: pythonfile
            tag: gospawn
            pythonfile:
                file: SpawnToMe
                parameters:
                  - type: objectinvolume
                    ref: logicmod:Rgn_SpawnFromHere
                  - type: sceneobject
                    ref: scnobj:SpawnToMe

Re: "The Cathedral" another building project

Posted: Mon Mar 18, 2013 9:52 am
by Jojon
Argh! Forgot to fix the very things I mentioned and then editing timeout struck. :P

Second try:

Code: Select all

Rgn_SpawnFromHere:
    logic:
        modifiers:
            flags:
              - multitrigger
            activators:
              - type: objectinvolume
                triggers:
                  - enter
            conditions:
              - type: volumesensor
                satisfied: true
                direction: enter
            actions: 
              - type: pythonfile
                ref: $gospawn
        actions:
          - type: pythonfile
            tag: gospawn
            pythonfile:
                file: SpawnToMe
                parameters:
                  - type: activator
                    ref: logicmod:Rgn_SpawnFromHere
                  - type: sceneobject
                    ref: scnobj:SpawnToMe

Re: "The Cathedral" another building project

Posted: Mon Mar 18, 2013 10:05 am
by Jojon
Ok, stop listening to me. I'll shut up now...

Keep the modifier block as a list item (with the "-" before "flags:").

The code I tend to be cutting and pasting, to get things working, usually does not have "flags:" as the first entry -- that threw me -- you had it right. :7

Re: "The Cathedral" another building project

Posted: Mon Mar 18, 2013 11:07 am
by D'Lanor
Yes, that should work. In addition I would give the modifier a name (I'm not sure if it automatically takes on the name of the object if none is given).
Alcscript Show Spoiler
And just a thought dendwaler, did you add the glue section to the Python file?

Re: "The Cathedral" another building project

Posted: Mon Mar 18, 2013 12:19 pm
by dendwaler
That was it D'Lanor your last remark.

I did not add the glue section to the Python file.
That underlines my little programming experience, not enough understanding.

I have a new problem now.
The linking works and brings me to the right place.

But it goes in a straight line through every wall and object.
Then you can see lots of things you are not supposed to see, you even goo outside and i did not build an outside.
It takes away " The magic"
Is there a way to make the screem black during the transportation?
It should be inside the python script aswell i think.

Re: "The Cathedral" another building project

Posted: Mon Mar 18, 2013 12:55 pm
by D'Lanor
Strange, I remember this as an instant warp. Perhaps some camera setting is interfering here. Anyway, I can make it fade out.

Re: "The Cathedral" another building project

Posted: Mon Mar 18, 2013 1:22 pm
by D'Lanor
Here you go. You'll probably have to tweak the 3 delay times above the class line.

Code: Select all

from Plasma import *
from PlasmaTypes import *
actRegion = ptAttribActivator(1, 'Region activator')
objSpawnPoint = ptAttribSceneobject(2, 'Spawn point object')
kFadeOutSeconds = 1.5
kTimerSeconds = 3.0
kFadeInSeconds = 1.5
class SpawnToMe(ptModifier):

    def __init__(self):
        ptModifier.__init__(self)



    def OnNotify(self, state, id, events):
        if ((id == actRegion.id) and state):
            if (not PtWasLocallyNotified(self.key)):
                return 
            PtFakeLinkAvatarToObject(PtGetLocalAvatar().getKey(), objSpawnPoint.value.getKey())
            PtFadeOut(kFadeOutSeconds, 1)
            PtAtTimeCallback(self.key, kTimerSeconds, 1)



    def OnTimer(self, id):
        if (id == 1):
            PtFadeIn(kFadeInSeconds, 0)



# paste glue section here
Hmm, maybe we could make this more realistic by playing a linking sound during the fade in.

Re: "The Cathedral" another building project

Posted: Tue Mar 19, 2013 3:22 am
by dendwaler
This works far more realistic now it fades to black during the jump to the destination.
The time to reach it is longer then i expected.
1, 5 sec fadeout, 7 seconds completely black and 1, 5 sec fade in.
that makes 10 sec.
No idea or this time will be different on slow computers.

I agree that a sound with the fade in would be better.
Another nice thing would be if i could get a starry moving screen during the transport instead of a completely black .
Maybe i can trigger the camera with the same Rgn_SpawnFromHere, to show a hidden plane textured with an animated starfield for 7 seconds and play a sound .
i did something like that before in turtle isle, when you look through the telescope, but the return to the regular view was with the esc button instead of a timer.
When this succeed i can leave out the fading.

Anyway, this is fairly good already.