Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Hud Problems with displaying toggled by health.

Author
Message
Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 5th Oct 2010 13:46
Ok, so I have a script that did work, and now it doesnt. I made it myself, with a bit of help, but anyway, it doesnt work any more and I do not know why. I have spent ages looking at my script, and I am unable to find anything wrong. All the HUDs are in the correct directories, and all the health parts are set to the correct values, and the states are set how I want them.

Here is the code;

Can anybody see anything at all that is wrong with it?

Thanks everyone.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Gencheff
14
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 5th Oct 2010 15:26 Edited at: 5th Oct 2010 15:26
I don't see your logic here.

:state=4,plrhealthless=90,plrhealthgreater=84:hudunshow=hHud19,hudshow=hHud18,state=5
:state=4,plrhealthgreater=89:state=3
:state=4,plrhealthless=85:state=5


So what you wrote is if the players health is between 90 and 84 the state changes to 5.However you again wrote if the players health is less or equal to 85 the state changes to 5 again...

Now the thing that bothers me even more is the second row where if the health is greater or equal to 89 the state changes to 3.

Basically you are going in a loop and nothing will happen with this script.Your paths to images may be fine , but the script itself confuses the engine.

I say you start over.

Good luck.

Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 6th Oct 2010 02:07 Edited at: 6th Oct 2010 02:53
Main idea is to allow increasing and decreasing.
Basically, if it is less than 85, if I skip state 5, I may skip the state where I am required to go. pretty much, if greater that health handled by this state, go to previous state. if less than health handled by this state go to next state.
This is how i did it in more detail.

:state=3,plrhealthless=95,plrhealthgreater=89:hudunshow=hHud20,hudshow=hHud19,state=4
;If the state is 3, and the player's health is between 95 and 89, then hide hhud20 and show hhud19 and go to state 4. If the conditions are not met, do not take action, taking it to the next line.
:state=3,plrhealthgreater=94:state=2
;If the state (still) equal to 3 and the player's health is greater than 94, go to state 2.
:state=3,plrhealthless=90:state=4
;if the state is (still) equal to 3 and the player's health is less than 90, go to state 4.
Then, it will carry out this again, for state 4.

What I was worried about though is having to start over, as that is not ideal.
I might just remove the bottom 2 lines of each of those parts of the code, and at the bottom make it jump back up to the top of the code, right after the HUD creation.
Thanks.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 6th Oct 2010 03:07 Edited at: 6th Oct 2010 03:11
Dont worry, found my problem. same problem i made once, where i accidentally have : instead of whatever else i should have, in this case, i have : instead of a comma.

EDIT
Nope, I was wrong, they were separating conditions from actions.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 7th Oct 2010 01:46
Remove the use of states from all of your lines (except the lines where you're creating the HUDs)... you do not need to change states, and in fact, I think attempting to use states in this script is causing many of the problems.

For example, what happens if the player has 10 health, then gets a health pack that increases their health to 100? Your script will take time to catch up, not immediately change to the HUD that it needs. That is one of the problems I see in your script.

Remove the states and re-post your script (after testing) and let us know what the difference is.


The one and only,


Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 7th Oct 2010 10:06
OK, i tried your idea plyster and it didnt work.


Basically, it shows no huds at all.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Gencheff
14
Years of Service
User Offline
Joined: 12th Jun 2010
Location: UK by way of USSR
Posted: 7th Oct 2010 16:35
This line is ridiculous.

:hudunshow=hHud01,hudunshow=hHud02,hudunshow=hHud03,hudunshow=hHud04,hudunshow=hHud05,hudunshow=hHud06,hudunshow=hHud07,hudunshow=hHud08,hudunshow=hHud09,hudunshow=hHud10,hudunshow=hHud11,hudunshow=hHud12,hudunshow=hHud13,hudunshow=hHud14,hudunshow=hHud15,hudunshow=hHud16,hudunshow=hHud17,hudunshow=hHud18,hudunshow=hHud19,hudunshow=hHud20,state=2

You left state=2 in the first row.And Plystire told you to remove ALL states.

You also need to define the huds(which I'm guessing you did,but just didn't post that part of the script).

You also have conditions that interfere with eachother.Like for example :

x =< 15 ; x >= 9
and then I see
x = <20 ; x >= 14

Plystire made a very good point about sudden rise of health as well.

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 7th Oct 2010 18:14 Edited at: 7th Oct 2010 19:05
hudname=hhud0

hudunshow=hHud19,hudshow=hHud18

Why use a cap when showing or unshowing if you didn't use caps when defining?

If names are case sensitive, then you are attempting to show/unshow a hud that has never been created yet.

Try putting the capitol H in the hudnames, because that would be an easier edit than getting rid of the caps elsewhere, since the hud names are all nicely grouped at the top.

That would be the only thing I see wrong with the first script, other than also needing a desc = x.
Although, I would have finished it off differently...

:state=21,plrhealthless=1:hudunshow=hHud01,state=22

:state=22,plrhealthgreater=0:hudunshow=hHud01,hudshow=hHud0,state=2

...

:state=21,plralive=0:hudunshow=hHud01,state=22

:state=22,plralive=1:hudunshow=hHud01,hudshow=hHud0,state=2

...but his way should have worked too.



Try that, but change the description of course.

Quote: "For example, what happens if the player has 10 health, then gets a health pack that increases their health to 100? Your script will take time to catch up, not immediately change to the HUD that it needs. That is one of the problems I see in your script."

Yes, but it would barely be noticable if at all.
The problem I see with stepping back is that he is leaving the last hud displayed, so I would probably make sure each state removed its hud when going back up...

:state=3,plrhealthgreater=94:state=2

...

:state=3,plrhealthgreater=94:hudunshow=hHud19,state=2


Anyway, those two things above were all I saw that would keep the first script from functioning, and this last suggestion is just to tidy up.
I'll leave the testing to Michael Thompson,since he has all of the HUDs in the right places.

   Conjured Entertainment

 WARNING: Intense Madness
Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 8th Oct 2010 05:20 Edited at: 8th Oct 2010 05:35
Yes, when i did have it working, i am not certain as to whether i had a description, at one stage i did though so maybe thats when, but my code didnt have any of the starting stuff, i just went straight to the code. As for catching up, that actually wasnt a problem. I think, that if it is noticable at all, as CE said, it is hard to notice, as it is quick, and also, it is sorta like driving a car for example, where you must watch what you are doing and you dont watch the huds (in this case speedo etc)

Also, I put the state there to get it to loop but i realise now that states are just a variable condition so it must loop, and it would skip the hud creations as state = 2 and the hud creations are states 0 and 1.

Thanks and I will remove that part. as for the line where it hides all the huds, that was because the lines (take display of hud 15)
it would hide hud 14 and display hud 15. what if hud 13 was displayed? it isnt hidden.
Therefore, i was going to put that between each line without conditions and hope for the best.

Thanks

EDIT
Conjured Entertainment, I just tried your script and it did not work. Thanks though.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 8th Oct 2010 07:54 Edited at: 8th Oct 2010 08:00
Your line for unshowing all of the HUDs is a good idea, to ensure that no HUDs are shown before allowing the lines below it to show the HUD that is needed.

However, since you only have one colon on that line, it will not execute since it sees your commands as conditions and not actions. Place TWO colons at the beginning if you just want actions and no conditions.

Example:

that would ALWAYS set the state to 10, since there are two colons at the beginning, it will see that there are no conditions at all (which, by default, means it will run the list of actions) and execute all of the actions after the second colon.

Also, you will want to place that line immediately after the HUDs are loaded (that is, above your lines for showing the HUDs, otherwise they will never appear, since they're being hidden at the very end of the script)


Quote: "And Plystire told you to remove ALL states."


Thanks for pointing that out. He will want to remove that one as well. I also said in parentheses that he should keep the states for creating HUDs. This is so that the engine will not attempt to create the HUDs again, saving processing time. So I hope he did keep those.


Quote: "Yes, but it would barely be noticable if at all.
The problem I see with stepping back is that he is leaving the last hud displayed, so I would probably make sure each state removed its hud when going back up..."


I understood the logic perfectly fine, but there is no need for it. To keep the states and the reverse tracking through those states is needless.

By going the stateless route, the script can execute for any situation instantly... and with very little logic. The script will be smaller and simpler this way.


Example:


That is far simpler than his previous method, and it should work flawlessly. There is no need to backtrack through health states, there is no need to traverse states at all aside from loading up the HUDs the first time.

If he keeps his line that unshows the HUDs (and puts it ABOVE the lines I've just shown, along with the second colon), the script will only show the HUD that is necessary for the needed level of health.

The backtrack may barely be noticeable, but why would you put up with a flaw if the solution to it makes everything easier?


The one and only,


Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 8th Oct 2010 09:43
OK ply, I tried your idea but the problem is that it displays hud 20 and then does nothing else - it doesnt update.

Here is the script incase something else is wrong with it.



Thanks

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 8th Oct 2010 20:43
Yes, you did something wrong.
Quote: "If he keeps his line that unshows the HUDs (and puts it ABOVE the lines I've just shown, along with the second colon)"


What happened to that line? Put it just above the line for showing HUD 20... if you don't hide HUD 20 (and all of the other HUDs) it's just going to cover up the other ones, regardless of if they're showing.
Put it back in, and in the correct spot, and it will work.


The one and only,


Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 9th Oct 2010 04:26 Edited at: 9th Oct 2010 05:44
Quote: "Conjured Entertainment, I just tried your script and it did not work. Thanks though."

That wasn't my script as much as it was my edited version of your script.
I think I figured out why we were having a problem with it too.

Anyway, I whipped up 20 simple hud images so that I could test my edited version of his script, and it didn't work, but I finally got it to work with enough edits.
Although, I have the entity logic maxed out on high health levels using your method of the greater than on down, so I am going to try something else also.

Check it out in the video...


EDIT

I managed to get it working fine without pushing the red bar (entity logic) all the way up.

You can see in this
that I took Plystire's advice and made it all one state.

I decided to do a less than for removing (unshowing) the huds, then a greater than for showing them.
This way you can pick up health anytime and it will always display properly.
The other try I was unshowing them all whenever one was shown, hence red bar on high, but this way works much better.

If the player dies then I unshow all the huds but hHud0, which I used a skull to represent death.

Anyway try that one out, because I have tested it, and it works on my end, so I know it will work for you.
Don't forget to have the entity that is running it set as immoble, and strength at 0 for invulnerability, and always active set to yes so distance won't matter.

   Conjured Entertainment

 WARNING: Intense Madness

Attachments

Login to view attachments
Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 9th Oct 2010 19:07
OK Conjured Entertainment, I tried your script, and set it as the main for a light, however, when i say apply, it just dissapears from the light's main script. I do not know why because it does not do this with any other scripts.

Thanks.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 9th Oct 2010 23:08 Edited at: 9th Oct 2010 23:16
Quote: "when i say apply, it just dissapears from the light's main script. I do not know why because it does not do this with any other scripts."

Did you save as a text file with an fpi extension, and place it in the scriptbank folder?

Don't use a light.
Use something like I did, which was the battery from the scifi>items folder.
You can always hide it in a closet or something.
Lights need to operate as lights, and let the batteries run things.

   Conjured Entertainment

 WARNING: Intense Madness
Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 10th Oct 2010 09:21
Yes i did save it as an fpi (i made sure, checked, double checked, and triple checked. Also, when i set it to the main script of a box (dynamic, invincible and immobile) it shows the first hud and does not change.

Thanks.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 10th Oct 2010 20:39 Edited at: 10th Oct 2010 20:54
Quote: "Also, when i set it to the main script of a box (dynamic, invincible and immobile) it shows the first hud and does not change."

Did you also set the ALWAYS ACTIVE to YES??? (if not then it may not work if you are far away from the box)

What version of the engine are you using?

You do have an enemy character entity running down your health by shooting you, right?

Seriously, check your image paths and formats because I know this script works but I will test it again just to make sure I didn't post the wrong one.

Also, check the script itself to make sure you didn't accidentally leave something off during the copy/paste.

I tested this again, and it is working fine on my end using version 1.18.001 (Vista, 32 bit Quadcore, NVIDIA 8800gt)

   Conjured Entertainment

 WARNING: Intense Madness
Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 10th Oct 2010 21:07
Thanks CE, you are a legend and a life saver. no, i didnt have it always active, and now it works perfectly. just so you know, I had some enemies and high places to jump from, as well as explosives and health (and a health regeneration script). this works perfectly. Do you mind if i use it in my game?
Thanks a million!

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 10th Oct 2010 21:38
Quote: "Do you mind if i use it in my game?"

Oh, of course I mind, since this was just an example.



Naha! Just kidding. Of course you can use it; that's why I helped.

Do whatever you want with it, except modify it to make FPSC crash and then blame me.

   Conjured Entertainment

 WARNING: Intense Madness
Michael Thompson
16
Years of Service
User Offline
Joined: 15th Aug 2008
Location: Behind you (if not, in australia)
Posted: 11th Oct 2010 04:51
Lol ok, thanks a tonne, you are a life saver. I was originally going to release an alpha for this game to my small group of testers tomorrow and i didnt know if i would get this in, but now that you have given me a working one, i can have this in my game since the start, and I can release it tomorrow, as expected.
Thanks millions.

Windows 7 ultimate x64, Intel i7, 4 GB RAM, NVIDIA GEFORCE 330m 1GB
Flash Star Game Creations

Login to post a reply

Server time is: 2024-11-24 19:29:44
Your offset time is: 2024-11-24 19:29:44