hi sorry i got carried away from doing larger objectives rather than focusing on the smaller ones, I will leave this for later as I have an issue where the game says:
For context: I am trying to send a message from the enemy.script where should the enemy die it spawns a item onto the players screen like a pickup item when a enemy is defeated.
The code from enemy.script is:
function drop_items(self)
if self.enemy_health <= 0 then
local enemy_pos = go.get_position()
if self.drop_rate > 0.3 then
msg.post("game:/scroll_spawner", "spawn scroll", {position = enemy_pos})
print("scroll dropped", enemy_pos)
else
print("no scroll dropped")
end
end
end
the code for scroll_spawner is
function on_message(self, message_id, message, sender)
if message_id == hash("spawn scroll") then
factory.create("#scroll_factory", message.position)
print("spawned scroll at: ", message.position)
end
end
i don’t know how to get rid of the error