Page 1 of 1

[HELP] Spawnfixing

Posted: Tue Sep 10, 2013 6:10 pm
by cuulli
Hey guys,

I tried to create a 2vs2 map for me and my friends. It worked.
Download: http://www.mediafire.com/download/6be2v ... Island.vxl
(It isnt the best I know, its my first map.)
I used the Blockman 2D VXL Meta Data Editor to "fix" tent, intel and players spawn.
My textdocument shows this:
Spoiler:
## GENERATED WITH BLOCKMAN2D v0.2.5.0
name = 'LoneIsland'
version = '1.0'
author = 'cuulli'
description = 'Small island map for 1vs1 - 3vs3.'
extensions = { 'water_damage' : 39 }

Im Spoiler ist mein Textdokument dafür. Irgendwelch idden um das zu fixen?

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

def get_entity_location(team, entity_id):
if entity_id == BLUE_FLAG:
return (169, 240, 3)
if entity_id == GREEN_FLAG:
return (360, 249, 3)
if entity_id == BLUE_BASE:
return (178, 267, 2)
if entity_id == GREEN_BASE:
return (354, 226, 3)

SPAWN_RECTANGLES = [[(329,357,208,285)], [(172,205,218,293)]]

def get_spawn_location(connection):
if SPAWN_RECTANGLES is not None:
if connection.team is connection.protocol.green_team:
x1, x2, y1, y2 = random.choice(SPAWN_RECTANGLES[0])
elif connection.team is connection.protocol.blue_team:
x1, x2, y1, y2 = random.choice(SPAWN_RECTANGLES[1])
x, y = random.randint(x1,x2), random.randint(y1,y2)
z = connection.protocol.map.get_z(x, y)
if x is not None and y is not None and z is not None:
return ServerConnection.set_location_safe(connection, (x, y, z))
else:
return ServerConnection.get_spawn_location(connection)
It fixed the intelspawn adn thought that I fixed the players spawn too, but Blue and Green still spawn in the water (in the middle of nowhere) although I said with the "cursor" at the editor that they should spawn on the land.
Can you help me fixing this?

Thanks for reading.

Re: [HELP] Spawnfixing

Posted: Fri Sep 13, 2013 2:14 pm
by Lostmotel
not perfect, but this should work
Spoiler:
name = 'LoneIsland'
version = '1.0'
author = 'cuulli'
description = 'Small island map for 1vs1 - 3vs3.'
extensions = { 'water_damage' : 39 }

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

def get_entity_location(team, entity_id):
if entity_id == BLUE_FLAG:
z = team.protocol.map.get_z(168, 243)
return (168, 243, z)
if entity_id == BLUE_BASE:
z = team.protocol.map.get_z(186, 280)
return (186, 280, z)
if entity_id == GREEN_BASE:
z = team.protocol.map.get_z(358, 281)
return (358, 281, z)
if entity_id == GREEN_FLAG:
z = team.protocol.map.get_z(344, 214)
return (344, 214, z)

spawn_locations_blue = [
(168, 243),
(175, 216),
(162, 222),
(170, 262),
(169, 289),
(183, 297),
(186, 280)


]

spawn_locations_green = [

(372, 244),
(370, 268),
(358, 281),
(350, 266),
(351, 243),
(365, 226),
(344, 214),
(356, 201)

]

def get_spawn_location(connection):
if connection.team is connection.protocol.blue_team:
x, y = choice(spawn_locations_blue)
z = connection.protocol.map.get_z(x, y)
return x, y, z
if connection.team is connection.protocol.green_team:
x, y = choice(spawn_locations_green)
z = connection.protocol.map.get_z(x, y)
return x, y, z

Re: [HELP] Spawnfixing

Posted: Fri Sep 13, 2013 5:18 pm
by cuulli
Thank you very much. It worked!:)