Well, I think I'm the only person making a fuss over the boomerang being more difficult than the shovel. I haven't thought about it super carefully, but unless the 'chase' functionality has changed a great deal since I last used the OHR, I don't think it would be a good idea. For one thing, NPCs try to use tiles to walk, which would look incredibly awful for a boomerang. Also turning off wall checks is good for the 'return' journey, but not so good for the 'outward' journey. Specialized wall-checks via vehicle behavior could work for 'outward', but would presuppose that A/B walls aren't already arranged to allow for something else on any map where the boomerang is allowed. Still doesn't take care of the boomerang passing through certain NPCs (invisible step-ons, collectible items, probably more that I'm not thinking of) but not others (enemies, bookshelves, maybe it doesn't pass through 'good' NPCs either).
On the other hand, disallowing player movement makes the boomerang much simpler, but also a bit clunky from a gameplay perspective. I guess it could be funny if the main character is a plain old Goriya henchman from the original LoZ and has to fight a bunch of Links running around.
I am Srime
OH MY GOSH!
You're right, I forgot the last part of the script.
I'm going to go back and edit the original post to reflect the addition instead of posting it here. However, removing walls won't really be part of what I was making with the shovel. Perhaps some sort of axe to cut trees or hammer to break rocks would be better for destroying walls.
You're right, I forgot the last part of the script.
I'm going to go back and edit the original post to reflect the addition instead of posting it here. However, removing walls won't really be part of what I was making with the shovel. Perhaps some sort of axe to cut trees or hammer to break rocks would be better for destroying walls.
After rereading your post I see that I may have made the wrong script for you. So, here's a variant of the script from before that I've turn into a hammer script for breaking rocks.
ok so, you start it off with the include,plotscr.hsd command. Then we're going to do some variables. Remeber how I mentioned that was a different way to make variables well here's that way.
then we start the script up with a plotscript,stopHamerTime,begin. Next though we get a bit messy. We need to read which way the player is facing. So first we store where he's standing into variables. This is so was can alter that in a second. We store this into the variables we made, like so.
Now we need to read the direction of the player with the hero direction (me) command. Then, using if commands, we'll change the herX variable or the herY variable to relate to the tile in front of the hero. If he's facing north we need the tile that's 1 Y less then tile the hero is standing on, so we subtract 1 from herY and now herX,herY points tot he right tile. We do this for each direction like so.
then we read the maptile like we did with the shovel command. We look for tile 3 here instead of 1.
then we end the first script and start the next one.
We suspend the player and animate the character in much the same way we did witht he shovel. Only we use different walkabout picture numbers.
here, instead of the large random textbox part we just play a sound and change the tile and wall block. write pass block (x,y,value) is how we change the wall. We also need to remember to resume player.
And that's it, now we have a script that can detect and destroy the tile in front of the player.
ok so, you start it off with the include,plotscr.hsd command. Then we're going to do some variables. Remeber how I mentioned that was a different way to make variables well here's that way.
Code:
global variable,begin
1,herX
2,herY
end
1,herX
2,herY
end
then we start the script up with a plotscript,stopHamerTime,begin. Next though we get a bit messy. We need to read which way the player is facing. So first we store where he's standing into variables. This is so was can alter that in a second. We store this into the variables we made, like so.
Code:
herX:=herox(me)
herY:=heroy(me)
herY:=heroy(me)
Now we need to read the direction of the player with the hero direction (me) command. Then, using if commands, we'll change the herX variable or the herY variable to relate to the tile in front of the hero. If he's facing north we need the tile that's 1 Y less then tile the hero is standing on, so we subtract 1 from herY and now herX,herY points tot he right tile. We do this for each direction like so.
Code:
if(hero direction (me)==north) then (herY--1)
if(hero direction (me)==south) then (herY+1)
if(hero direction (me)==west) then (herX--1)
if(hero direction (me)==east) then (herX+1)
if(hero direction (me)==south) then (herY+1)
if(hero direction (me)==west) then (herX--1)
if(hero direction (me)==east) then (herX+1)
then we read the maptile like we did with the shovel command. We look for tile 3 here instead of 1.
Code:
If ( read map block (herX,herY)==3) then (smashysmashy) else ( playsound(1) )
then we end the first script and start the next one.
Code:
end
script,smashysmashy,begin
script,smashysmashy,begin
We suspend the player and animate the character in much the same way we did witht he shovel. Only we use different walkabout picture numbers.
Code:
suspend player
set hero picture (me,4)
wait(8)
set hero picture (me,5)
wait(8)
reset hero picture (me)
set hero picture (me,4)
wait(8)
set hero picture (me,5)
wait(8)
reset hero picture (me)
here, instead of the large random textbox part we just play a sound and change the tile and wall block. write pass block (x,y,value) is how we change the wall. We also need to remember to resume player.
Code:
playsound(2)
write pass block (herox(me),heroy(me),0)
write map block (herox(me),heroy(me),2)
resume player
write pass block (herox(me),heroy(me),0)
write map block (herox(me),heroy(me),2)
resume player
And that's it, now we have a script that can detect and destroy the tile in front of the player.
Code:
end
As with the shovel script, anyone can do whatever they want with this script.
Knock yourself out.
Knock yourself out.
Code:
include, plotscr.hsd
include, scancode.hsi
global variable,begin
1,herX
2,herY
end
plotscript,stopHamerTime,begin
herX:=herox(me)
herY:=heroy(me)
if(hero direction (me)==north) then (herY:=herY--1)
if(hero direction (me)==south) then (herY:=herY+1)
if(hero direction (me)==west) then (herX:=herX--1)
if(hero direction (me)==east) then herX:=(herX+1)
If ( read map block (herX,herY)==3) then (smashysmashy) else ( playsound(1) )
end
script,smashysmashy,begin
suspend player
set hero picture (me,4)
wait(8)
set hero picture (me,5)
wait(8)
reset hero picture (me)
playsound(2)
write pass block (herX,herY,0)
write map block (herX,herY,2)
resume player
end
include, scancode.hsi
global variable,begin
1,herX
2,herY
end
plotscript,stopHamerTime,begin
herX:=herox(me)
herY:=heroy(me)
if(hero direction (me)==north) then (herY:=herY--1)
if(hero direction (me)==south) then (herY:=herY+1)
if(hero direction (me)==west) then (herX:=herX--1)
if(hero direction (me)==east) then herX:=(herX+1)
If ( read map block (herX,herY)==3) then (smashysmashy) else ( playsound(1) )
end
script,smashysmashy,begin
suspend player
set hero picture (me,4)
wait(8)
set hero picture (me,5)
wait(8)
reset hero picture (me)
playsound(2)
write pass block (herX,herY,0)
write map block (herX,herY,2)
resume player
end
Here's a boomerang script. No explanation here.
However, in order for this one to work you need to make npc 25 on all your maps into the boomerang. It has to have a quick movement speed and set to pace. Also, as always, do whatever you want with the script.
Knock yourself out!
However, in order for this one to work you need to make npc 25 on all your maps into the boomerang. It has to have a quick movement speed and set to pace. Also, as always, do whatever you want with the script.
Knock yourself out!
Code:
include, plotscr.hsd
include, scancode.hsi
global variable,begin
1,herX
2,herY
end
plotscript,BANGARANG,begin
suspend player
suspend obstruction
suspend NPC walls
#-^-startup--
#-v-animated character--
set hero picture (me,6)
wait(4)
set hero picture (me,7)
wait(4)
reset hero picture (me)
#-^-animated character--
#-V-place boomerang--
herX:=herox(me)
herY:=heroy(me)
if(hero direction (me)==north) then (herY:=herY--1)
if(hero direction (me)==south) then (herY:=herY+1)
if(hero direction (me)==west) then (herX:=herX--1)
if(hero direction (me)==east) then (herX:=herX+1)
create NPC (25,herX,herY,hero direction (me))
playsound(3)
#-^-place boomerang--
#--v--collision-loop--
variable (flying)
flying:=0
while(flying==0) do ,begin
if (hero direction (me)==north,and,NPC Y (25)==herY--3)then(set NPC direction (25,south))
if (hero direction (me)==south,and,NPC Y (25)==herY+3)then(set NPC direction (25,north))
if (hero direction (me)==west,and,NPC X (25)==herX--5)then(set NPC direction (25,east))
if (hero direction (me)==east,and,NPC X (25)==herX+5)then(set NPC direction (25,west))
if (NPC at spot (NPC X (25), NPC Y (25))>>0) then (flying:=1,playsound(4), use NPC (NPC at spot (NPC X (25), NPC Y (25))))
if ( NPCX(25)==herox(me),and,NPCY(25)==heroy(me) )then(flying:=1)
wait(1)
end
#--^--collision-loop--
#-v-wrap-up--
destroynpc(25)
resume obstruction
resume NPC walls
resume player
end
include, scancode.hsi
global variable,begin
1,herX
2,herY
end
plotscript,BANGARANG,begin
suspend player
suspend obstruction
suspend NPC walls
#-^-startup--
#-v-animated character--
set hero picture (me,6)
wait(4)
set hero picture (me,7)
wait(4)
reset hero picture (me)
#-^-animated character--
#-V-place boomerang--
herX:=herox(me)
herY:=heroy(me)
if(hero direction (me)==north) then (herY:=herY--1)
if(hero direction (me)==south) then (herY:=herY+1)
if(hero direction (me)==west) then (herX:=herX--1)
if(hero direction (me)==east) then (herX:=herX+1)
create NPC (25,herX,herY,hero direction (me))
playsound(3)
#-^-place boomerang--
#--v--collision-loop--
variable (flying)
flying:=0
while(flying==0) do ,begin
if (hero direction (me)==north,and,NPC Y (25)==herY--3)then(set NPC direction (25,south))
if (hero direction (me)==south,and,NPC Y (25)==herY+3)then(set NPC direction (25,north))
if (hero direction (me)==west,and,NPC X (25)==herX--5)then(set NPC direction (25,east))
if (hero direction (me)==east,and,NPC X (25)==herX+5)then(set NPC direction (25,west))
if (NPC at spot (NPC X (25), NPC Y (25))>>0) then (flying:=1,playsound(4), use NPC (NPC at spot (NPC X (25), NPC Y (25))))
if ( NPCX(25)==herox(me),and,NPCY(25)==heroy(me) )then(flying:=1)
wait(1)
end
#--^--collision-loop--
#-v-wrap-up--
destroynpc(25)
resume obstruction
resume NPC walls
resume player
end
Some mistakes in the hammer script:
I'm pretty certain that
should be
and similarly for the other four directions.
Also, if I understand the script correctly,
should be
EDIT: Honestly I'm not trying to be a jerk, but if Froginator or anyone else wants a really workable boomerang script, they're going to need a lot more than Spoonweaver's script. Even if we grant player suspension, and allow the boomerang to indiscriminately pass through walls, just a surface-level read brings up the following problems to me:
-If we suspend all NPC walls, other NPCs can move through walls while the boomerang is flying
-The boomerang will activate step-on NPCs
-As written, the boomerang will find itself at its own coordinates, try to use itself, and then disappear right away (potentially easy fix, but I can't remember how multiple NPCs on a tile need to be handled)
-Boomerang return will fail for wrap-around maps (potentially easy fix, I think)
-The player can throw multiple boomerangs (easy fix)
I am Srime
I'm pretty certain that
Code:
if(hero direction (me)==north) then (herY--1)
should be
Code:
if(hero direction (me)==north) then (herY:=herY--1)
and similarly for the other four directions.
Also, if I understand the script correctly,
Code:
write pass block (herox(me),heroy(me),0)
write map block (herox(me),heroy(me),2)
write map block (herox(me),heroy(me),2)
should be
Code:
write pass block (herX,herY,0)
write map block (herX,herY,2)
write map block (herX,herY,2)
EDIT: Honestly I'm not trying to be a jerk, but if Froginator or anyone else wants a really workable boomerang script, they're going to need a lot more than Spoonweaver's script. Even if we grant player suspension, and allow the boomerang to indiscriminately pass through walls, just a surface-level read brings up the following problems to me:
-If we suspend all NPC walls, other NPCs can move through walls while the boomerang is flying
-The boomerang will activate step-on NPCs
-As written, the boomerang will find itself at its own coordinates, try to use itself, and then disappear right away (potentially easy fix, but I can't remember how multiple NPCs on a tile need to be handled)
-Boomerang return will fail for wrap-around maps (potentially easy fix, I think)
-The player can throw multiple boomerangs (easy fix)
I am Srime
@MSW: Hello and thank you for proofreading the scripts. I've gone through and fixed them for the most part. However, I'll admit I never tested these things out myself.
as for the switch/case thing. The way I understand it there are 2 ways to do them. the way I have them written or a do( ) included after. I believe the do() is mostly for when you want more than a line of code to happen.
as for the boomerang script, yes it's clearly over simplified. However, this should be enough for the simple use frogman has asked for. A more complex script that would be used for a Zelda like and track the player during pixel based movement would take a lot of extra steps. Also, this step doesn't work well with moving targets. But, since it's designed to be used from an item I assume that goes without saying. (Having to go to a menu when you want to shoot the guy in front of you is sure to cause you to miss.) However, even with the extra steps it wouldn't be as hard as you'd think to set a script up to have a boomerang act just like the one in zelda.
as for the switch/case thing. The way I understand it there are 2 ways to do them. the way I have them written or a do( ) included after. I believe the do() is mostly for when you want more than a line of code to happen.
as for the boomerang script, yes it's clearly over simplified. However, this should be enough for the simple use frogman has asked for. A more complex script that would be used for a Zelda like and track the player during pixel based movement would take a lot of extra steps. Also, this step doesn't work well with moving targets. But, since it's designed to be used from an item I assume that goes without saying. (Having to go to a menu when you want to shoot the guy in front of you is sure to cause you to miss.) However, even with the extra steps it wouldn't be as hard as you'd think to set a script up to have a boomerang act just like the one in zelda.
@Spoonweaver:
Yeah please don't take me the wrong way, you've definitely done more actual work to help than I have. I feel like I'm just sitting around emphasizing the negatives here, but it's because I honestly believe boomerang-like things are a lot harder to get right. Not at all impossible, but the wall problem still sounds like it needs some serious scripting to me (unless Hspeak can now suspend npc walls for one npc at a time). It's enough to make me question whether or not an NPC is the best method for a boomerang, because I can't think of a fix for this (besides suspending all other NPCs, at which point the boomerang becomes a TIME FREEZING boomerang!) that won't come down to pixel-by-pixel control anyways.
I didn't know that about case/switch. Do you know if there's similar behavior for if/else? Like skipping the "then()" if you're only going to run one line?
I am Srime
Yeah please don't take me the wrong way, you've definitely done more actual work to help than I have. I feel like I'm just sitting around emphasizing the negatives here, but it's because I honestly believe boomerang-like things are a lot harder to get right. Not at all impossible, but the wall problem still sounds like it needs some serious scripting to me (unless Hspeak can now suspend npc walls for one npc at a time). It's enough to make me question whether or not an NPC is the best method for a boomerang, because I can't think of a fix for this (besides suspending all other NPCs, at which point the boomerang becomes a TIME FREEZING boomerang!) that won't come down to pixel-by-pixel control anyways.
I didn't know that about case/switch. Do you know if there's similar behavior for if/else? Like skipping the "then()" if you're only going to run one line?
I am Srime
to the if/then question: maybe?
I get all my info from the plotscript dictionary. A helpful tool to anyone trying to learn scripting or just scripting in general.
http://www.hamsterrepublic.com/ohrrpgce/docs/plotdict.xml
As for the Boomerang and walls. Well, like I said it would involve a more complex script. In fact it would be a completely different take on the script. Basically, what you'd do is set up a loop that moved the npc pixel by pixel. Which likely sounds harder than it is. And yea, my sample boomerang won't really work if other npc's on the map are also moving. I can't stress that enough. How I handle walls with things like this is to simply place the npc instead of move it coupled with reading the tile of the pixel it's going to go into next. By doing this one can not only go through walls without disturbing the other npcs.
I get all my info from the plotscript dictionary. A helpful tool to anyone trying to learn scripting or just scripting in general.
http://www.hamsterrepublic.com/ohrrpgce/docs/plotdict.xml
As for the Boomerang and walls. Well, like I said it would involve a more complex script. In fact it would be a completely different take on the script. Basically, what you'd do is set up a loop that moved the npc pixel by pixel. Which likely sounds harder than it is. And yea, my sample boomerang won't really work if other npc's on the map are also moving. I can't stress that enough. How I handle walls with things like this is to simply place the npc instead of move it coupled with reading the tile of the pixel it's going to go into next. By doing this one can not only go through walls without disturbing the other npcs.
Spoonweaver wrote:
as for the switch/case thing. The way I understand it there are 2 ways to do them. the way I have them written or a do( ) included after. I believe the do() is mostly for when you want more than a line of code to happen.
I haven't read the thread and don't know what you're replying to, but that's not right. The do is optional mainly because initially it was mandatory but later on I decided that it was possible to do without it and be less verbose.
Code:
case (1, 2, 3)
showvalue(5)
wait
showvalue(5)
wait
is equivalent to
Code:
case (1)
case(2, 3) do(
showvalue(5)
wait)
case(2, 3) do(
showvalue(5)
wait)
When you want a case to be empty rather than feed into whatever follows it, then you need a dummy do:
Code:
case (1) do()
case(2, 3)
showvalue(5) # only happens on 2 or 3
wait
case(2, 3)
showvalue(5) # only happens on 2 or 3
wait
I admit it's not 100% obvious. In fact even I had to look it up to write this post.
The whole
thing, for the hammer , doesn't really work. The OHR always replies with
"the name "herox" is not a working command or a variable" or something like that. I also tried msw188's version, but it didn't work out either...
Code:
write pass block (herox(me),heroy(me),0)
thing, for the hammer , doesn't really work. The OHR always replies with
"the name "herox" is not a working command or a variable" or something like that. I also tried msw188's version, but it didn't work out either...
Well that seems bizarre. First things I can think of are:
-make sure you have the line
at the top of your plotscript text file.
-for that matter, make sure the actual file plotscr.hsd is in the same location as where your script and compiler are (I'm actually not sure if this is still necessary...?)
-if you open plotscr.hsd in a text editor (like notepad), it should have the following line:
If this line appears to be missing, maybe re-download the engine...? As a general rule, you shouldn't alter the plotscr.hsd file on your own.
EDIT: Also, once we get the script to remember that heroX actually exists, then you will want to use 'my version', really Spoonweaver's updated version that he edited into his post.
I am Srime
-make sure you have the line
Code:
include, plotscr.hsd
at the top of your plotscript text file.
-for that matter, make sure the actual file plotscr.hsd is in the same location as where your script and compiler are (I'm actually not sure if this is still necessary...?)
-if you open plotscr.hsd in a text editor (like notepad), it should have the following line:
Code:
43,herox,1,0 # returns the hero's x coordinate
If this line appears to be missing, maybe re-download the engine...? As a general rule, you shouldn't alter the plotscr.hsd file on your own.
EDIT: Also, once we get the script to remember that heroX actually exists, then you will want to use 'my version', really Spoonweaver's updated version that he edited into his post.
I am Srime
msw188 wrote:
Yeah please don't take me the wrong way, you've definitely done more actual work to help than I have. I feel like I'm just sitting around emphasizing the negatives here, but it's because I honestly believe boomerang-like things are a lot harder to get right. Not at all impossible, but the wall problem still sounds like it needs some serious scripting to me (unless Hspeak can now suspend npc walls for one npc at a time). It's enough to make me question whether or not an NPC is the best method for a boomerang, because I can't think of a fix for this (besides suspending all other NPCs, at which point the boomerang becomes a TIME FREEZING boomerang!) that won't come down to pixel-by-pixel control anyways.
Yeah, the issue spoken of in the boldface type has been available for several years now. It bothers me that so few people (including the scripting veterans) know they're out there:
plotscript dictionary wrote:
set NPC ignores walls (who, value)
Given an NPC reference or NPC ID (in which case the first NPC with that ID is used), set whether that NPC can walk through walls. value should be true or false.
See also:
get NPC ignores walls
get NPC ignores walls (who)
Given an NPC reference or NPC ID (in which case the first NPC with that ID is used), returns whether that NPC can walk through walls.
set NPC obstructs (who, value)
Given an NPC reference or NPC ID (in which case the first NPC with that ID is used), set whether the NPC should be an obstruction to heroes and other NPCS. If set to false, the NPC can move through heroes and other NPCs and vice-versa. Heroes can always pass through Step-on NPCs. value should be true or false.
See also:
get NPC obstructs,
suspend obstruction
get NPC obstructs (who)
Given an NPC reference or NPC ID (in which case the first NPC with that ID is used), returns false if that NPC's obstruction has been suspended with set NPC obstructs (and is always true otherwise).
See also:
set NPC obstructs
Given an NPC reference or NPC ID (in which case the first NPC with that ID is used), set whether that NPC can walk through walls. value should be true or false.
See also:
get NPC ignores walls
get NPC ignores walls (who)
Given an NPC reference or NPC ID (in which case the first NPC with that ID is used), returns whether that NPC can walk through walls.
set NPC obstructs (who, value)
Given an NPC reference or NPC ID (in which case the first NPC with that ID is used), set whether the NPC should be an obstruction to heroes and other NPCS. If set to false, the NPC can move through heroes and other NPCs and vice-versa. Heroes can always pass through Step-on NPCs. value should be true or false.
See also:
get NPC obstructs,
suspend obstruction
get NPC obstructs (who)
Given an NPC reference or NPC ID (in which case the first NPC with that ID is used), returns false if that NPC's obstruction has been suspended with set NPC obstructs (and is always true otherwise).
See also:
set NPC obstructs
Really, there's no need to do things the hard way around here anymore. If you haven't checked out the plotscript dictionary in a while, it might be time to go back for another look.
Place Obligatory Signature Here




I'm writing some textboxes for the items that can be found rightnow ;D