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/

Setting Spawn Locations

For all your hosting needs.

Setting Spawn Locations

Postby j3502 » Sun Apr 22, 2012 2:18 pm

Hi, I'm trying to set spawn locations for the Titanic map, I want each team to spawn on opposite ends of the ship. At the moment the bases and flags are where I want them, but the players are still spawning normally... I can't see what I'm doing wrong...


Code: Select all
name = 'TITANIC'
version = '1.0'
author = 'Buffet_of_Lies, Serious_Sim, Nestoflo'
description = 'A Night To Remember'

# scripting

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

def get_entity_location(team, entity_id):
    if entity_id == BLUE_FLAG:
        return (246, 399, 42)
      
    if entity_id == BLUE_BASE:
        return (262, 401, 42)
      
    if entity_id == GREEN_FLAG:
        return (259, 110, 41)

    if entity_id == GREEN_BASE:
        return (250, 111, 41)

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, (263, 401, 42))   

    if connection.team is connection.protocol.green_team:
        x, y, z = ServerConnection.get_spawn_location(connection)
        return ServerConnection.set_location_safe(connection, (251, 111, 41))
j3502
Member
 
Posts: 2
Joined: Sun Apr 22, 2012 2:11 pm

Re: Setting Spawn Locations

Postby matpow2 » Sun Apr 29, 2012 12:00 am

In your get_spawn_location function, don't use set_location_safe. Just return the coordinates.
User avatar
matpow2
Site Admin
 
Posts: 47
Joined: Thu Dec 29, 2011 12:35 pm
Location: Denmark, Odense

Re: Setting Spawn Locations

Postby j3502 » Sun Apr 29, 2012 5:07 am

Now it just crashes... Did I do it wrong? I think I did it wrong...

Code: Select all
name = 'TITANIC'
version = '1.0'
author = 'Buffet_of_Lies, Serious_Sim, Nestoflo'
description = 'A Night To Remember'

# scripting

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

def get_entity_location(team, entity_id):
    if entity_id == BLUE_FLAG:
        return (246, 399, 42)
      
    if entity_id == BLUE_BASE:
        return (262, 401, 42)
      
    if entity_id == GREEN_FLAG:
        return (259, 110, 41)

    if entity_id == GREEN_BASE:
        return (250, 111, 41)

def get_spawn_location(connection):
 
    if connection.team is connection.protocol.blue_team:
        x, y, z = ServerConnection.get_spawn_location(connection)
        return (connection, (263, 401, 42))   

    if connection.team is connection.protocol.green_team:
        x, y, z = ServerConnection.get_spawn_location(connection)
        return (connection, (251, 111, 41))   


Code: Select all
C:\Users\Jeremy\Desktop\dist>run.exe
2012-04-29 14:12:22+1000 [-] Log opened.
2012-04-29 14:12:22+1000 [-] Loading map 'TITANIC'...
2012-04-29 14:12:22+1000 [-] Map loaded successfully.
2012-04-29 14:12:22+1000 [-] Starting factory <HTTPClientFactory: http://automat
ion.whatismyip.com/n09230945.asp>
2012-04-29 14:12:22+1000 [-] Started server...
2012-04-29 14:12:24+1000 [HTTPPageGetter,client] Server identifier is aos://3712
57308:32887
2012-04-29 14:12:24+1000 [HTTPPageGetter,client] Stopping factory <HTTPClientFac
tory: http://automation.whatismyip.com/n09230945.asp>
2012-04-29 14:12:25+1000 [HTTPPageGetter,client] Stopping factory <HTTPClientFac
tory: http://www.blacklist.spadille.net/subscribe.php?format=json>
2012-04-29 14:12:31+1000 [-] CodeFail (IP 192.168.1.2, ID 0) entered the game!
2012-04-29 14:12:31+1000 [-] Traceback (most recent call last):
2012-04-29 14:12:31+1000 [-]   File "pyspades\protocol.pyo", line 148, in update

2012-04-29 14:12:31+1000 [-]   File "run.py", line 852, in data_received
2012-04-29 14:12:31+1000 [-]   File "pyspades\protocol.pyo", line 113, in data_r
eceived
2012-04-29 14:12:31+1000 [-]   File "pyspades\server.pyo", line 258, in loader_r
eceived
2012-04-29 14:12:31+1000 [-]   File "pyspades\server.pyo", line 684, in spawn
2012-04-29 14:12:31+1000 [-]   File "run.py", line 185, in get_spawn_location
2012-04-29 14:12:31+1000 [-]   File "./maps\titanic.txt", line 28, in get_spawn_
location
2012-04-29 14:12:31+1000 [-]   File "pyspades\server.pyo", line 207, in __init__

2012-04-29 14:12:31+1000 [-] AttributeError: 'tuple' object has no attribute 'ad
dress'
2012-04-29 14:12:31+1000 [-] Unhandled error in Deferred:
2012-04-29 14:12:31+1000 [-] Unhandled Error
        Traceback (most recent call last):
          File "twisted\internet\base.pyo", line 1169, in run

          File "twisted\internet\base.pyo", line 1178, in mainLoop

          File "twisted\internet\base.pyo", line 800, in runUntilCurrent

          File "twisted\internet\task.pyo", line 215, in __call__

        --- <exception caught here> ---
          File "twisted\internet\defer.pyo", line 134, in maybeDeferred

          File "pyspades\server.pyo", line 1523, in update

          File "pyspades\server.pyo", line 1534, in update_network

        exceptions.AttributeError: 'NoneType' object has no attribute 'position'


j3502
Member
 
Posts: 2
Joined: Sun Apr 22, 2012 2:11 pm


Return to Server



Who is online

Users browsing this forum: No registered users and 1 guest

cron