
I've tried other elevation and it's everytime when trooper hits the 0 elevation
edit: ok I dont have any idea why it works but it does. I've just changed coordinates of spawning trooper to absolute (instead of c.bla bla bla) and it works.
yeah it sounds like it was that problem.Prozail wrote:Think i found it.
enemySkeleton2 = spawn("skeleton_trooper_pair", c.level, c.x +1, c.y, c.facing+2 , c.elevation+2, "skeletonTroop")
facing is supposed to be 0-3 so either remove the (+2) or do it like this:
enemySkeleton2 = spawn("skeleton_trooper_pair", c.level, c.x +1, c.y, (c.facing+2)%4 , c.elevation, "skeletonTroop")
Code: Select all
function SpawnSkeleton(c) -- c = coordinates of script activator
c = c.go --shortcut insted of writing absolute values
enemySkeleton1 = spawn("skeleton_trooper", 2,c.x+1,c.y,2,0) --coordiantes are [2,2,19,2,0] (x=1;y=2)
spawnTrooperPair(c)
enemySkeleton1.monster:addConnector("onDie",self.go.id,"deadCheckerSkeleton")
end
-----------------------------------------------------------------------------------
-- If your pressure plate is for example in the same level where you want spawn the enemy and coordinates of pressure plate is 2,1,15,2,0 [level,x,y,face,elevation,"name"] (name is not required)
-- you can write: enemySkeleton1 = spawn("skeleton_trooper", c.level , c.x + 1 , c.y + 4 , 2 , c.elevation) result will be same
-- c.level => c.go.level > 2
-- c.x + 1 => c.go.x + 1 => 1 + 1 > 2
-- c.y + 4 => c.go.y + 4 => 15 + 4 > 19
-- 2 > 2 (facing value can reach 0 - 3 higher or lower values editor crashes
-- c.elevation => c.go.elevation > 0 (it's same as level, if you want spawn creature 1 elevation higher than pressure plate (or w/e activator) is just put '+ 1')
----------------------------------------------------------------------------------
Code: Select all
function spawnTrooperPair(c)
enemySkeleton2 = spawn("skeleton_trooper_pair", c.level , c.x + 2, c.y+2,0,0 ) -- set enemySkeleton properties for spawn
enemySkeleton2.monstergroup:spawnNow() -- let's spawn (someone said it has to be there actaully even Idk why, but w/e)
for e in self.go.map:entitiesAt(c.x+2,c.y+2) do -- for each entity at c.x+2 (c.go.x+2 = 2+2 > 4 and y is the same ; don't forget our hypothetical coords for pressure plate is now 2,1,15,2,0)
if e.monster then
e.monster:addConnector("onDie",self.go.id,"deadCheckerSkeleton")
end
-- adding a connector for every entity on this coords
-- "onDie" - name of event connector
-- "deadCheckerSkeleton" is name of method that launches after skeleton pair die
end
end
Code: Select all
counterSkeletonDead = 0
function deadCheckerSkeleton()
counterSkeletonDead = counterSkeletonDead + 1
if counterSkeletonDead == 3 then
hudPrint("Your foes are no more!!")
else
hudPrint("Podminka neni splnena!")
end
end