I need help to script a map.

Ask others for their services or be of service to others.
7 posts Page 1 of 1 First unread post
FangedBeast
League Participant
League Participant
Posts: 8
Joined: Fri Apr 12, 2013 6:41 pm


I've coded my intel and tent, finished my spawns also (kinda)

-but i've noticed that I always spawn the wrong way around (out towards the sea), how do i fix this?
-also, my spawn area isn't flat so sometimes and sometimes i spawn from quite a height and land on water; losing about 20-30hp, how do i make it so i spawn immediately on a flat surface and not a set height?
Code: Select all
# script
from pyspades.constants import *
import random

def get_entity_location(team, entity_id):
    if entity_id == BLUE_FLAG:
        x, y, z = 403, 256, 54
        return (x, y, z)
    if entity_id == GREEN_FLAG:
        x, y, z = 107, 256, 54
        return (x, y, z)
    if entity_id == BLUE_BASE:
        x, y, z = 409, 256, 54
        return (x, y, z)
    if entity_id == GREEN_BASE:
        x, y, z = 98, 256, 54
        return (x, y, z)

def get_spawn_location(connection):
    if connection.team is connection.protocol.blue_team:
        x = random.randrange(379,393)
        y = random.randrange(183,330)
        z1 = 54
        return (x, y, z1-1)
    if connection.team is connection.protocol.green_team:
        x = random.randrange(116,138)
        y = random.randrange(179,331)
        z1 = 54
        return (x, y, z1-1)
I've copied the code/structure from 'Trenches' by kiwi... but this is what i have so far

Thanks :)
Leif_The_Head
Deuced Up
Posts: 200
Joined: Tue Apr 09, 2013 12:52 pm


So the spawn locations are made in this piece of code:
Code: Select all
def get_spawn_location(connection):
    if connection.team is connection.protocol.blue_team:
        ...
        z1 = 54
        return (x, y, z1-1)
    if connection.team is connection.protocol.green_team:
        ...
        z1 = 54
        return (x, y, z1-1)
And I clearly see that the Z coordinate (obviously the height) is set to 54. I don't know how exactly that works, because I am not into that much, but try setting the value on 1 or 2. (because I think AoS does automatic unstuck on spawn)
I can tell you trenches is a map with higher spawn, so Kiwi made it on 54 to prevent teams from spawning in tunnels underground.
FangedBeast
League Participant
League Participant
Posts: 8
Joined: Fri Apr 12, 2013 6:41 pm


Leif_The_Head wrote:
So the spawn locations are made in this piece of code:
Code: Select all
def get_spawn_location(connection):
    if connection.team is connection.protocol.blue_team:
        ...
        z1 = 54
        return (x, y, z1-1)
    if connection.team is connection.protocol.green_team:
        ...
        z1 = 54
        return (x, y, z1-1)
And I clearly see that the Z coordinate (obviously the height) is set to 54. I don't know how exactly that works, because I am not into that much, but try setting the value on 1 or 2. (because I think AoS does automatic unstuck on spawn)
I can tell you trenches is a map with higher spawn, so Kiwi made it on 54 to prevent teams from spawning in tunnels underground.
that just made me spawn insanely high and makes me drop to my death every single time ;s

ty anways

also, i've changed z to 70 and now i have the problem of being automatically stuck in a block when i spawn.
any other suggestions/help?
cow
Deuced Up
Posts: 56
Joined: Mon Nov 05, 2012 7:40 pm


Stuck in a block? Knock the Z spawn up or down a notch until you are not stuck.
FangedBeast
League Participant
League Participant
Posts: 8
Joined: Fri Apr 12, 2013 6:41 pm


cow wrote:
Stuck in a block? Knock the Z spawn up or down a notch until you are not stuck.
yes, but my map is not flat + the spawn box is so that sometimes, you spawn at the middle part... nevermind :')

anyways, i seem to have fixed the spawning too high issue (thanks to cowie giving me Dany0's .txt to base it off), but now I still have my problem that I spawn the wrong way - not in towards the map and out towards to sea...

What I have now:
Code: Select all
# script
from pyspades.constants import *
import random

def get_entity_location(team, entity_id):
    if entity_id == BLUE_FLAG:
        x, y, z = 403, 256, 54
        return (x, y, z)
    if entity_id == GREEN_FLAG:
        x, y, z = 107, 256, 54
        return (x, y, z)
    if entity_id == BLUE_BASE:
        x, y, z = 409, 256, 54
        return (x, y, z)
    if entity_id == GREEN_BASE:
        x, y, z = 98, 256, 54
        return (x, y, z)

def get_spawn_location(connection):
    if connection.team is connection.protocol.blue_team:
        x1 = random.randrange(379,393)
        y1 = random.randrange(183,330)
        z1 = connection.protocol.map.get_z(x1, y1)
        return (x1, y1, z1)
    if connection.team is connection.protocol.green_team:
        x2 = random.randrange(116,138)
        y2 = random.randrange(179,331)
        z2 = connection.protocol.map.get_z(x2, y2)
        return (x2, y2, z2)
EDIT: Nevermind, i've fixed the spawning the wrong way by switching around the blue and green spawns etc respectively :) thanks for your help + on the IRC
Leif_The_Head
Deuced Up
Posts: 200
Joined: Tue Apr 09, 2013 12:52 pm


Nice you got that done ^^ It didn't come to my mind at that point that AoS Z coordinate works other way round :S
And that what you have now would have been my next suggestion.
andr3w
Deuced Up
Posts: 39
Joined: Tue Apr 23, 2013 3:47 pm


I used to have this issue until I realized you just need to swap the teams around. Green is east and blue is west on the map. As far as the z values it starts at 64 (I think) being the water and working its way to 0 at top of the sky.
7 posts Page 1 of 1 First unread post
Return to “Requests & Offers”

Who is online

Users browsing this forum: No registered users and 5 guests