Author Topic: Question About Course Exits  (Read 4036 times)

WidgetKitty

  • Level 3: Plugger
  • *
  • Posts: 32
    • View Profile
    • My YouTube channel, where I'll be posting videos of my games
Question About Course Exits
« on: September 14, 2022, 04:33:55 PM »
Hello guys, quick question. I'm looking for a way to exit a course without completing it, but also without using the pause menu and losing a life. I want to create "toll booth" sort of areas - just a small spot where you need an item or money to pass and complete it - but still have the ability to walk to the far left and leave freely if you lack the item or cash. It'd be unfair to have the player lose a life to exit (I know I can disable that, but they'd still have to use the menu). Everything I've found so far doesn't let you leave a course without completing it or dying.

Either that, or if it's possible to have players exit a course to different locations on the map, but that doesn't appear to be possible - I just get errors when I try to force it with a command. If neither of these are possible, I'll have to come up with something else for these "toll booths" or leave them out entirely...

Gizgord

  • average
  • Level 18: Statix
  • *
  • Posts: 835
    • View Profile
Re: Question About Course Exits
« Reply #1 on: September 14, 2022, 10:53:17 PM »
for further record, this type of post would fit better in the "Working with Platform Builder" category, but no worries

which command is causing you the trouble? here are two solutions of the top of my head.
you want to access area settings, then change the area goal to "Reach far left" and "Command prompt". in that prompt, write:

1. instant complete/finish course / instant secret exit. this WILL complete the course (obviously), but it should skip the jingle and return player to the overworld. I'd say default to option 2.
2. world = [overworld ID], [player ID]. to make use of multiple player spawns, you will have to turn on Advanced mode if you haven't already.
place player's/players' icon next to the level icons. as for the player ID, it must be different to every other you place in that overworld. make it something you'd remember, you can use letters. say.. "booth", or "booth1", "booth2" if you want multiple.
your overworld ID is probably 1, but if you're not sure, you can check it in any command prompt. click on Managers and navigate to Worlds. choose the correct one and it will paste that number for you.
TIP: check "Show ID's" from title screen options, it's a real time saver ;)


now then, your command should look something like this:
in area settings, Area Goals
Move Far Left
for: Command Prompt

in command prompt:
world = 1, booth


let me know if that worked out for you, and if you have any other questions :))
« Last Edit: September 14, 2022, 11:01:43 PM by Gizgord »

WidgetKitty

  • Level 3: Plugger
  • *
  • Posts: 32
    • View Profile
    • My YouTube channel, where I'll be posting videos of my games
Re: Question About Course Exits
« Reply #2 on: September 15, 2022, 12:11:11 AM »
which command is causing you the trouble? here are two solutions of the top of
2. world = [overworld ID], [player ID]. to make use of multiple player spawns, you will have to turn on Advanced mode if you haven't already.

Yeah, this was the last way I tried it, and tried with several different player IDs to make sure it wasn't my error. It just seems like levels refuse to exit to more than one location - when you set both left and right as exits, for example, there's still just one option. Every time I used some method to send the player to different map locations from one area, one exit would become inactive - like a dead exit sign. I just figure the player has to always go back to the same location they entered from.

One work around I might try - make a "fortress" with Bonus Area checked, and make an obstacle that you can either pass with wall jumps enabled, or fall to your exit (for example). Either way, it doesn't seem like you can exit a course that blocks your path without completing it or dying, I might have to leave this idea behind. (It would be useful if there was a way implemented, for something like an escape item). It's honestly pretty small anyway, I've gotten a lot more successful mechanics done already, best keep making progress. I should probably make a thread for the game with some updates

Gizgord

  • average
  • Level 18: Statix
  • *
  • Posts: 835
    • View Profile
Re: Question About Course Exits
« Reply #3 on: September 15, 2022, 08:29:29 AM »
hmm. so you're saying the area goals don't trigger? I'll check on that when I can.

try a command block. from "Invisible Blocks", pick the grey one with CDM written on it and arrows pointing to left and right.
that block will trigger the command once you pass its X axis.
« Last Edit: September 15, 2022, 08:54:13 AM by Gizgord »

