Post new topic    
Red Slime
Send private message
Script question 
 PostTue Jul 12, 2011 10:09 pm
Send private message Reply with quote
Simple enough,
Is there a way I can check hero wall for multiple tiles away?

Check hero wall (me,right,2)

that won't work will it?
Liquid Metal King Slime
Send private message
 
 PostTue Jul 12, 2011 11:16 pm
Send private message Reply with quote
You want to check for a wall without having th hero walk over to it?

Yes, that can be done, but it is pretty complicated.

you have to use the "read map block" "read pass block" command, and you have to check two tiles to be sure you found the wall. It would be possible to wrap all that complexity into a simple script like the "check hero wall" command you are envisioning.

EDIT: I am writing some scripts that do this
Super Slime
Send private message
 
 PostTue Jul 12, 2011 11:24 pm
Send private message Reply with quote
If you want to check for a wall, that's read pass block. If you want to check for the tile, that's read map block.
Mega Tact v1.1
Super Penguin Chef
Wizard Blocks
Liquid Metal King Slime
Send private message
 
 PostTue Jul 12, 2011 11:33 pm
Send private message Reply with quote
Code:

include, plotscr.hsd

script, check distant hero wall, who, direction, distance=0, begin
  exit returning(check wall relative to tile(hero x(who), hero y(who), direction, distance))
end

script, check distant NPC wall, who, direction, distance=0, begin
  exit returning(check wall relative to tile(npc x(who), npc y(who), direction, distance))
end

script, check wall relative to tile, x, y, direction, distance, begin
  switch(direction) do(
    case(north) do(y -= distance)
    case(south) do(y += distance)
    case(west) do(x -= distance)
    case(east) do(x += distance)
  )
  exit returning(check wall at spot(x, y, direction))
end

script, check wall at spot, x, y, direction, begin
  variable(tile1, tile2)
  tile1 := read pass block(x, y)
  switch(direction) do(
    case(north) do(
      tile2 := read pass block(x, y -- 1)
      if (tile1 ,and, northwall) then(exit returning(true))
      if (tile2 ,and, southwall) then(exit returning(true))
    )
    case(south) do(
      tile2 := read pass block(x, y + 1)
      if (tile1 ,and, southwall) then(exit returning(true))
      if (tile2 ,and, northwall) then(exit returning(true))
    )
    case(west) do(
      tile2 := read pass block(x -- 1, y)
      if (tile1 ,and, westwall) then(exit returning(true))
      if (tile2 ,and, eastwall) then(exit returning(true))
    )
    case(east) do(
      tile2 := read pass block(x + 1, y)
      if (tile1 ,and, eastwall) then(exit returning(true))
      if (tile2 ,and, westwall) then(exit returning(true))
    )
  )
  exit returning(false)
end


Let me know if this works for you.
Red Slime
Send private message
 
 PostTue Jul 12, 2011 11:35 pm
Send private message Reply with quote
Oh wow, I totally didn't see any map block commands when I was first looking at this.

Ultimately, I am trying to have a keypress function for jumping anywhere in a dungeon hence why I need to detect walls that are 2 tiles away.

Edit: That definitely works James, thanks
Display posts from previous: