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 / I need help displaying 2 huds in order

Author
Message
King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 17th May 2011 02:18 Edited at: 17th May 2011 02:25
I'm still a beginner at scripting, so this script I've attempted might not even be close. *Prepares to be laughed at*

I want to apply this script to the main AI of a static entity:


What I'm trying to do is make a hud display itself when the player presses ENTER while looking at the entity the script is assigned to, also freezing the player in place. Then the player presses "T", and a different hud shows in place of the other one. I want the player to have to wait about 1 second before the second hud disappears when they press the ENTER button, and they can move again.

Also, everytime after that, whenever the player presses ENTER at the entity, I would like only the second hud to appear. I of course still want the player to freeze while it's on-screen. If all that's possible.

Of course the script's not working, and I've just about tried everything I can think of. Could someone please help me out?


EDIT: The original form of this script was offered to me by BlackFox a while back. Thanks for giving me a base I can work from BlackFox!

Cheers, Jake
------------------------------------------------------------
-The Clarkson Residence- (WIP)
Scientist101
14
Years of Service
User Offline
Joined: 31st Mar 2010
Location: Laboratory
Posted: 17th May 2011 02:40 Edited at: 17th May 2011 03:47
If the original form came from BlackFox, then you must have really changed it. One of the things that involves scripting and huds is that you need to define your huds in the :state=0 lines. I know this from his scripting work that defining the huds in the middle of the script is not the correct syntax.

For example, you should define your huds in the start like this:



Your steps should be like this:

1. Define the huds
2. Go from state=0 to state=1
3. Tell the script to display a hud when the player is at a certain distance from the entity (plrdistwithin=x) and freezes the player (plrfreeze=x). Plrfreeze allows the player to look around with the mouse.
4. Tell the script to unshow the first hud, show the second when player presses T.
5. Tell the script to wait for one second (using etimerstart/etimergreater=1000) once the Enter key is pressed, then unfreeze player.
6. Tell script when player moves away (plrdistfurther) from entity to then go to another state.
7. This other state will tell the script when the player is at a distance close to the entity (plrdistwithin=x) then show only the second hud.

That should help you with script writing. It is a great attempt, but your syntax is mixed up.

[ADDED] You will need to specify the plrfreeze command in the beginning, usually after the plrdistwithin condition, and also unfreeze the player. An example would be like this:

:state=5,plrdistwithin=60:plrfreeze=30000, <the rest of your script>

And towards the end have this:

:state=50:plrfreeze=0

This will unfreeze the player so they can continue on. If you plan to allow the player to come back and have the second hud only display, you need to loop your ending back to where your second hud is displaying.

Also... your script cannot go to a static entity. You need to make the entity dynamic, set IsImmobile to Yes. Dynamic only will run scripts attached like this.
King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 17th May 2011 05:46 Edited at: 17th May 2011 05:49
@Scientist101 I did everything you said, but when I walk up to the object, the hud appears and stays there. When I press "T" nothing happens. This is what I have:


I really appreciate you trying to help.

EDIT: I changed it a little in attempt to make it work, but no luck.

Cheers, Jake
------------------------------------------------------------
-The Clarkson Residence- (WIP)
Scientist101
14
Years of Service
User Offline
Joined: 31st Mar 2010
Location: Laboratory
Posted: 17th May 2011 06:44
No problem, mate. Going with your first post, the following script does the following:

1. Player approaches entity
2. Player presses ENTER, player is frozen on the spot and script does its thing...



As you can see, I have done the following:

1. Defined the huds (state=0 lines)
2. Defined the distance the player must be to the entity (state=1 line)
3. Frozen the player at that spot and displayed the first hud when ENTER is pressed (state=2 line)
4. Player presses T and the first hud disappears, then the second hud appears (state=3, state=4, state=5 lines)
5. Player presses ENTER and the second hud disappears (state=6 line)
6. Player is unfrozen (state=7 line)
7. Script waits until player is at a distance of 60 away from the entity (state=8 line)
8. Script waits until player is at a distance of 50 from the entity (state=9 line)
9. Player presses ENTER key and only the second hud appears, player is frozen (state=10 line)
10. Player presses ENTER, second hud disappears, and script loops back to step 6 (state=11 line --> loops to state=7 line)

So each time the player walks away and returns, only the second hud shows. Also remember to put this script in the entity's AI Main and set the entity to dynamic (some entities that are static by default and set to dynamic may need you to set IsImmobile to Yes to keep the entity from "bouncing" around when the level starts).

The player freeze time (plrfreeze=30000) is a 30 second freeze time. You can adjust to what you want. The distance within and further can also be adjusted.

Hope this will get you started mate.
King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 18th May 2011 01:15
The display of the huds works perfectly, thanks. I just have one problem though; I can still walk around while the huds are on-screen. The camera jitters a little at first, but I'm able to walk around perfectly. The huds stay on the screen and don't change or go away while I'm at a distance from the entity, I have to walk back over to it and then press ENTER or T and the huds will do what they're supposed to. Also, is there a difference between "plrfreeze" and "plrdisable"? I would like the player to not be able to walk OR look around, but still be able to change the huds with T and make the second one go away with ENTER, then re-gain control. I hate to be hassling you like this, and I have tried different things of my own to try and fix this issue, but as I said before, I'm still a beginner.

Cheers, Jake
------------------------------------------------------------
-The Clarkson Residence- (WIP)
Scientist101
14
Years of Service
User Offline
Joined: 31st Mar 2010
Location: Laboratory
Posted: 18th May 2011 05:18
Sorry, mate. I found a typo error in my script in the :state=9 line. I had a double colon on the line- my bad.

Here is the script:



I adjusted the original script and have tested it with the proper results. I attached to a dynamic entity, and renamed the TGA files to something I have on my system. When I approach the entity, I press Enter and the first hud shows; I also cannot move at all nor can I turn the player with the mouse (I replaced plrfreeze with plrdisable). I press T and the first hud disappears, and then the second hud shows. I press Enter and the second hud disappears and I can move again.
King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 18th May 2011 07:15
Thanks Scientist101, I really appreciate it!

Cheers, Jake
------------------------------------------------------------
-The Clarkson Residence- (WIP)
Scientist101
14
Years of Service
User Offline
Joined: 31st Mar 2010
Location: Laboratory
Posted: 18th May 2011 07:56
Quote: "Thanks Scientist101, I really appreciate it!"


No problem, mate. I can tell you do appreciate the help and seem eager to learn. That is why I am helping out.

Also forgot to mention, the script is set so if the player walks up the first time and leaves the entity, it will go back and wait until the player approaches and presses Enter. Also did the same when showing the second hud only. The player can approach and have the second hud display, leave, come back and the second hud only shows, leave, come back, etc... You get the pattern here, right?
King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 18th May 2011 09:19
Yes, I do. I'll use it to my advantage.

Cheers, Jake
------------------------------------------------------------
-The Clarkson Residence- (WIP)

Login to post a reply

Server time is: 2024-11-24 08:43:17
Your offset time is: 2024-11-24 08:43:17