WidgetKitty

  • Level 3: Plugger
  • *
  • Posts: 32
    • View Profile
    • My YouTube channel, where I'll be posting videos of my games
Re: Question About Course Exits
« Reply #4 on: September 16, 2022, 03:57:44 AM »
hmm. so you're saying the area goals don't trigger? I'll check on that when I can.

try a command block. from "Invisible Blocks", pick the grey one with CDM written on it and arrows pointing to left and right.
that block will trigger the command once you pass its X axis.

Well, in most cases one goal would not trigger. In cases where both triggered, the 2nd would either go to the position you entered from instead of the new one, or cause an error. I could try a command block next, but really not sure if I want to use this now or not. I was also going to work around it with those yellow path tiles on the map removing things, but that crashes the game in EXE form, for some reason. I'd like to solve that one too, if I could...

Honestly, I haven't used the Cmd invisible boxes yet, and should really start before I get much further. Thanks for mentioning the arrows, I wasn't quite sure what those were all about. Then the up & down arrows for Y axis, blank one for just that tile, and I assume the 3 & 4 arrows are for walking and running through? And what does the white arrow forming a rectangle do?

Sorry to bombard you with questions, I'm still so new to this. One last thing I've wondered, do the "!" do anything different compared to the "?" ones? I haven't noticed, but haven't really tried much.

Gizgord

  • average
  • Level 18: Statix
  • *
  • Posts: 835
    • View Profile
Re: Question About Course Exits
« Reply #5 on: September 16, 2022, 10:11:40 AM »
Well, in most cases one goal would not trigger. In cases where both triggered, the 2nd would either go to the position you entered from instead of the new one, or cause an error. I could try a command block next, but really not sure if I want to use this now or not. I was also going to work around it with those yellow path tiles on the map removing things, but that crashes the game in EXE form, for some reason. I'd like to solve that one too, if I could..
hmm. I'll do my own testing and write a report  :))

Honestly, I haven't used the Cmd invisible boxes yet, and should really start before I get much further. Thanks for mentioning the arrows, I wasn't quite sure what those were all about. Then the up & down arrows for Y axis, blank one for just that tile, and I assume the 3 & 4 arrows are for walking and running through? And what does the white arrow forming a rectangle do?
normal command blocks only activate once, they trigger when you run across them. the rectangular arrow makes it so you can trigger them indefinitely.
three arrowed blocks will run the command in a staggered loop (every six frames) when you're colliding with the block. four arrows will run at a constant loop (every frame).

they can make the engine more complicated, but it's a powerful tool. very, very useful.  8)
here's a tip, by they way: when that block is chosen, open the item box (the window where all items are stored) and activate the assistant (click its icon with a right-click).

Sorry to bombard you with questions, I'm still so new to this. One last thing I've wondered, do the "!" do anything different compared to the "?" ones? I haven't noticed, but haven't really tried much.
please do, I'm happy to help.  O:-)
? and ! blocks are the same thing, they just look different. however, there are two kinds.
the shine from left to right: it will spawn the item on top of the block, ready to be collected
the shine from top to bottom: it will automatically give said item to the player.
« Last Edit: September 16, 2022, 10:14:26 AM by Gizgord »

WidgetKitty

  • Level 3: Plugger
  • *
  • Posts: 32
    • View Profile
    • My YouTube channel, where I'll be posting videos of my games
Re: Question About Course Exits
« Reply #6 on: September 16, 2022, 06:01:22 PM »
hmm. I'll do my own testing and write a report  :))
normal command blocks only activate once, they trigger when you run across them. the rectangular arrow makes it so you can trigger them indefinitely.
three arrowed blocks will run the command in a staggered loop (every six frames) when you're colliding with the block. four arrows will run at a constant loop (every frame).

they can make the engine more complicated, but it's a powerful tool. very, very useful.  8)
here's a tip, by they way: when that block is chosen, open the item box (the window where all items are stored) and activate the assistant (click its icon with a right-click).
please do, I'm happy to help.  O:-)
? and ! blocks are the same thing, they just look different. however, there are two kinds.
the shine from left to right: it will spawn the item on top of the block, ready to be collected
the shine from top to bottom: it will automatically give said item to the player.

Yeah, Ting Thing just emailed me back, saying the path thing is fixed in 10.1, and it works great now!

