Post new topic    
Slime Knight
Send private message
Howdy! (Basic Plotscripting Question) 
 PostMon Apr 04, 2011 11:12 am
Send private message Reply with quote
Hey everyone.

Long time lurker here, but kinda just now posting again after a really long absence. I'm glad to see the community is still going on like this! Grin

I've got a quick plotscripting/tag-related question I thought I'd run by you guys. I get the feeling I might be overlooking something obvious, but what can I say? I'm a bit rusty at the engine after so long.

Here's the deal: I've got a collapsing floor thing in a dungeon, which requires four elements:

- show a textbox saying "The floor collapsed!"
- change the look of the tile to be a hole/crack
- use a hidden door to simulate falling to the floor below
- make it so that you can step on the hole again and fall through, but without triggering the textbox again.

The way I have it set up at the moment is like this:

Code:
define script (1, crumble, door, 0)

script, crumble, door, begin
     tb(5) #show text box 5
     usedoor(door)
end


In this setup, the NPC is a drawing that looks like the unbroken maptile; it's set to activate upon "step-on", runs the script "crumble", and passes the argument "door" corresponding to the door to be used. It's usable only once, so that fake-maptile NPC vanishes and reveals a real-maptile hole beneath.

The problem is, obviously, that this setup doesn't meet the fourth requirement. It works well enough the first time, but then of course the hole no longer functions as a door (the door itself is hidden in a nearby wall; it can't be on the hole-tile, lest it be triggered instead of the NPC the first time one steps on the tile).

I know I could do this easily by just having a separate textbox and tag for each instance of a crumbling floor, but if I can figure out this other method with the "crumble" script, it'll be significantly more convenient and tidy. Any thoughts?
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
Liquid Metal Slime
Send private message
 
 PostMon Apr 04, 2011 2:06 pm
Send private message Reply with quote
First of all, defining scripts is old format, so you don't have to do that any more.

This is what I would do. In the editor, place two NPCs on the same tile. You can do this by holding control and pressing a direction when you place the second NPC. Have one NPC (Hole picture) appear when tag x is on, and the other when it's off (Crumbly floor).

Assuming you have multiple similar holes, have all of the hole tags next to each other in the tag menu (e.g. 5,6,7,8 if there are four).

Code:

plotscript, crumble, door, begin
     tb(5) #show text box 5
     usedoor(door)
     set tag(door+x,on) # x = the number required to add up to the tag id
end

My website, the home of Motrya:
http://www.jshgaming.com
Metal Slime
Send private message
 
 PostMon Apr 04, 2011 3:16 pm
Send private message Reply with quote
No need for the double NPC in JSH's setup. Just have the door on the hole tile, but have it set to work only if the 'floor is broken' tag is on.

However, it can be a pain making all of the necessary doors if there are LOTS of crumbly floors. If it helps you at all, in my Tales games I had a separate script for different maps, and then I kept a constant distance between different floors on that same map. So my script looked more like:

Code:
script, fall through hole for ice cave, begin
#graphical stuff because I used a caterpillar party
set hero position (me, get hero x(me), get hero y(me) + offset)
...

where "offset" was the number of tiles down that the first floor was drawn from the 2nd floor in the maptile editor.
I am Srime
Liquid Metal Slime
Send private message
 
 PostMon Apr 04, 2011 3:28 pm
Send private message Reply with quote
On that note I personally hate using doors, and it might be easier to just use fadecsreenout() with teleporttomap() since you're using an argument anyway.
My website, the home of Motrya:
http://www.jshgaming.com
Liquid Metal King Slime
Send private message
 
 PostMon Apr 04, 2011 3:55 pm
Send private message Reply with quote
Welcome back, Harlock!

Myself, I would probably do this with maptile changing, but the disadvantage of my way is that you will also need a script to run when the map loads to re-apply the crumbled tile.

Probably more work than it is worth :)
Metal Slime
Send private message
 
 PostMon Apr 04, 2011 4:39 pm
Send private message Reply with quote
i have an entire dungeon in my game where the only way to get through it is by falling through the floors. it's very easy. the way i have it set up, the text box appears after you fall, so you might want it to say "the floor collapsed beneath you" rather than "the floor collapses beneath you". all you need to do is create the text box, set an npc with a floor tile graphic, or just a crack (or more than one, depending on how many holes you have) with the "usable only once" option which makes it disappear after use, and set it's activation to "step on". then, have your door underneath the floor tile npc linked to where you want the hole to lead.

so, to recap:
    ~"doors" on all the hole tiles
    ~npcs with "step on" activation, "usable only once" option
    ~purdy cracked floor graphic
    ~textbox reiterating the fact that the player fell through the floor


when you step on the crumbly floor tile, it will immediately send you where the door leads to, then show the text box when you reappear. then, the npc will be gone leaving the hole open, but the player can still drop down freely, without having to see the text box again. this way isn't the prettiest way to it, but it's really simple and requires no plotscripting at all. if you want to animate the player so they look like they're falling, that would take some ploscripting.

on a side note: when are ya gonna finish spellshard?! i was addicted to it, then it ended too soon! Surprised it totally needs an update.
Hey, I just met you, and this is crazy... So here's some lunchmeat... Sandwich, maybe?
Liquid Metal Slime
Send private message
 
 PostMon Apr 04, 2011 9:51 pm
Send private message Reply with quote
Incidentally, I've done exactly this with full blown cracking animation and character falling. You really don't need a tag or an NPC. You just need to "read map block" in an each-step script and have the hero fall through if his coordinates match the conditions set in "read map block":

Code:
global variable (1,firstfall)

set variable (x,hero x (0))
set variable (y,hero y (0))
set variable (crack,read map block (x,y,0))
if (firstfall==0) then(
show text box (1212)
wait for text box
set variable (firstfall,1) #stops the text from showing up a second time
if (crack==12) then( #or whatever tile(s) corresponds with the crack graphic
suspend player
#script the falling animations
fade screen out (0,0,0) #hide the transition from map to map, or floor to floor
wait (1)
#relocate player to new floor using set hero position and direction
reset hero picture (0) #restores default walkabout
wait (1) #or however long works for dramatic effect
fade screen in
resume player
)
)
end


No need to waste tags or NPCs. You just need a couple of extra tiles in your tileset. You may also want to set the map to remember mapstate:tiles when leaving.

Let me know if any of the lines above need explanation.

I'll edit this post with a sample video once I put one together. Check back soon.

EDIT: Okay, here's the video showing the hero crossing a floor before it breaks and standing on the floor as it breaks.


Place Obligatory Signature Here
Metal Slime
Send private message
 
 PostTue Apr 05, 2011 3:24 am
Send private message Reply with quote
Hm, Pepsi's method might be best. If you have the map set to remember its state (a relatively new addition that I always forget about), you probably don't need the global variable either. If you calculate the landing spot similarly to how I described in my method, you won't need doors, tags, NPCs, or global variables; all you'll need is one maptile for each different looking kind of "crack". Unless I'm missing something.
I am Srime
Slime Knight
Send private message
 
 PostWed Apr 06, 2011 6:40 am
Send private message Reply with quote
Wow, so much input here. Thanks everyone for sharing all these different ways to go about it.

At the moment, I'm leaning towards using a truncated version of what Pepsi Ranger is doing. In the meantime, it's working in a "quick and dirty" way, so I'll post what I did here once I decide to go back and fancy it up.
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
Display posts from previous: