The purpose of this is to make walls (NPC 1) that appear around the hero as he walks.
Here is the flow of it in layman's terms.
1) Hero steps on NPC 2.
2) NPC 2 runs the script.
3) The script checks to see NPC 0 is north, east, south, or west of the hero.
4) If so, the script creates NPC 1 on top of NPC 0 wherever NPC 0 occurs.
Code: Select all
plotscript, r15mazewalls, begin
if (NPC at spot (hero x (0) + 1, hero y (0)) == 0) then (
create npc (1, hero x (0) + 1, hero y (0))
) if (NPC at spot (hero x (0) - 1, hero y (0)) == 0) then (
create npc (1, hero x (0) - 1, hero y (0))
) if (NPC at spot (hero x (0), hero y (0) + 1) == 0) then (
create npc (1, hero x (0), hero y (0) + 1)
) if (NPC at spot (hero x (0), hero y (0) - 1) == 0) then (
create npc (1, hero x (0), hero y (0) - 1)
) end