Note: This forum is merely an archive. It is no longer possible to register or post. - StackOverflow
New Ace of Spades Forums: http://buildandshoot.com/

set_location_safe ?

Problem getting your server up? Ask in here.

set_location_safe ?

Postby Sandcrawler » Wed Mar 14, 2012 11:24 pm

I've been trying to figure out how to use the set_location_safe but regardless of what I try I cannot get it to work.

This is the bit of code that does work, and set the spawn location (but will spawn you inside blocks)
Code: Select all
def get_spawn_location(connection):
    if connection.team is connection.protocol.blue_team:
        x, y, z = ServerConnection.get_spawn_location(connection)
        r = random.randrange(1, 5)
        if r == 1:
            return (77, 365, 52)
        elif r == 2:
            return (93, 350, 46)
        elif r == 3:
            return (287, 369, 52)
        elif r == 4:
            return (295, 391, 52)
        elif r == 5:
            return (67, 146, 62)


Then I try to use set_spawn_safe formatted like this:
Code: Select all
    if connection.team is connection.protocol.green_team:
        x, y, z = ServerConnection.get_spawn_location(connection)
        r = random.randrange(1, 5)
        if r == 1:
            return ServerConnection.set_location_safe(connection, (399, 88, 52))
        elif r == 2:
            return ServerConnection.set_location_safe(connection, (407, 103, 48))
        elif r == 3:
            return ServerConnection.set_location_safe(connection, (399, 284, 52))
        elif r == 4:
            return ServerConnection.set_location_safe(connection, (309, 229, 52))
        elif r == 5:
            return ServerConnection.set_location_safe(connection, (102, 27, 62))


And it never spawns the players (just a floating view of the map, and I cannot close the game, change weapons, or change teams.)

So I tried the example given (here) using coords that I know are correct.
Code: Select all
def get_spawn_location(connection):
    if connection.team is connection.protocol.blue_team:
        x, y, z = ServerConnection.get_spawn_location(connection)
        return ServerConnection.set_location_safe(connection, (399, 88, 52))


    if connection.team is connection.protocol.green_team:
        x, y, z = ServerConnection.get_spawn_location(connection)
        return ServerConnection.set_location_safe(connection, (399, 88, 52))


and it gives the same result, just a floating view of the map, and nothing your can do.

I can't seem to figure out what I am doing wrong? I would like to use the random range method so I could have multiple spawn points, but with safe spawn so you don't end up in a wall or tree.

Edit:
change set_spawn_safe to set_location_safe (after trying it)
Last edited by Sandcrawler on Fri Mar 16, 2012 11:27 pm, edited 3 times in total.
Unreal Modders Haven Mapping Tutorials for Ace of Spades, as well as free map hosting.

Add your map to the downloads section on the website, and I will add it to the sandcrawler.net server.
Sandcrawler
Member
 
Posts: 21
Joined: Tue Jan 17, 2012 8:31 am

Re: set_spawn_safe ?

Postby PXYC » Thu Mar 15, 2012 12:03 am

I thought it was "set_location_safe".
Image

<+laserlamp> lil b is my fav
User avatar
PXYC
Local Mod
 
Posts: 1068
Joined: Wed Dec 14, 2011 2:52 am
Location: Near Philadelphia, PA

Re: set_location_safe ?

Postby Sandcrawler » Thu Mar 15, 2012 2:48 am

That could have been (the problem), but it still didn't work.

Code: Select all

def get_spawn_location(connection):
    if connection.team is connection.protocol.blue_team:
        x, y, z = ServerConnection.get_spawn_location(connection)
        r = random.randrange(1, 5)
        if r == 1:
            return ServerConnection.set_location_safe(connection, (77, 365, 52))
        elif r == 2:
            return ServerConnection.set_location_safe(connection, (93, 350, 46))
        elif r == 3:
            return ServerConnection.set_location_safe(connection, (287, 369, 52))
        elif r == 4:
            return ServerConnection.set_location_safe(connection, (295, 391, 52))
        elif r == 5:
            return ServerConnection.set_location_safe(connection, (67, 146, 62))

    if connection.team is connection.protocol.green_team:
        x, y, z = ServerConnection.get_spawn_location(connection)
        r = random.randrange(1, 5)
        if r == 1:
            return ServerConnection.set_location_safe(connection, (399, 88, 52))
        elif r == 2:
            return ServerConnection.set_location_safe(connection, (407, 103, 48))
        elif r == 3:
            return ServerConnection.set_location_safe(connection, (399, 284, 52))
        elif r == 4:
            return ServerConnection.set_location_safe(connection, (309, 229, 52))
        elif r == 5:
            return ServerConnection.set_location_safe(connection, (102, 27, 62))


The server log gives an error:
exceptions.AttributeError: 'NoneType' object has no attribute 'position'


Changed to using this map file instead, but still doesn't work (same errors)
Code: Select all
name = 'The Other Side'
version = '0.1'
author = 'Sandcrawler'
description = ('An Island map.')


# scripting
from pyspades.constants import *
from pyspades.server import ServerConnection

def get_spawn_location(connection):
    if connection.team is connection.protocol.blue_team:
        x, y, z = ServerConnection.get_spawn_location(connection)
        return ServerConnection.set_location_safe(connection, (399, 88, 52))
    if connection.team is connection.protocol.green_team:
        x, y, z = ServerConnection.get_spawn_location(connection)
        return ServerConnection.set_location_safe(connection, (399, 88, 52))
Unreal Modders Haven Mapping Tutorials for Ace of Spades, as well as free map hosting.

Add your map to the downloads section on the website, and I will add it to the sandcrawler.net server.
Sandcrawler
Member
 
Posts: 21
Joined: Tue Jan 17, 2012 8:31 am

Re: set_location_safe ?

Postby DoomSplitter » Thu Mar 29, 2012 5:53 pm

I'm having the exact same issue! Fix this please, I can't release my map until it's fixed!
User avatar
DoomSplitter
Member
 
Posts: 316
Joined: Fri Feb 10, 2012 1:21 am


Return to Server Help



Who is online

Users browsing this forum: No registered users and 6 guests