• All, Gmail is currently rejecting messages from my host. I have a ticket in process, but it may take some time to resolve. Until further notice, do NOT use Gmail for your accounts. You will be unable to receive confirmations and two factor messages to login.

Solved Restart Level on Death

Question that is answered or resolved.
I'm afraid that the engine will not withstand such a load

Not sure where you got that idea. You don't have all that many, and it doesn't matter anyway. Levels are unlimited and only loaded as needed.

It's still far more practical to use script, but if you're trying to limit the scope of your game for some imagined engine limit, you need to forget all about that.

DC
 
Not sure where you got that idea. You don't have all that many, and it doesn't matter anyway. Levels are unlimited and only loaded as needed.

It's still far more practical to use script, but if you're trying to limit the scope of your game for some imagined engine limit, you need to forget all about that.

DC
So I could just create "death 2" and put "jumptobranch" in there? And "level.txt" is not even used here?
 
@ArgosBigbayev

Unfortunately, this option doesn't suit me. I already have a many levels and 4 branches (8 planned in total). I'm afraid that the engine will not withstand such a load. Well, or I'm completely will confused in the code.
I suggest naming every level with a branch name and then you will be allowed to warp to any of them using the ondeathscript (or the animation script I posted in the video in my previous post).
Don't worry with branch limits, I have games with 250+ and works fine.

Please tell me something else. I would like to make a stealth level like in the example below. I use «ondeathscript.c» and «cranecounter.c» for player’s weapon so that the level would restart when the hero is detected (i.e. his death). But I get an error. The game crashes immediately after the death of the player. Do I have to add something to "spawn" or "death" for it to work correctly?
It would be good if I can take a look at the log and script files to understand what's causing the crash. But the game's mechanic you mentioned can be replicated using ondeathscript and branches, no matter how the player dies you can warp to the same branch you currently are.
 
It would be good if I can take a look at the log and script files to understand what's causing the crash. But the game's mechanic you mentioned can be replicated using ondeathscript and branches, no matter how the player dies you can warp to the same branch you currently are.

At first I tried to transfer the restart system from super karate kid. But now I took MKTCO as the basis, since it is more understandable to me. That is, i did not create anything new or my own.

And so, sorry for being annoying, I'm just still trying to put all the knowledge I have gained into a single picture. It turns out that I should give the entity ondeathscript.c and spawn through its death a jumptobranch file with the number of the desired level?

Or should it be a respawn animation?

Are there any additional links to the scripts to be used and in which animations they should be?
 
@ArgosBigbayev

It turns out that I should give the entity ondeathscript.c and spawn through its death a jumptobranch file with the number of the desired level?
I suggest using the ondeath event instead of animation scripts. Here's a example of how you can code an ondeathscript:

C:
void main(){
//Restart current branch
    int branch = openborvariant("current_branch");
    
    jumptobranch(branch, 1);
}

In the example above, the script will restart the current level, but you can put any other if you want.
In addition, you can use this script to include some additional conditions before the level is restarted, according to the game rules.
 
In the example above, the script will restart the current level, but you can put any other if you want.
In addition, you can use this script to include some additional conditions before the level is restarted, according to the game rules.
Yes, finally! Everything's going like clockwork. Thank you very much, your code opens up a lot of possibilities for me.
 
Sorry it took me so long to reply! What I did was add the script to the Player's "RESPAWN" animation. That also takes care of substracting a life when the Player dies.
 
Back
Top Bottom