BLonwei Posted September 8, 2015 Posted September 8, 2015 Hello, I am in the process of starting up a DayZ server. However, after connecting and everything, the zombies do not appear to be spawning correctly or at all. Sometimes its 3/3 and never increases or there is always 0/0. Any help is greatly appreciated.
KariiiM Posted September 8, 2015 Posted September 8, 2015 setElementPosition or put a part of the code that's buggy, we have no idea about the problem
BLonwei Posted September 9, 2015 Author Posted September 9, 2015 I am new to Lua coding, however, below is the code that create the zombies. I hope this helps narrow the problem down. Thanks in advance. function createZomieForPlayer(x, y, z) x, y, z = getElementPosition(source) counter = 0 if getElementData(source, "lastzombiespawnposition") then local xL, yL, zL = getElementData(source, "lastzombiespawnposition")[3] or getElementData(source, "lastzombiespawnposition")[1] or false, getElementData(source, "lastzombiespawnposition")[2] or false, false if xL and getDistanceBetweenPoints3D(x, y, z, xL, yL, zL) < 50 then return end end if getElementData(source, "spawnedzombies") + 3 <= gameplayVariables.playerzombies then for i = 1, gameplayVariables.amountzombies do counter = counter + 1 local number1 = math.random(-50, 50) local number2 = math.random(-50, 50) if number1 < 18 and number1 > -18 then number1 = 20 end if number2 < 18 and number2 > -18 then number2 = -20 end randomZskin = math.random(1, table.getn(ZombiePedSkins)) zombie = call(getResourceFromName("slothbot"), "spawnBot", x + number1, y + number2, z, math.random(0, 360), ZombiePedSkins[randomZskin], 0, 0, getTeamFromName("Zombies")) setElementData(zombie, "zombie", true) setElementData(zombie, "blood", gameplayVariables.zombieblood) setElementData(zombie, "owner", source) call(getResourceFromName("slothbot"), "setBotGuard", zombie, x + number1, y + number2, z, false) end setElementData(source, "lastzombiespawnposition", { x, y, z }) setElementData(source, "spawnedzombies", getElementData(source, "spawnedzombies") + 3) end end addEvent("createZomieForPlayer", true) addEventHandler("createZomieForPlayer", getRootElement(), createZomieForPlayer)
BLonwei Posted September 9, 2015 Author Posted September 9, 2015 **Update**: So we were able to get the zombies to spawn. However, they only spawn when a new player connects and spawns only near the new player. Sorry, Im trying to understand this.
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