I lost all my script snipplets, and had to find al of the information agin.
Thanks to Izzy, Lostmotel, and Kuma I have recovered most of it.
Feel free to post your script pieces here for other mappers to learn from.
This script lets you define a spawn volume
Code: Select all
Just define a the AREA=() for the rectange. The margin and padding can also be tweaked.AREA = (109, 157, 405, 353)
PAD = 23
WIDTH = 20
BLUE_RECT = (AREA[0] + PAD, AREA[1] + PAD, AREA[0] + PAD + WIDTH, AREA[3] - PAD)
GREEN_RECT = (AREA[2] - PAD - WIDTH, AREA[1] + PAD, AREA[2] - PAD, AREA[3] - PAD)
HALF_X = AREA[0] + (AREA[2] - AREA[0]) / 2
HALF_Y = AREA[1] + (AREA[3] - AREA[1]) / 2
GOAL = (8, 32, 40)
name = 'Heir Kraken'
version = '1.0'
author = 'jojoe'
area = AREA
ball = (HALF_X, HALF_Y, 40)
def get_spawn_location(connection):
if connection.team is connection.protocol.blue_team:
return connection.protocol.get_random_location(True, BLUE_RECT)
elif connection.team is connection.protocol.green_team:
return connection.protocol.get_random_location(True, GREEN_RECT)
from pyspades.constants import *
from pyspades.server import ServerConnection
def get_entity_location(team, entity_id):
if entity_id == GREEN_FLAG:
return (364, 385, 62)
if entity_id == BLUE_FLAG:
return (133, 385, 62)
if entity_id == GREEN_BASE:
return (372, 443, 60)
if entity_id == BLUE_BASE:
return (151, 443, 60)
At the bottom you can dfefine the green and blue flags and bases. Ignore the BALL, it is for the football game mode.
This snipplet lets you pick an exact spawn point , 1 for green and one for blue:
Code: Select all
This does the same as above but only needs X and y, the Z is automatic.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, (375, 255, 60))
if connection.team is connection.protocol.green_team:
x, y, z = ServerConnection.get_spawn_location(connection)
return ServerConnection.set_location_safe(connection, (108, 255, 60))
Code: Select all
name = 'McKrak Island'
version = '1.0'
author = 'JoJoe Stinky CC 2013'
description = 'McKrak Island'
# script
from pyspades.constants import *
from pyspades.server import ServerConnection
from random import choice
def get_entity_location(team, entity_id):
if entity_id == GREEN_FLAG:
return (217, 243, 36)
if entity_id == BLUE_FLAG:
return (293, 242, 36)
if entity_id == GREEN_BASE:
return (198, 239, 34)
if entity_id == BLUE_BASE:
return (306, 240, 32)
spawn_locations_blue = [
(336, 229),
(329, 233),
(329, 242),
(341, 220),
(341, 276),
(341, 270),
(341, 241),
(341, 250),
(341, 260),
(366, 277),
(336, 252)
]
spawn_locations_green = [
(176, 250),
(176, 260),
(164, 250),
(164, 240),
(164, 260),
(157, 255),
(157, 240),
(157, 260),
(165, 255),
(165, 216),
(176, 240)
]
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
Here is a "Pain" volume, It is like water damage:
Code: Select all
Hopefully we can build a library of script tricks for mappers :)extensions = {
#'water_damage' : 1,
'boundary_damage' : {
'left' : 64,
'top' : 64,
'right' : 448,
'bottom' : 448,
'damage' : 30
}
}