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 / Entity X/Y/Z

Author
Message
Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 9th Apr 2012 05:48
Quick question: Are there commands that allow you to tap into an entity's x/y/z positions?

I want to do something very dead island-ish with huds in that when you get so close to an object a small hud pops up centered on the entity, rotating around the entity, telling you what to do (like press enter to examine, or press y to pick up, etc.). I just don't know if these commands exist. Either 118 or 119 compatible preferred.

If someone knows, great. If not, then I guess I'm off to see if I can figure out how to do this without them.

Priest of the Church of Joe Wood

In memory of Nanee. 9/1/1993 - 5/16/2009. Rest in Peace, little girl.
maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 9th Apr 2012 05:58 Edited at: 9th Apr 2012 05:59
i think you can use alternative textures, standard-huds and playdist-commands to do this, like with blinking lightbulbs. but dont ask me how to setup them, i dont know.^^

The Zombie Killer
13
Years of Service
User Offline
Joined: 27th Mar 2011
Location: Gold Coast, Australia
Posted: 9th Apr 2012 06:26
@Leon Kennedy
V1.19

Variables:
$EAX = Entity Angle X
$EAY = Entity Angle Y
$EAZ = Entity Angle Z
$EPX = Entity Position X
$EPY = Entity Position Y
$EPZ = Entity Position Z

Commands:
setcamoffsety = Entity Offset Y
setcamoffsetz = Entity Offset Z
setcamoffsetx = Entity Offset X

Hope this helps

-TZK

Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 12th Apr 2012 18:26
Ok, so I downloaded and installed 119, and I created the following simple script as a test to see if I can get the HUD to work. Remember, this is very basic and only a test.


So I walk up to the object, and....nothing. No HUD displays at all. And yes, I put this in the MAIN for an entity in a test level.

Did I do something wrong? Should I be using the cameraoffset commands instead of $EPX/Y/Z?

Priest of the Church of Joe Wood

In memory of Nanee. 9/1/1993 - 5/16/2009. Rest in Peace, little girl.
rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 12th Apr 2012 21:37
If I understand what you want to do it would be simpler to create a hud and use pickobject= and plrdistwithin=.
You could even spawn a small animated entity above the object using the same conditions, whichever, keep it simple.

Awesome! Its one of those threads.
Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 13th Apr 2012 00:29
Is there a snippet of code available somewhere that I could peruse to see how these are used? I'm not familiar with the pickobject command. But if that's the way to get it accomplished, I'd like to see a script with it being used so I can see if I can figure out how to implement it that way.

Priest of the Church of Joe Wood

In memory of Nanee. 9/1/1993 - 5/16/2009. Rest in Peace, little girl.
rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 13th Apr 2012 01:25 Edited at: 13th Apr 2012 01:51
pickobject=1 is a condition.Means the object is center screen, I would use plrdistwithin=150 so it doesn't trigger too far away. Using pickobject means whatever you want to happen only does when facing the object and its...well...centered.
I personally would go with an entity spawn/destroy using these...you could use a simple cylinder with alpha channel text which rotates above the object (better looking than a hud which would not look 3d or part of the scene) when spawned/hidden.

Quick example:

:state=0,plrdistwithin=100,pickobject=1:hudshow=

I would use this to show hud or spawn the floater object, same conditions to remove and probably a keypress to pick up and at same time to remove the floater or hud, depending on which you go with.

The script idea above would go in the target object. If you are spawning a floater entity it would have its own activated= script and the target object would have 'floater' in ifused. I cant explain it much further without actually writing the scripts and creating the objects for you but I hope it gives you the idea.

Here is an example script for health boost when within distance and using pickobject, hold right mouse button to use. You can drop this into any object. Just create an image called healthfull.tga and put in appropriate file path to use it.


Although the hud in this case only shows after health is full it should point you in right direction.

Awesome! Its one of those threads.
Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 13th Apr 2012 06:11
Didn't work. Code now looks like this:



But the HUD still does not display.

