I'm glad Hoikas and Deledrius could clarify what I was trying to explain
Yes, that last screenshot you provided looks much better as far as I can tell. Also, those colors make the tree MUCH more readable IMHO. (Maybe Korman could provide a similar coloring by default ? Okay, it looks like a xmas garland, but the increased readability might help people learn when they encounter screenshots like these on the wiki.)
Maroonroon wrote:Well, I tried to, but the Node Tree doesn't accept the connection between the "Python File" and the Logic's "Exclude Region"...
But if the door collision is enough, it's good to know.
Exclude regions are mostly a way to avoid glitches that might be caused by avatars or kickables being stuck between moving colliders. Think the big doors in Gahreesen's Well - you don't want an avatar squeezed between those, as it would look weird. When an exclude region becomes "solid", it will instantly teleport any avatar away. For thin doors, this is rarely a problem though.
The Python node SHOULD be able to accept an Exclude Region node as input, though. That looks like a bug.
Tsar Hoikas wrote:Korman automatically generates notify messages for Python scripts.
Hmm, are you sure ? NotifyMsgs inside responders are supposed to be a bit like AnimEventModifiers - they are placed by the artist at a very specific place in the responder's command/callback chain. Usually at the end or after a TimerCallbackMsg to signal the responder is not running anymore, but not always. When they are triggered, they send a notification to any Python script which holds a reference to the responder (despite the NotifyMsg itself not having a receiver...).
The Python script can receive those events like so (snippet from xStandardDoor):
- Show Spoiler
- Code: Select all
def OnNotify(self,state,id,events):
print "xStandardDoor: ID notified:", id
if id == -1: # Sirius: -1 comes from an unreferenced object (a responder or another Python script, maybe)
[...]
pass
# reenable clickables after door open/close anim runs
elif ( id==respOpenExt.id or id==respOpenInt.id ):
# Sirius: this is one of the responders notifying us at the end of its event chain
# (it could happen sooner though)
self.UpdateRespStack()
if boolCanManualClose.value and boolEnableOK:
actExterior.enable()
actInterior.enable()
elif ( id==respCloseExt.id or id==respCloseInt.id or id==respAutoClose.id):
[...]
pass
Deledrius wrote:Honestly, getting sounds to trigger at the right moment before/during/after an animation is not the easiest thing. Especially during. Timing is hard. Thankfully Korman makes iterating Age Development much faster.
I guess you already know this, but I wanted to mention the Timed Callback message is very useful in this case.
Deledrius wrote:You have the button(s) set up to toggle a variable that's kept stored and synced, your SDL variable that is a simple "is this door open?" sort. [...]
The second part is the xStandardDoor script. You hook that up, and tell it about the SDL variable. It will then get notified anytime that value changes. When it does, the script will "respond" by setting off the Responders you have hooked up to it!
(As for "why should we use the SDL var at all": it's because SDLs are always synchronized between clients, and saved even when no one is in the Age. Unlike animations, which are usually not synchronized with the rest of the server for performance reasons. As a bonus, it means multiple systems can be hooked to the same SDL variable without requiring
crazy wiring all over the place - all they need is to have a String Attribute parameter with the correct variable name. It's useful for things like multiple levers opening the same door; or a puzzle where a door opens only when all other doors are closed.)