Attached? As in with attached layers? Attached layers only capture movement created by the NPC being assigned speed, and will not move in response to the NPC teleporting.Mabel wrote:trying to work on a basic AI partner and it seems ok so far; throws fireballs when an NPC gets within a certain range(its a wonky setup with generators but it works) but i have one problem
if the Actor needs to teleport to Demo the generators attached to the AI Actor kinda...dissapear upon teleporting. Is there a way to keep the attached generator on the Actor when it teleports? or possibly a way to have the actor throw things without the need of generators?
Personally, I'd suggest not using generators, and instead using the new "spawnNPC" routine in LunaLua. You can either use the version written in Lua (which has a couple optional extra parameters "respawn" and "centered"), or if you're using a new enough version of LunaLua it has a spawnNPC routine built in. To throw something would be like...
Code: Select all
local newNPC = spawnNPC(npcid, x, y, section)
-- Don't allow the new NPC to respawn (only needed for the built-in version currently)
newNPC:mem(0xDC, FIELD_WORD, 0)
-- Set up initial speed
newNPC.speedX = 5
newNPC.speedY = 0