What I'm trying to do, to be explicit, is to get a hud to display in the center of the object. I want to use a hud something like Dead Island, where when you come within so far of an object a little thing pops up that gives you the option to examine or pick up the object. But for that I'm dependent on the x/y/z coordinates of the object, and using the variables didn't work either.

Anybody that can show me what I'm doing wrong here? Am I interpreting rolfy's help incorrectly? Am I using the variables $EPX/Y/Z wrong?

Priest of the Church of Joe Wood

In memory of Nanee. 9/1/1993 - 5/16/2009. Rest in Peace, little girl.
The Zombie Killer
13
Years of Service
User Offline
Joined: 27th Mar 2011
Location: Gold Coast, Australia
Posted: 13th Apr 2012 13:42
I would say that the solution to your problem would be to use decals.

-TZK

Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 13th Apr 2012 15:31
tzk: Something I didn't even think of. I may have to turn my DDS images into decals and see if that works.

Question on that: Can you display and hide decals in the same way you display and hide HUDs? Also, if the decal is displayed, will it rotate around the entity if the player rotates around the entity?

Hmm...I'll have to give this a go and see what happens...

Priest of the Church of Joe Wood

In memory of Nanee. 9/1/1993 - 5/16/2009. Rest in Peace, little girl.
The Zombie Killer
13
Years of Service
User Offline
Joined: 27th Mar 2011
Location: Gold Coast, Australia
Posted: 14th Apr 2012 04:19
@Leon Kennedy
I actually don't know if you can hide decals at will. But in v119 you should be able to, by using the "hide" and "show" commands. And decals always rotate to the player, so you will always see the same thing no matter what direction you look at the entity.

-TZK

Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 14th Apr 2012 05:43
ok, so then how does one make a decal? I've searched, but if there's a topic on it I am blind.

Priest of the Church of Joe Wood

In memory of Nanee. 9/1/1993 - 5/16/2009. Rest in Peace, little girl.
The Zombie Killer
13
Years of Service
User Offline
Joined: 27th Mar 2011
Location: Gold Coast, Australia
Posted: 14th Apr 2012 06:01
@Leon Kennedy
I actually have no idea, try looking at the stock decals.

-TZK

Marc Steene
FPSC Master
18
Years of Service
User Offline
Joined: 27th Mar 2006
Location: Bahrain
Posted: 14th Apr 2012 13:23
Quote: ":state=0:hudreset,hudx=50,hudy=60,hudimagefine=gamecore\huds\Testing\ExamineObjectHUD.tga,hudname=ExamineObject,hudhide=1,hudmake=display,state=1
:state=1,pickobject=1,plrdistwithin=150:hudshow=ExamineObject
:state=1,plrdistfurther=150:hudunshow=ExamineObject"


You should debug this script to see where it's going wrong because it looks fine to me. Make sure the entity with the script is dynamic and set to always active, and that it is the only object in the level with that script (multiple objects with that script will result in the HUD being forced to unshow).


Specs: Alienware M17x R3. i7-2630QM. 8GB RAM. Nvidia 560m. Momentus XT Hybrid Drive.
Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 14th Apr 2012 17:42
@tzk: I will have to do that to see if I can figure it out.

@marc: The thing is that I tested this script in a very simple level - 9 ground pieces, 1 dynamic object, and the player. The script was set to be the main for the entity, and yet it never worked in any incarnation that I've posted here. I just upgraded to 119, so I am going to test a HUD script that I know works to make sure that everything is kopasetic.

I know that there is a pdf out here that has a listing of all the new commands that are available in 119, but I haven't seen a document that shows how to actually use them. Anybody know if that exists so I can peruse?

Priest of the Church of Joe Wood

In memory of Nanee. 9/1/1993 - 5/16/2009. Rest in Peace, little girl.
Marc Steene
FPSC Master
18
Years of Service
User Offline
Joined: 27th Mar 2006
Location: Bahrain
Posted: 14th Apr 2012 17:51
Quote: "I know that there is a pdf out here that has a listing of all the new commands that are available in 119, but I haven't seen a document that shows how to actually use them. Anybody know if that exists so I can peruse?"


