Modifying the spawn point

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: Modifying the spawn point

Postby Aloys » Thu Apr 22, 2010 2:02 pm

That sounds very much like the Journeys; so yes it sounds definitely possible.
User avatar
Aloys
 
Posts: 1968
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: Modifying the spawn point

Postby diafero » Fri Apr 23, 2010 7:32 am

The journeys however do the link-in point magic BEFORE the link, so the age you come from (Relto) checks which spawn point you need to go to. The fan age integration system of the Offline KI (and all the others we have) is not flexible enough to allow for that, it always uses either LinkInPointDefault or whatever I wrote into AvailableLinks.inf.
However, IIRC, Jalak actually makes you arrive in a different corner each time you link there, even though the spawn point is always the same. There must be some Python magic there. However I don't have the Python sources on this machine, so I can't tell.
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: Modifying the spawn point

Postby Branan » Fri Apr 23, 2010 9:23 am

If no one pops up with an answer in the next 4 hours, I'll dig through the jalak sources.
Image
Your friendly neighborhood shard admin
User avatar
Branan
Gehn Shard Admin
 
Posts: 694
Joined: Fri Nov 16, 2007 9:45 pm
Location: Portland, OR

Re: Modifying the spawn point

Postby D'Lanor » Fri Apr 23, 2010 9:53 am

I have been digging through the source and did a quick extraction. I *think* I got everything but keep in mind that this was not tested. It looks simple enough. An object list holds the warp points. The number for the current list item is stored in an sdl variable (byte). At each player link-in the warp point changes and is stored in the sdl. Of course you'll have to adapt the change mechanism if you want to trigger it with a clickable.

Code: Select all
from Plasma import *
from PlasmaTypes import *
import xRandom
warpPlayers = ptAttribSceneobjectList(1, 'obj: player warps')
sdlStartPt = 'warpPlayerStartPt'
listWarpPlayers = []
class warpMagic(ptResponder,):

    def __init__(self):
        ptResponder.__init__(self)
        self.version = 1



    def OnServerInitComplete(self):
        global byteStartPt
        LocalAvatar = PtGetLocalAvatar()
        ageSDL = PtGetAgeSDL()
        ageSDL.setFlags(sdlStartPt, 1, 1)
        ageSDL.sendToClients(sdlStartPt)
        ageSDL.setNotify(self.key, sdlStartPt, 0.0)
        byteStartPt = ageSDL[sdlStartPt][0]
        print 'warpMagic.OnServerInitComplete():  byteStartPt = ',
        print byteStartPt

        for warp in warpPlayers.value:
            pt = warp.getName()
            listWarpPlayers.append(pt)

        if (not len(PtGetPlayerList())):
            print 'warpMagic.OnServerInitComplete(): on link-in, am only player here.  Will reset player start point'
            newPoint = byteStartPt
            while (newPoint == byteStartPt):
                newPoint = xRandom.randint(0, (len(listWarpPlayers) - 1))

            byteStartPt = newPoint
        elif (len(PtGetPlayerList()) == 1):
            print 'warpMagic.OnServerInitComplete(): on link-in, 1 player already here.  Will warp 2 points away (across from previous point)'
            byteStartPt = (byteStartPt + 2)
            if (byteStartPt == 4):
                byteStartPt = 0
            elif (byteStartPt >= 5):
                byteStartPt = 1
        else:
            print 'warpMagic.OnServerInitComplete(): on link-in, 2 or more players already here.  Will warp to next point'
            if (byteStartPt == 0):
                byteStartPt = 2
            elif (byteStartPt == 1):
                byteStartPt = 0
            elif (byteStartPt == 2):
                byteStartPt = 3
            elif (byteStartPt == 3):
                byteStartPt = 1
        print 'warpMagic.OnServerInitComplete(): player start point = ',
        print byteStartPt
        warpPt = warpPlayers.value[byteStartPt].getKey()
        LocalAvatar.physics.warpObj(warpPt)
        ageSDL[sdlStartPt] = (byteStartPt,)



    def OnSDLNotify(self, VARname, SDLname, playerID, tag):
        global byteStartPt
        ageSDL = PtGetAgeSDL()
        PtDebugPrint(('warpMagic.OnSDLNotify():\t VARname: %s, SDLname: %s, tag: %s, value: %d' % (VARname,
         SDLname,
         tag,
         ageSDL[VARname][0])))
        if (VARname == sdlStartPt):
            byteStartPt = ageSDL[sdlStartPt][0]
            print 'warpMagic.OnSDLNotify(): byteStartPt = ',
            print byteStartPt




In your SDL file you put this:

Code: Select all
    VAR BYTE    warpPlayerStartPt[1]      DEFAULT=0 DISPLAYOPTION=red


Edit: And in case you are wondering how to create a pythonfilemod for an object list:
Code: Select all
<object name>:
    logic:
        actions:
          - type: pythonfile
            pythonfile:
                file: warpMagic
                parameters:
                  - type: sceneobjectlist
                    refs: ['scnobj:LinkInPointOne', 'scnobj:LinkInPointTwo', 'scnobj:LinkInPointThree', 'scnobj:LinkInPointFour']
"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


Return to Building

Who is online

Users browsing this forum: No registered users and 8 guests

cron