I want to make a level, where humans are spawned VIA referee.
I want have the humans do nothing, until I command them.
To spice things up, the humans, are shamans, warlocks, and witches with their alliance changed, and they all have canCast and findFriends in their APIs.
Is it possible to make them sit around doing nothing, until I command them?
Yes, I know how to command shamans, witches, and warlocks
I added shaman, witch, and warlock into programming.commands, and I made a wave called friendlies, that starts 30 seconds in.
It spawns human warlocks, witches, and shamans.
Can I make them sit around and do nothing until commanded?
I saw this in summit’s gate, and I saw the cause.
for human in @world.thangs when human.team is 'humans' and human isnt @hero and human.health > 0
human.commander = @hero
I deleted the human.pos.x part, because I want all humans to be idle until commanded.
Level is called Burning Sands.
Editor here.
{
setUpLevel: ->
@patrolOrder = [
[@rectangles.left, @points.NW]
[@rectangles.bottom, @points.SW]
[@rectangles.right, @points.SE]
[@rectangles.top, @points.NE]
]
controlOgres: (ogres) ->
for ogre in ogres when ogre.action is 'idle' or ogre.targetPos
if ogre.canSee @hero
ogre.attack @hero
else if ogre.action is 'idle' or ogre.distanceSquared(ogre.targetPos) < 25
# Cycle around counter-clockwise.
matched = false
for [rect, edgePoint], i in @patrolOrder
if rect.containsPoint ogre.pos
matched = true
break
if matched
[nextRect, nextEdgePoint] = @patrolOrder[(i + 1) % @patrolOrder.length]
targetPos = nextEdgePoint.copy().add(x: @world.rand.randf2(-8, 8), y: @world.rand.randf2(-8, 8))
ogre.move targetPos
else
ogre.move @hero.pos
for ogre in ogres when (ogre.action is 'attack' and ogre.target is @hero) or ogre.action is 'move'
# Attack the nearest enemy we can see (might be different than the hero we can't see)
enemy = ogre.getNearestEnemy()
if enemy
ogre.attack enemy
controlHumans: (humans) ->
for human in @world.thangs when human.team is 'humans' and human.pos.x < 24 and human isnt @hero and human.health > 0
human.commander = @hero
setUpLevel: ->
@patrolOrder = [
[@rectangles.left, @points.NW]
[@rectangles.bottom, @points.SW]
[@rectangles.right, @points.SE]
[@rectangles.top, @points.NE]
]
controlOgres: (ogres) ->
for ogre in ogres when ogre.action is 'idle' or ogre.targetPos
if ogre.canSee @hero
ogre.attack @hero
else if ogre.action is 'idle' or ogre.distanceSquared(ogre.targetPos) < 25
# Cycle around counter-clockwise.
matched = false
for [rect, edgePoint], i in @patrolOrder
if rect.containsPoint ogre.pos
matched = true
break
if matched
[nextRect, nextEdgePoint] = @patrolOrder[(i + 1) % @patrolOrder.length]
targetPos = nextEdgePoint.copy().add(x: @world.rand.randf2(-8, 8), y: @world.rand.randf2(-8, 8))
ogre.move targetPos
else
ogre.move @hero.pos
for ogre in ogres when (ogre.action is 'attack' and ogre.target is @hero) or ogre.action is 'move'
# Attack the nearest enemy we can see (might be different than the hero we can't see)
enemy = ogre.getNearestEnemy()
if enemy
ogre.attack enemy
onFirstFrame: ->
if @hero.buildXY
@hero.oBuildXY = @hero.buildXY
@hero.buildXY = (toBuild, x, y) =>
if toBuild in ["fence", "fire-trap", "decoy", "arrow-tower"]
@hero.say(@icontext.wrong)
else
@hero.oBuildXY(toBuild, x, y)
}
onFirstFrame: ->
if @hero.buildXY
@hero.oBuildXY = @hero.buildXY
@hero.buildXY = (toBuild, x, y) =>
if toBuild in ["fence", "fire-trap", "decoy", "arrow-tower"]
@hero.say(@icontext.wrong)
else
@hero.oBuildXY(toBuild, x, y)