http://forum.thegamecreators.com/?m=forum_view&t=180924&b=23

If that script doesn't work it must be an issue with the HUD - does it display if you just have the condition set as always?


Specs: Alienware M17x R3. i7-2630QM. 8GB RAM. Nvidia 560m. Momentus XT Hybrid Drive.
Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 15th Apr 2012 20:09
Ok, so I took a look at what I had going on with the entity, and it was NOT set to always active as I thought it was. Changed that (and just to make sure I checked to make sure it was dynammic), and the HUD works. It doesn't work the way I want it to, but it DOES display.

So I went back into the FPI file and changed it to be back to its original state: HUDX=$EPX, HUDY=$EPY, HUDZ=$EPZ. Tested again, and...nothing. Did not display at all.

I looked through the link Marc provided in his last post, and although this is a wonderful resource, it only gives me what I already knew about the internal variables - $EPX = entity x position, $EPY = entity y position, $EPZ = entity z position. But it doesn't give an example of how to use them. *sigh*

At this point, I'm wondering if making this HUD an actual decal might be the best option here. I know I could alter the FPE file, but I'm not sure what command needs to be added in there. Is it DECAL=[insert path]? If so, how does one hide/show the decal in a script?

Priest of the Church of Joe Wood

In memory of Nanee. 9/1/1993 - 5/16/2009. Rest in Peace, little girl.
Marc Steene
FPSC Master
18
Years of Service
User Offline
Joined: 27th Mar 2006
Location: Bahrain
Posted: 15th Apr 2012 22:10
You can't use variables with the hudx, hudy, and hudz commands. I believe you can use them with the sethudx=X Y commands etc. but you'll have to test. Also, hudz doesn't do anything as of now.

Steer clear of decals, they'll cause you nothing but trouble.


Specs: Alienware M17x R3. i7-2630QM. 8GB RAM. Nvidia 560m. Momentus XT Hybrid Drive.
Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 16th Apr 2012 23:26
Marc - Didn't work. I took hudx/y/z and used sethudx/y/z and nothing displayed. Bummer.

I guess I'm going to have to either re-think what I want to do here, or use decals.

Priest of the Church of Joe Wood

In memory of Nanee. 9/1/1993 - 5/16/2009. Rest in Peace, little girl.
Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 19th Apr 2012 04:03
Well, I can't figure out how to make decals. And I can't get sethudx/y/z to be set by using the internal variables. *sigh*

So my next idea is to use a marker of some kind that hovers above/near entities that can be examined or picked up, and then it disappears when the player does whatever they need to do. I just have to find the right marker to use. Anybody have any suggestions?

Priest of the Church of Joe Wood

In memory of Nanee. 9/1/1993 - 5/16/2009. Rest in Peace, little girl.
rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 19th Apr 2012 18:18
Since your trying to do this based on something you have seen in another game can you post a screenshot?
This doesn't sound too difficult.

Awesome! Its one of those threads.
Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 20th Apr 2012 04:41
Well...

I couldn't find a picture of exactly what I'm talking about, but the following from Dead Island is close. You'll notice that Richard Crane has his name above him when you are close enough. I'd like to mirror this in FPSC, but as you can see from all of the above posts I am having MAJOR difficulty doing it with a HUD.

Any help here would be hot.



Priest of the Church of Joe Wood

In memory of Nanee. 9/1/1993 - 5/16/2009. Rest in Peace, little girl.
The Zombie Killer
13
Years of Service
User Offline
Joined: 27th Mar 2011
Location: Gold Coast, Australia
Posted: 20th Apr 2012 06:27
@Leon Kennedy
I thought this was what you wanted to do, and all I can say is, a HUD is the complete WRONG way to do this. You must attach a decal to the character. I'll provide a test script here for you, but it won't have the 'attach to character' part yet.



I'll try and find out how to make a decal later.

-TZK

rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 20th Apr 2012 11:06 Edited at: 20th Apr 2012 11:15
Quote: "when you get so close to an object a small hud pops up centered on the entity, rotating around the entity, telling you what to do (like press enter to examine, or press y to pick up, etc."

