- This topic has 7 replies, 5 voices, and was last updated 3 years ago by
Marby.
-
AuthorPosts
-
March 12, 2021 at 10:48 pm #36383
Marby
ModeratorAlready 22 people on trello would like to have a respawn to last door functionality.
https://trello.com/c/HpWLBoDg/83-when-hero-dies-respawn-to-last-doorMeanwhile, you can just create it by yourself. As you will see, it’s quite easy.
In order to demonstrate this, I created a testing level, called it “GreenMeadow” and placed the following actors on it.
- an enemy character
- four invisible doors
Give a name to every door. For the test game I named the doors “Door1” up to “Door4”. - four invisible floor switches
- the hero
Of course, you would place your doors to multiple levels in a real game. However, I think this would be sufficient enough to explain the principle.
Click on the hero and change the screenplay for the hero’s “When hurt”-event.
if hero number of "respawn door" > 0 if hero health value <= 0 hero health value becomes 100 if hero number of "respawn door" = 1 hero teleports to door "Door1" at "GreenMeadow" if hero number of "respawn door" = 2 hero teleports to door "Door2" at "GreenMeadow" if hero number of "respawn door" = 3 hero teleports to door "Door3" at "GreenMeadow" if hero number of "respawn door" = 4 hero teleports to door "Door4" at "GreenMeadow"
Insert screenplay to the “When touched”-event for the first invisible switch like the following.
hero number of "respawn door" becomes 1
Insert also screenplay for the other three switches. Of course, for the other switches you have to use “becomes 2”, “becomes 3” and “becomes 4” in the screenplay instead of “becomes 1”.
After that, shift the Door1 to the right position and place the first switch above it. Do the same for the other three doors and switches.
Restart the game to make sure, the changes for the “When hurt”-event’s screenplay get activated.
That’s all!
The “respawn to last door” gets activated as soon as the hero passed one of the prepared doors and activates a switch. This switch then will let the game know, which door should be used. For our test game it is enough to walk over one of the magic symbols to activate a door. Try it out and let the hero lose to the monster on purpose. The hero will get healed and will start at the correct door.
By programming this yourself you even can do much more with this.
- You can decide, which doors can be used for respawning.
- You can decide, how much the hero gets healed.
- Also how often a respawn is possible completely is up to you.
- You can count how many times the hero died and respawn differently.
- …and many more. The limit is your imagination.
Have fun!
March 13, 2021 at 8:48 am #36403deWiTTERS
KeymasterWow, this is really awesome! I haven’t even thought of this myself. Thanks for helping out our community like this! 🙂
March 13, 2021 at 8:54 am #36404Marby
ModeratorYou’re welcome. Now you can invest the day’s work in something else. 😀
March 21, 2021 at 11:39 am #36949Anonymous
InactiveCan you make a video of it ?
March 21, 2021 at 1:57 pm #36956Marby
ModeratorI’m not that good at making videos, and neither is my computer. 🙂
Nevertheless, I made a step by step video for you.
https://e.pcloud.link/publink/show?code=XZvHVXZ9eV6WDxwbK0E9X7Jo9JL1JXGiv07The first time I didn’t think about the bug myself, which ignores screenplay until the next restart of the game. But after a manual game restart it worked. I’ve left this for you in the video so you can also see how to chase a bug.
You should be able to understand with the video how to build the function. In principle, I did the same thing there, what I described here in the tutorial. Only the name of the level is still “first”.
@You:
If you think this video is not that good, you also can help.
After you understood the method, you could make a better video for the community and post its link here. 🙂July 15, 2021 at 5:29 pm #43832jojo
ParticipantThat’s amazing! I might use this for my current game. I might try to have a level where the hero goes when it dies (kind of like an undead world) with a magical door that brings him back to the last checkpoint!
July 15, 2021 at 5:53 pm #43833Liam
ParticipantWow thanks fo this
July 15, 2021 at 9:36 pm #43842Marby
ModeratorYou’re welcome! Have much fun using this trick.
-
AuthorPosts
- The forum ‘General’ is closed to new topics and replies.