1 HP?
#1
Posted 24 April 2009 - 06:29 PM
#2
Posted 24 April 2009 - 06:44 PM
I think it's doable only with the newest betas since there are now 4 global scripts slot which one of these is executed when Link dies I think.
#3
Posted 24 April 2009 - 06:47 PM
I never knew about the new global script slot. I'll have to check that out. Thanks!
#4
Posted 25 April 2009 - 02:59 AM
You could script it, the script would probably look something like this:
void run(){
int HP;
while(true){
HP = Link->HP;
Link->HP = 1000;
Waitdraw();
int HPdiff = 1000-Link->HP;
if(HP-HPdiff < 0) //Link has died, do whatever you want to do
else Link->HP = HP-HPdiff;
Waitframe();
}
}
}
I don't see why that shouldn't work, but you'd have to test it.
#5
Posted 25 April 2009 - 05:57 AM
Example: Link starts the game with 13 hearts, but ZC shows him as having 3 (the first 10 are invisible). If his life reaches 10 or below, the script does 10 hearts of damage to him, unless he has a fairy. If he has a fairy, the script instead removes the fairy and performs an animation.
Everyone, does this sound like something a script could do? It depends on whether ZScript lets you use certain criteria...
#6
Posted 25 April 2009 - 06:29 AM
I've just realised though that the code snippet that I just wrote should get round having to do that at all, if it works.
#7
Posted 25 April 2009 - 08:24 AM
@Radien: That's a really interesting idea, actually. Thanks for the advice!
#8
Posted 26 April 2009 - 08:49 AM
If Joe's attempt succeeded, though, it'd be better to rely on his smarts than my sneakiness. Good luck, Joe.
#9
Posted 05 May 2009 - 10:46 AM
#10
Posted 05 May 2009 - 06:23 PM
Maybe you could add an onDeath Script slot sometime.
Edited by Beefster, 05 May 2009 - 06:23 PM.
#11
Posted 05 May 2009 - 07:18 PM
I'd love to but I think it'd require quite a lot of re-structuring the game loop, which I'm definately not up to doing at the moment.
#12
Posted 06 May 2009 - 12:27 AM
The condition should be true if Link's life would become zero, not only once it's less than zero. I imagine the reason it doesn't work would be more complicated than that, though.
The only other point I could see a problem is with putting waitframe after waitdraw, but that's only because I'm not completely sure how ZQuest handles scripts. The way I understand it, waitdraw allows ZQ to finish all calculations for the next frame, but doesn't draw it yet. Then waitframe advances the game to the beginning of the next frame. So the point I'm confused about is waitframe - does ZQuest execute scripts first before its own calculations, or are they executed "simultaneously"?
Probably not being at all clear about that - sorry if I don't make sense.
#13
Posted 06 May 2009 - 12:31 AM
Makes sense to me. And if I can understand it, I'm sure an actual scripter could. Let's see whether Joe has tried that yet.
I hope it works, but if it doesn't, I guess you can always fall back on my idea to see if THAT works.
#14
Posted 06 May 2009 - 09:33 AM
So technically it does work, it just looks as though Link always has full HP, which is obviously just a little undesirable.
Executing simultaneously isn't possible at any level; as far as I understand a computer's processor can only work out one calculation at a time.
ZC works a little like this:
- Item Scripts
- FFC Scripts (starting at #32 and working down to #1 I think)
- The Global Script
- --Waitdraw()--
- The system's functions run
- The screen itself is drawn (and the subscreen, so it seems)
- Global functions after Waitdraw
- --Waitframe()--
- Sprites and script primitives are drawn
- Advance to the next frame
Your idea most definately does work though Radien; I've used it before and I started setting it up for aKttH yesterday.
#15
Posted 06 May 2009 - 12:49 PM
But yeah, I don't see any way to get this to work script-wise at the moment since there's no way to get between calculating the new Link->HP and drawing Link's life. So the invisible hearts method sounds good to me. And it allows you to do other stuff like fairies and custom game over screens anyway.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users