I had the impression you wanted to attach to an object, I do have this working for you and its not a decal (which would be easy enough to make).
This is a rotating entity which appears when the object is within distance and centered in the screen, you can use the right mouse button to pick up the object/weapon and the floater is destroyed after pickup, you can change the button to suit yourself.
Ignore my texture you can easily create your own text images for this.
If you wanted these to appear above a character I believe there is a new function for attaching an entity to another in latest versions, though I am not sure about characters as I haven't looked at it yet.
I don't have time to be making a video or packing it all up for you right now but will get on it tomorrow.
This is far more 3d and better looking than a hud or a decal and easier to edit for you.
Uses two scripts, one for the pickup object and one for the rotating floater, since weapons dont have an ifused field in the map editor I had to write it into the .fpe but its easy enough to do.


Awesome! Its one of those threads.
Mr Game
15
Years of Service
User Offline
Joined: 11th Feb 2009
Location: Under Your Skin
Posted: 20th Apr 2012 13:02
Simply and the best solution You made Rolfy.



Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 20th Apr 2012 15:23
Rolfy, that's exactly what I was going for. Leave it to you to figure out how to do it.

I don't expect you to just give this away for nothing, so what would you take in trade for it?

Priest of the Church of Joe Wood

In memory of Nanee. 9/1/1993 - 5/16/2009. Rest in Peace, little girl.
rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 20th Apr 2012 20:49 Edited at: 20th Apr 2012 21:58
Ok sent the files to you.
I have included a small map with it working for you.
I have also included a modified scifi assault rifle as the object you want to pick up must have an ifused field which cant be done in the map editor with weapon pick ups (even if you write it into the fpe it still wont appear in editor)

This line should be put into any object .fpe you want to use as a pickup.
;AI Automated
ifused = floater text

Just open the assault rifle .fpe I provided to see where to put it.

You can call the floater object whatever you like as long as its matched in this line. I have set it use right mouse button to pick up, change to what suits you.

Its a pretty cool idea and I can see you having a lot of uses for this.

Vid:


Quote: "I don't expect you to just give this away for nothing, so what would you take in trade for it?"

Your firstborn and access to all your bank accounts.

Awesome! Its one of those threads.
Leon Kennedy
16
Years of Service
User Offline
Joined: 7th Sep 2008
Location: Neither here nor there
Posted: 20th Apr 2012 23:27
un-freaking-believable. thanks man - I seriously owe you.

Priest of the Church of Joe Wood

In memory of Nanee. 9/1/1993 - 5/16/2009. Rest in Peace, little girl.
unfamillia
14
Years of Service
User Offline
Joined: 26th Jul 2010
Location: Preston, Lancashire
Posted: 12th Jul 2012 19:30 Edited at: 12th Jul 2012 19:32
@rolfy

Is this limited to Leon's use only? I have just read through the the thread and became excited by the results.

I don't think i still understand exactly how you achieved such a result. I would like this very muchly.

Quote: "Your firstborn and access to all your bank accounts.
"


I can offer my second born and access to two of my bank accounts....

Unfamillia

[url=www.touchoffear.webs.com][/url]
rolfy
18
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 12th Jul 2012 22:31
Quote: "I can offer my second born and access to two of my bank accounts...."

That'll do it.

Don't see why not......attached.

Awesome! Its one of those threads.

Attachments

Login to view attachments
unfamillia
14
Years of Service
User Offline
Joined: 26th Jul 2010
Location: Preston, Lancashire
Posted: 13th Jul 2012 01:17
Quote: "Don't see why not......attached."


Very Kind of you Rolfy.

Thanks you very much.

Unfamillia

[url=www.touchoffear.webs.com][/url]
maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 13th Jul 2012 10:29
very cool idea, rolfy, and easy to work on for further use.

thanks, you are a true master (as if we didnt know that before )

Login to post a reply

Server time is: 2024-11-23 21:30:42
Your offset time is: 2024-11-23 21:30:42