Xwad Posted October 7, 2015 Posted October 7, 2015 Hi! My question is that why is it not spawning the bots when i start the captureAreaG1 function? Debugscript 3: ERROR: Attempt to call global 'spawnbot' (a nil value) function captureAreaG1(commandName, player) local teamG = getTeamFromName("German") GA1 = createRadarArea ( -2731.27, -2592, 250, 380, 40, 40, 40, alpha ) markerG1 = createMarker ( -2614.70, -2383.35, 14, "cylinder", 3, 255, 255, 0, 170 ) botG1 = spawnBot ( -2607.88, -2390.86, 17.35, 90, 17, 0, 0, teamG, 29, "guarding", true ) botG2 = spawnBot ( -2597.64, -2473.02, 19.22, 90, 17, 0, 0, teamG, 31, "guarding", true ) botG3 = spawnBot ( -2632.41, -2350.68, 12.76, 90, 17, 0, 0, teamG, 31, "guarding", true ) botG4 = spawnBot ( -2632.10, -2408.71, 16.60, 90, 17, 0, 0, teamG, 33, "guarding", true ) setElementHealth ( botG1, 40 ) setElementHealth ( botG2, 40 ) setElementHealth ( botG3, 40 ) setElementHealth ( botG4, 40 ) if isElement(markerA1) then destroyElement ( markerA1 ) destroyElement ( UA1 ) end end
TAPL Posted October 7, 2015 Posted October 7, 2015 Isn't spawnBot from another resource? if so you'll need to use exports.
Xwad Posted October 7, 2015 Author Posted October 7, 2015 Yeah the spawn bot is in another resource. Well is good like that? call ( getResourceFromName ( "bot" ), botG4 = spawnBot ( -2632.10, -2408.71, 16.60,90, 17, 0, 0, teamG, 33, "guarding", true )
KariiiM Posted October 7, 2015 Posted October 7, 2015 No what you did is wrong, you can do something like that , there are 3 ways to exports also you've to declar your function in the meta. call ( getResourceFromName ( "bot" ), "botG4", -2632.10, -2408.71, 16.60,90, 17, 0, 0, teamG, 33, "guarding", true ) --or this way exports.bot:botG4(-2632.10, -2408.71, 16.60,90, 17, 0, 0, teamG, 33, "guarding", true)
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