Jump to content
Official BF Editor Forums

Auto Spawnpoint Question


rhysm_08
 Share

Recommended Posts

I'm wondering if it's possible, with HUD or with the map somehow, to automatically make it select the control point so all you have to do is press enter or the deploy button to go in?

It's needed for this spawn menu concept:

v2-1.jpg

As there is only one controlpoint (for each team) used in this mod, the map isn't useful and we decided a deploy button or just pressing enter could be simple. Problem is, i need to be able to select the spawnpoint first, is there away to do this without requiring the map HUD?

Link to comment
Share on other sites

I think the SetSpawnPoint is a true/false setting as you can see in the HudElementsSpawn.con.

hudBuilder.createButtonNode 		IngameHud MinimizeSpawnButton 770 31 16 16
hudBuilder.setButtonNodeTexture 	2 Ingame/GeneralIcons/empty.tga
hudBuilder.setButtonNodeTexture 	1 Ingame/GeneralIcons/empty.tga
hudBuilder.setButtonNodeConCmd		"hudItems.setBool SetSpawnPoint 0" 3

Since you only got one cp for each team you can do it through python.

import host
import bf2

mapDict = {
"kubra_dam":[1,2],
"iron_gator":[2,1]
}

def init():
host.registerHandler("RemoteCommand", onRemoteCommand)

def onRemoteCommand(playerId, cmd):

#Singleplayer fix
if playerId == -1:
	playerId = 255

player = bf2.playerManager.getPlayerByIndex(playerId)

if cmd == "spawn":
	mapName = host.sgl_getMapName().lower()

	spawnGroupInfo = mapDict[mapName]

	team = player.getTeam()

	groupId = spawnGroupInfo[team-1]

	player.setSpawnGroup(groupId)

Because I don't really have a clue on how the spawngroup id's are managed, I used a dictionary based on mapnames to handle it. The first number in the list is the spawngroup id for team 1 and the second is the id for team 2.

Edited by hjid27
Link to comment
Share on other sites

Because I don't really have a clue on how the spawngroup id's are managed, I used a dictionary based on mapnames to handle it. The first number in the list is the spawngroup id for team 1 and the second is the id for team 2.

Just use the controlPointID of the spawnPoint you want to spawn at (setSpawnGroup(controlPointID)).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...