Welcome Forums General Make “respawn to last door” by yourself

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #36383
    Marby
    Moderator

    Already 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-door

    Meanwhile, 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.

    1. You can decide, which doors can be used for respawning.
    2. You can decide, how much the hero gets healed.
    3. Also how often a respawn is possible completely is up to you.
    4. You can count how many times the hero died and respawn differently.
    5. …and many more. The limit is your imagination.

    Have fun!

    #36403
    deWiTTERS
    Keymaster

    Wow, this is really awesome! I haven’t even thought of this myself. Thanks for helping out our community like this! 🙂

    #36404
    Marby
    Moderator

    You’re welcome. Now you can invest the day’s work in something else. 😀

    #36949
    Anonymous
    Inactive

    Can you make a video of it ?

    #36956
    Marby
    Moderator

    I’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=XZvHVXZ9eV6WDxwbK0E9X7Jo9JL1JXGiv07

    The 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. 🙂

    #43832
    jojo
    Participant

    That’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!

    #43833
    Liam
    Participant

    Wow thanks fo this

    #43842
    Marby
    Moderator

    You’re welcome! Have much fun using this trick.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘General’ is closed to new topics and replies.