Page 1 of 1

Help needed

Posted: Sun Apr 20, 2014 1:07 pm
by Monster_M3
How do I allocate spawn locations on voxed?

Re: Help needed

Posted: Sun Apr 20, 2014 2:09 pm
by Jdrew
Impossible. Voxed is just an editor you would need to do it via a script and map extensions.

Re: Help needed

Posted: Thu Apr 24, 2014 11:09 pm
by izzy
The easiest way is to use the CTF POINTS script along with its map extensions in your map's mapname.txt file.

It's also possible to script spawn locations directly in the mapname.txt file itself. Here's an example from the Firestorm map:
Code: Select all
name = 'Firestorm'
version = '1.1'
author = 'SLoW'
description = ('A remix of the classic Tribes 2 map Firestorm.')
extensions = { 'water_damage' : 25 }
protected = ['B5', 'G4']
fog = (232, 128, 5)

# scripting

from random import randrange, choice
from pyspades.constants import *
from pyspades.server import ServerConnection
from commands import say

def get_entity_location(team, entity_id):
    if entity_id == BLUE_FLAG:
        # puts only the blue flag in the blue base
        #z = team.protocol.map.get_z(109, 274)
        return (96, 274, 25)
    if entity_id == BLUE_BASE:
        # puts only the blue flag in the blue base
        #z = team.protocol.map.get_z(113, 315)
        return (83, 274, 25)
    if entity_id == GREEN_FLAG:
        # puts only the green flag in the green base
        #z = team.protocol.map.get_z(392, 306)
        return (413, 232, 29)
    if entity_id == GREEN_BASE:
        # puts only the blue flag in the blue base
        #z = team.protocol.map.get_z(408, 330)
        return (426, 232, 29)

def get_spawn_location(connection):
    if connection.team is connection.protocol.blue_team:
        x, y, z = ServerConnection.get_spawn_location(connection)
        positions = (79, 273)
        xdif = randrange(-30, 30)
        ydif = randrange(-30, 30)
        x, y = positions
        newx = max(0, min(511, x + xdif))
        newy = max(0, min(511, y + ydif))
        newz = connection.protocol.map.get_z(newx, newy)
        return (newx, newy, newz)

    if connection.team is connection.protocol.green_team:
        x, y, z = ServerConnection.get_spawn_location(connection)
        positions = (430, 232)
        xdif = randrange(-30, 30)
        ydif = randrange(-30, 30)
        x, y = positions
        newx = max(0, min(511, x + xdif))
        newy = max(0, min(511, y + ydif))
        newz = connection.protocol.map.get_z(newx, newy)
        return (newx, newy, newz)