Thanks for the help with commands blocks, I'll have to implement them now. Lots of work to do today now that it's fixed!

I did figure out the difference between item boxes being auto or not, but if the "!" ones are no different, I could have my tech-looking item box with a different coloured light or something.

While I've got you, I wondered, is there an option to have a pick-up item stay with the player after leaving a level, and/or one to keep the amount of primary ammo? When returning to the map, you lose pick-up items and ammo resets to the number in the character's setup, and I can't find the option to change this. It's preventing me from selling ammo and special weapons in shops, since it all disappears!

War

  • "The top player is here!"
  • Level 20: Nobom
  • *
  • Posts: 1490
    • View Profile
    • My website
Re: Question About Course Exits
« Reply #7 on: September 16, 2022, 06:51:06 PM »
Yeah, Ting Thing just emailed me back, saying the path thing is fixed in 10.1, and it works great now!
Good to learn there is at least one thing that actually works in this update
Hey, wassup wassup? My name is Warrior555MainsGanon (but just call me War) and I'm the main guy behind Megaman Zero Online and the upcoming Matt's Adventure! I don't speak often here but I'm a very friendly lad so if you wanna talk, don't hesitate!

Gizgord

  • average
  • Level 18: Statix
  • *
  • Posts: 835
    • View Profile
Re: Question About Course Exits
« Reply #8 on: September 16, 2022, 07:06:21 PM »
While I've got you, I wondered, is there an option to have a pick-up item stay with the player after leaving a level, and/or one to keep the amount of primary ammo? When returning to the map, you lose pick-up items and ammo resets to the number in the character's setup, and I can't find the option to change this. It's preventing me from selling ammo and special weapons in shops, since it all disappears!
well, I'm not sure if you can keep storing a pick-up item across levels (in a way so they're still in inventory and you can put them down). besides that, changing max ammo is pretty simple. make an item run this command:

permanent=1/true (type this if you can't get it working, or just in case)
max ammo=[value]

Gizgord

  • average
  • Level 18: Statix
  • *
  • Posts: 835
    • View Profile
Re: Question About Course Exits
« Reply #9 on: September 16, 2022, 07:08:13 PM »
Good to learn there is at least one thing that actually works in this update
don't worry, that compiling error is patched already. TT dealt with it pretty quickly
« Last Edit: September 16, 2022, 07:08:58 PM by Gizgord »

WidgetKitty

  • Level 3: Plugger
  • *
  • Posts: 32
    • View Profile
    • My YouTube channel, where I'll be posting videos of my games
Re: Question About Course Exits
« Reply #10 on: September 16, 2022, 07:21:42 PM »
well, I'm not sure if you can keep storing a pick-up item across levels (in a way so they're still in inventory and you can put them down). besides that, changing max ammo is pretty simple. make an item run this command:

permanent=1/true (type this if you can't get it working, or just in case)
max ammo=[value]

I was thinking of suggesting these be added as features - we already have a "replenish health" box to uncheck, so there could be a "replenish ammo" one two. I notice if you switch a pick up item to "permanent", it just disappears when you grab it (probably permanently applying its features, but mine were just ranged weapons, and did not function or appear in the HUD. So, maybe this can be changed to stay with the character until they drop it, when set to permanent.

In the meantime, I'll try that command. So if I add

permanent=1/true
max ammo=[value]


To the game's looping commands, would that do the trick?

I already have two commands running in there:

if ammo = 0
{
stand attack style = front
move attack style = front
}
if ammo >= 1
{
stand attack style = ranged
move attack style = ranged
}


This is to switch her back to unarmed attacks once she's out of bullets, and back when she picks up ammo - once I start using the gun. But I guess you can run as many commands as needed in this loop area?

Gizgord

  • average
  • Level 18: Statix
  • *
  • Posts: 835
    • View Profile
Re: Question About Course Exits
« Reply #11 on: September 16, 2022, 08:25:54 PM »
I was thinking of suggesting these be added as features - we already have a "replenish health" box to uncheck, so there could be a "replenish ammo" one two.
that's a good sugestion. you could make a new thread about it  O:-)

I notice if you switch a pick up item to "permanent", it just disappears when you grab it (probably permanently applying its features, but mine were just ranged weapons, and did not function or appear in the HUD. So, maybe this can be changed to stay with the character until they drop it, when set to permanent.
I suppose you could experiment with setting items duration to course, then doing something like: give player1 item [item ID] every time you start a new level. but that would involve variables and conditionals.. it seems messy and I don't think it is worth it

permanent=1/true
max ammo=[value]

for the record, use either 1 or true

To the game's looping commands, would that do the trick?

I already have two commands running in there:

if ammo = 0
{
stand attack style = front
move attack style = front
}
if ammo >= 1
{
stand attack style = ranged
move attack style = ranged
}


This is to switch her back to unarmed attacks once she's out of bullets, and back when she picks up ammo - once I start using the gun. But I guess you can run as many commands as needed in this loop area?
well done with that conditional. you could replace "if ammo >= 1" with "else" if you want it to be tidier
you don't need to make these looping commands. that might actually introduce slowdowns, and there's a way to make it check only when it's necessary.

go to Game Setup>Character Setup>choose the player character>Char Commands.
there are many options to choose from. the best choice for your use-case is probably Key Press Commands>[Attack]. simply paste the longer command in that prompt, and it will run every time the player presses the attack button.

for that shorter command, just insert it into that pick-up items prompt and it should be enough
« Last Edit: September 16, 2022, 08:28:54 PM by Gizgord »

WidgetKitty

  • Level 3: Plugger
  • *
  • Posts: 32
    • View Profile
    • My YouTube channel, where I'll be posting videos of my games
Re: Question About Course Exits
« Reply #12 on: September 16, 2022, 11:09:16 PM »
that's a good sugestion. you could make a new thread about it  O:-)

Think I will, but I have a bunch of other suggestions. I'll jot some down as I'm working and make one thread in a few days with all of them.

I suppose you could experiment with setting items duration to course, then doing something like: give player1 item [item ID] every time you start a new level. but that would involve variables and conditionals.. it seems messy and I don't think it is worth it

Yeah, probably not. Was thinking I might create a system of special pick-up weapons that appear to be spawned by a machine, with some in-game explanation about why they disappear when out of range from their spawn block (leaving that level). Going to have grenades, boomerangs, flame throwers, etc.

well done with that conditional. you could replace "if ammo >= 1" with "else" if you want it to be tidier
you don't need to make these looping commands. that might actually introduce slowdowns, and there's a way to make it check only when it's necessary.

go to Game Setup>Character Setup>choose the player character>Char Commands.
there are many options to choose from. the best choice for your use-case is probably Key Press Commands>[Attack]. simply paste the longer command in that prompt, and it will run every time the player presses the attack button.

I should have thought to use "else" there instead - but get this, when I tried it, it didn't work, had to switch back to my original code. Actually, I hadn't clicked on that Char Commands button yet, assuming it was just a popup for one set of commands, not two pages of buttons! I had to separate it into two codes, for stand attack and move attack, but it works.

However, I erased the gun in her sprite already, since I'll be doing those throwing items. So when/if I add the gun, I'll also need to switch her sprite to have a gun, and then back to the usual sprite when the key is released - because you could have regular ammo and a special weapon; I don't want her pointing the gun to throw a grenade, for example. Just not sure how smooth that'll go.

Also tried to set up manually switching from unarmed front to ranged using Up
+ [attack], but it doesn't seem to work so far. Of course, that's assuming the player would want to go unarmed by choice. Just that a big mechanic is these custom grey crates that break from any attack (so you're punching and kicking these a lot), but regular bullets don't affect them unless they explode or something. I'm really debating not using the regular gun at all, since it's getting kind of messy with sprite changing. Instead, I might make the primary ammo grenades, and make them upgradable. A spy without her hand gun doesn't make much sense, but oh well...

Gizgord

  • average
  • Level 18: Statix
  • *
  • Posts: 835
    • View Profile
Re: Question About Course Exits
« Reply #13 on: September 17, 2022, 02:48:28 PM »
However, I erased the gun in her sprite already, since I'll be doing those throwing items. So when/if I add the gun, I'll also need to switch her sprite to have a gun, and then back to the usual sprite when the key is released - because you could have regular ammo and a special weapon; I don't want her pointing the gun to throw a grenade, for example. Just not sure how smooth that'll go.
how do you plan on changing the character's sprites? I imagine you'd have multiple character designs for different weapons.
so, one design for unarmed. design with a gun. design for whatever else.
character sprite = [ID] would change the entire design
melee sprite = [ID] would change the melee attack
ranged sprite = [ID] would change the ranged attack

additionally, if you ever wanted to add an animation that's outside of the default sprite sheet.. say for a reload, you can use sprites.
char sprite hold = [ID] would hold the last frame until cancelled with a different command (return to previous design, exit, etc.)
char sprite repeat = [ID] would continually loop until cancelled
char sprite revert = [ID] would revert to design after the animation completes playing

it's getting pretty convoluted to keep switching all these designs, but the final outcome would make for awesome mechanics/gameplay

Also tried to set up manually switching from unarmed front to ranged using Up
+ [attack], but it doesn't seem to work so far. Of course, that's assuming the player would want to go unarmed by choice.
I've done something like this before, actually. here's what worked for me:
Code: [Select]
if game var atk=0
game var atk=1
else
game var atk=0

if game var atk=0
{
stand attack style=front
move attack style=front
jump attack style=front
}
if game var atk=1
{
stand attack style=ranged
move attack style=ranged
jump attack style=ranged
}
I used game variables so that settings would remain the same across levels. but you can swap them for course vars if you so choose.
also, "atk" is a generic name I came up with. you can just use whatever you want.
« Last Edit: September 17, 2022, 03:02:59 PM by Gizgord »

WidgetKitty

  • Level 3: Plugger
  • *
  • Posts: 32
    • View Profile
    • My YouTube channel, where I'll be posting videos of my games
Re: Question About Course Exits
« Reply #14 on: September 17, 2022, 08:51:47 PM »
how do you plan on changing the character's sprites? I imagine you'd have multiple character designs for different weapons.
so, one design for unarmed. design with a gun. design for whatever else.
character sprite = [ID] would change the entire design
melee sprite = [ID] would change the melee attack
ranged sprite = [ID] would change the ranged attack

additionally, if you ever wanted to add an animation that's outside of the default sprite sheet.. say for a reload, you can use sprites.
char sprite hold = [ID] would hold the last frame until cancelled with a different command (return to previous design, exit, etc.)
char sprite repeat = [ID] would continually loop until cancelled
char sprite revert = [ID] would revert to design after the animation completes playing

it's getting pretty convoluted to keep switching all these designs, but the final outcome would make for awesome mechanics/gameplay
I've done something like this before, actually. here's what worked for me:
Code: [Select]
if game var atk=0
game var atk=1
else
game var atk=0

if game var atk=0
{
stand attack style=front
move attack style=front
jump attack style=front
}
if game var atk=1
{
stand attack style=ranged
move attack style=ranged
jump attack style=ranged
}
I used game variables so that settings would remain the same across levels. but you can swap them for course vars if you so choose.
also, "atk" is a generic name I came up with. you can just use whatever you want.

Ooo, I can see how that would work! For now I'm not going to be trying to switch sprites when using a weapon, not sure if I'll be adding the gun or not. But now I have a new problem - somehow it's happening anyway, in a weird way. Here's the situation:

I have the character upgrade, and switch sprites to an entirely new sheet, but then when I use a ranged pick up item, she switches back to the previous sprite sheet for ranged attacks, then back. I have no commands running that I can locate, I've erased it all since I won't be using it for now. If I start the character off with the new sprite, it uses the proper ranged sprites from that sheet, but if I use a command to change from the old sprite, the three ranged attack sprites are the only ones that don't change. I've tried reuploading the sprites, renaming files, importing ranged sprites separately - none of it works. Even on a custom projectile page the sprite changed, but if I go to the character design with the second sprite, then back to projectiles, it does use the proper one.

Now, on the old sprite sheet the ranged attacks are the only ones I've edited (to remove the gun), so I wondered if that could be the cause? Though, I changed her eyes in the walking sprite as a test, and it didn't switch that sprite back when walking with the new one. I have no idea what's doing this, can't find a cause...