 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
G-Wreck OHRRPGCE Game Designer

Joined: 28 Feb 2010 Posts: 32 Location: Oklahoma
|
Posted: Thu Mar 11, 2010 9:57 pm Post subject: Bridges |
|
|
Not sure if anyone has tried this or not, but I'm trying to make a bridge that the player can walk over or under depending on whether they are above or below it.
I'm trying to do this by triggering a plotscript when the hero steps on a transparent NPC. While a certain tag is on that checks the hero's position, the script will show the appropriate maptile to be above him, rather than below.
This will also suspend hero walls, and make transparent NPCs appear on the sides of the bridge where the hero is not supposed to be able to walk past (mimicking walls).
Once the hero steps on the same NPC again, the script stops, and everything goes back to normal.
Here are some screenshots of the scenario.
and here is my script:
Code: |
#This is supposed to enable the hero to walk both underneath
#and over a bridge depending on whether they are below or above it.
plotscript,bridges,begin
variable (x)
variable (y)
x := hero X (me)
y := hero Y (me)
if (check tag (47) == false)
then (
set tag (47,on))
else ( if(
check tag (47) == true)
then (set tag (47,off)))
#This is to allow the script to be turned 'on' and 'off' by
#NPCs '0,' and will also make NPCs '1' appear on the sides of the
#bridge to mimic walls (since the script also suspends hero walls).
while(check tag (47) == true)
do(suspend hero walls
write pass block (x,y,overhead tile))
end |
If anyone has any advice for a newbie scripter, I would appreciate the help
EDIT: And apparently I am incapable of posting images correctly, also.
EDIT (IM): I updated your image links. You were trying to use image tags on a web page. Cheers. |
|
Back to top |
|
 |
Newbie_Power

Joined: 04 Sep 2006 Posts: 1762
|
Posted: Thu Mar 11, 2010 10:16 pm Post subject: |
|
|
You'll want to use a separate tile layer for this. AFAIK overhead tiles don't work that great, and are buggy.
You should have two plotscripts, one that writes the Layer 2 tiles over the bridge, and one that removes the tiles by writing them to 0 again, and the according NPC triggers will use the script.
Of course, you won't be able to have NPCs on the bridge (you can't really do that with overhead tiles either), but that's a separate issue. _________________
TheGiz> Am I the only one who likes to imagine that Elijah Wood's character in Back to the Future 2, the kid at the Wild Gunman machine in the Cafe 80's, is some future descendant of the AVGN? |
|
Back to top |
|
 |
G-Wreck OHRRPGCE Game Designer

Joined: 28 Feb 2010 Posts: 32 Location: Oklahoma
|
Posted: Fri Mar 12, 2010 10:36 am Post subject: |
|
|
Hey, thanks for the screenshot help, I'm still getting used to these forums
I fiddled around with using maptile layers for awhile, but it looks like altering these may cause some graphical issues (not glitches, just problems with my map layering style).
So instead, I altered the script to change the hero's walkabout picture to 0 (which is transparent) when they step on NPCs 0 in the pictures above, and also to suspend hero walls again.
When the NPCs are activated, the script they call sets a tag on that makes NPC 0 disappear, and a new NPC (NPC 2) appear. NPC 2 will change the hero's picture back to what it originally was. This will also make NPC 1 appear to simulate walls again.
Here's the new script:
Code: | plotscript,bridges_on,begin
set tag (47,on) #Makes NPCs 1 and 2 (not pictured above) appear, also.
if (check tag (47) == true)
then(
set hero picture(me,0)
suspend hero walls
)
end
#------------------
plotscript,bridges_off,begin
set tag (47,off) #Disables NPCS 1 and 2.
if (get hero picture (me) == 0)
then(
set hero picture (me,1)
)
resume hero walls
end |
I created a new problem for myself when I did this, though. When the script changes the leader's hero picture back from its transparent picture, it will set it to 1 regardless of which hero is in leading.
EDIT: NPC 2 will appear where NPC 0 was when tag 47 is activated. |
|
Back to top |
|
 |
Newbie_Power

Joined: 04 Sep 2006 Posts: 1762
|
Posted: Fri Mar 12, 2010 10:53 am Post subject: |
|
|
EDIT: James posted at the exact same time. _________________
TheGiz> Am I the only one who likes to imagine that Elijah Wood's character in Back to the Future 2, the kid at the Wild Gunman machine in the Cafe 80's, is some future descendant of the AVGN?
Last edited by Newbie_Power on Fri Mar 12, 2010 10:54 am; edited 1 time in total |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Fri Mar 12, 2010 10:53 am Post subject: |
|
|
In Wandering Hamster I have a single-tile bridge that works similarly to what you were trying to do. You can walk over it north to south, or if you get in the boat you can sail underneath it wast and west. I used four step-on NPC triggers.
However, I think Newbie Power is right. Now that fancy layer support is available, the easiest way to do this will be with layer manipulation.
Here is how I would arrange things in the layer menu:
Tile Layer 0 (bottom layer, below hero's feet)
Tile Layer 1 (for anything else that goes under the hero all the time)
NPC Layer
Heroes Layer
Tile Layer 2 (for a copy of the bridge. This is the only layer that will be manipulated by scripting)
Tile Layer 3 (everything that always goes on top)
So you actually put two copies of your bridge on the map. One in layer 1 and another in layer 2. They overlap each other perfectly.
Now you write a pair of scripts, one to hide layer 2 when the hero walks over the bridge, and another to make layer 2 visible when the hero walks under the bridge
Code: |
plotscript, prepare bridge for crossing over, begin
variable(sl)
sl := lookup slice(sl:map layer2)
set slice visible(sl, false)
end
plotscript, prepare bridge for crossing under, begin
variable(sl)
sl := lookup slice(sl:map layer2)
set slice visible(sl, true)
end
|
|
|
Back to top |
|
 |
G-Wreck OHRRPGCE Game Designer

Joined: 28 Feb 2010 Posts: 32 Location: Oklahoma
|
Posted: Fri Mar 12, 2010 1:04 pm Post subject: |
|
|
Awesome, it works perfectly.
Thanks for the help, guys; I have been enlightened through it. |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|