Killcannon wrote:I'm still having issues with getting my one script differentiating the monsters from the players and applying different damage accordingly. Could I get a hand on this? I just need an example really of how to tell if an entity over a tile is a monster or the party, and deal damage to that tile.
connect floor-trigger to this script, and
Code: Select all
function detect(caller)
local test
for entity in caller.go.map:entitiesAt(caller.go.x, caller.go.y, caller.go.elevation) do
test = iff( entity.party, true,false) break
end
--==-------------[use test as a true/false for party detection]
hudPrint(iff(test, "Party", "Monster").." detected!")
--==---------------------------------------------------------
return test
end
Alternative:
Code: Select all
function _detect(caller)
local test
for entity in caller.go.map:entitiesAt(caller.go.x, caller.go.y, caller.go.elevation) do
test = iff( entity.party, true,false) break
end
return test
end
function trap(caller)
local damage = iff( _detect(caller), 30, 70)
damageTile(caller.go.level,caller.go.x,caller.go.y,caller.go.facing,caller.go.elevation, 64 ,"fire", damage)
--optional fireball
spawn("fireball_blast_large", caller.go.level,caller.go.x,caller.go.y,caller.go.facing,caller.go.elevation)
end