Gamesnert Posted July 6, 2008 Posted July 6, 2008 I don't understand how the spawnmanager works... I'm trying to make a spawn code for 3 spawnpoints, all 3 specified in the map. call(getResourceFromName("spawnmanager"), "setSpawnpointTeam", getElementByID("sp1"), team1 ) call(getResourceFromName("spawnmanager"), "setSpawnpointTeam", getElementByID("sp2"), team1 ) call(getResourceFromName("spawnmanager"), "setSpawnpointTeam", getElementByID("sp3"), team1 ) The spawnpoints: <spawnpoint id="sp1" posX="283.339" posY="1972.488" posZ="17.64063" rot="270" skin="287"/> <spawnpoint id="sp2" posX="279.5817" posY="2013.327" posZ="17.64063" rot="270" skin="287"/> <spawnpoint id="sp3" posX="338.7903" posY="2012.863" posZ="20.63943" rot="270" skin="287"/> The reason I need this is that I'm making huge changes on my server, and with the previous version it didn't work either. Error messages say that the spawnpoints are invalid, they return a bool instead of an element. Why? Thanks in advance, Gamesnert Projects: Slothbot | Maximap
Gamesnert Posted July 7, 2008 Author Posted July 7, 2008 Ok obviously, there are a few things wrong in spawnmanager itself... I'll give you an example of the setSpawnpointTeam script: function setSpawnpointTeam ( spawnpoint, team ) if not isElement ( spawnpoint ) then outputDebugString("setSpawnpointTeam: Invalid variable specified as spawnpoint. Element expected, got "..type(spawnpoint)..".",0,255,128,0) return false end if getElementType ( spawnpoint ) ~= "spawnpoint" then outputDebugString("setSpawnpointTeam: Bad spawnpoint element specified",0,255,128,0) return false end if not isElement ( team ) then outputDebugString("setSpawnpointTeam: Invalid variable specified as team. Element expected, got "..type(team)..".",0,255,128,0) return false end if getElementType ( team ) ~= "team" then outputDebugString("setSpawnpointTeam: Bad team element specified",0,255,128,0) return false end skin = math.ceil(skin) setElementData ( spawnpoint, "team", skin ) return true end Obviously, if you look at the end you see a few errors. First thing: "skin = math.ceil(skin)". Skin isn't specified anywhere. What you need it for anyway in a teamscript? Then, the last error, but still a serious error: "setElementData ( spawnpoint, "team", skin )". Setting a team to a skin ID might not be the best idea? After changing this, (and checking with getSpawnpointTeam) I've got it working. Unfortunatly, I still had to change my code to make the player spawn at a team spawnpoint... Well, atleast this function is supposed to work now. And hopefully this is automatically fixed in DP3 and so on. Projects: Slothbot | Maximap
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now