Avatar warping, or: Is "FlipAge" still available?

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!

Avatar warping, or: Is "FlipAge" still available?

Postby tachzusamm » Wed Jul 06, 2011 4:33 am

I was thinking about warping the avatar from one location to another, because I would like to have a room "somewhere else", far away from the region where you enter it passing a door.
Like it was done in Gahreesen when entering the fortress.

I found these posts, where an example from Nadnerb was mentioned, called FlipAge":
viewtopic.php?f=7&t=1818&p=19121&hilit=flipage#p19121
and
viewtopic.php?f=59&t=1499&p=15325&hilit=flipage#p15325

but I can't find this "flipage" example.

Nadnerb, do you have this example still available somewhere, a link maybe, or a copy on your harddisk?

Or could somebody tell me how an avatar can be warped?
(I already managed to warp objects, but I don't get the idea of how to pass an "avatar id / name / object" to python - because the avatar is not available in Blender as an object to reference via AlcScript.)
User avatar
tachzusamm
 
Posts: 575
Joined: Thu May 29, 2008 2:03 am
Location: Germany

Re: Avatar warping, or: Is "FlipAge" still available?

Postby diafero » Wed Jul 06, 2011 6:47 am

Python code to warp the player up by 10 feet:
Code: Select all
        avatar = PtGetLocalAvatar()
        xUserKI.WarpObjectRelative(avatar, 0, 0, 10)

I hope this helps :)
I prefer e-mails to "diafero arcor de" (after adding the at and the dot) over PMs.

"Many people's horizon is a circle with a radius of zero. They call it their point of view."

Deep Island Shard | Offline KI
diafero
Deep Island Admin
 
Posts: 2972
Joined: Mon May 05, 2008 5:50 am
Location: Germany

Re: Avatar warping, or: Is "FlipAge" still available?

Postby Lontahv » Wed Jul 06, 2011 2:32 pm

diafero wrote:Python code to warp the player up by 10 feet:
Code: Select all
        avatar = PtGetLocalAvatar()
        xUserKI.WarpObjectRelative(avatar, 0, 0, 10)

I hope this helps :)


The problem I see with that code is that it is dependent on the UserKI code (which some of us do not have installed). Here is some stand-alone code:

Code: Select all
avatar = PtGetLocalAvatar()
avatar.physics.netForce(1)
avatar.warpToObj(theEmptyObjectYouWantToWarpTo) #Scene object passed here with pythonfilemod refs
Currently getting some ink on my hands over at the Guild Of Ink-Makers (PyPRP2).
User avatar
Lontahv
Councilor of Artistic Direction
 
Posts: 1331
Joined: Wed Oct 03, 2007 2:09 pm

Re: Avatar warping, or: Is "FlipAge" still available?

Postby tachzusamm » Wed Jul 06, 2011 4:12 pm

Thanks to both of you; it really helps. I get it now: "avatar = PtGetLocalAvatar()" just gives an object having a coordinate interface like any other "actor" object. Cool.

I think I will try both versions (with and w/o the UserKI) - just because I'm interested. :D


By the way, would generally a construct like:
Code: Select all
try:
    xUserKI.SomeUserKIFunction(object)
except:
    object.AlternateFunction()

work? I assume an exception is raised when trying to call a not available KI. If true, which exceptions are raised? (if this matters)
(Currently I don't have a client installed without a UserKI to try this out)
User avatar
tachzusamm
 
Posts: 575
Joined: Thu May 29, 2008 2:03 am
Location: Germany

Re: Avatar warping, or: Is "FlipAge" still available?

Postby Sirius » Thu Jul 07, 2011 5:53 am

You can also use it this way:
Code: Select all
# global variables
canUseKI = True
try:                 # try to import the xUserKI script
    import  xUserKI
except ImportError:  # if we can't, then we'll use our own function
    canUseKI = False

# blah blah blah...
# OnNotify, or something like this:
if canUseKI:
    xUserKI.SomeUserKIFunction(object)
else:
    self.SomeFunction(object)


This way it will try to import xUserKI to use its function, else it will use your own function. But the best way is to use your own script function, this way it will work even if the KI is not here/broken/whatever else.
User avatar
Sirius
 
Posts: 1508
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Avatar warping, or: Is "FlipAge" still available?

Postby diafero » Thu Jul 07, 2011 8:05 am

I just referred to the User KI code since I remembered tachzusamm used that as starting point for his python object warping, so he knew that function and I had to copy'n'paste less code ;-) . Of course you should copy those few lines of code to your file if you're really going to use it.
I prefer e-mails to "diafero arcor de" (after adding the at and the dot) over PMs.

"Many people's horizon is a circle with a radius of zero. They call it their point of view."

Deep Island Shard | Offline KI
diafero
Deep Island Admin
 
Posts: 2972
Joined: Mon May 05, 2008 5:50 am
Location: Germany


Return to Building

Who is online

Users browsing this forum: No registered users and 1 guest