Scripts / [SOLVED] Quest market on NPC like warcraft

Author
Message
Jnick
8
Years of Service
User Offline
Joined: 10th Feb 2016
Location: U.S.A.
Posted: 16th Jul 2020 23:03 Edited at: 16th Jul 2020 23:04
I have tried several things to get a marker to float over an NPC's head and can't get it to work. I can get it to appear over their head only if I am looking directly at them, but if they are off to one side it will not appear. How do I tie an image to an NPC so it stays over their head when triggered?

The author of this post has marked a post as an answer.

Go to answer
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 17th Jul 2020 04:05
What are you using for a marker?
Is Always Active set to "yes"?
Are you using the NPC's x,y,z coordinates?
Is that marker scripted to always face player?
PM
Jnick
8
Years of Service
User Offline
Joined: 10th Feb 2016
Location: U.S.A.
Posted: 17th Jul 2020 05:06 Edited at: 17th Jul 2020 05:47
What I can get to work is to paste an exclamation mark sprite to the location above the head of the NPC while it is in the center of the screen, but when the angle is changed or you move it does not stay at the same location over the head but just in the center of the screen, it isn't tied to the NPC just to that location in space. I can't figure out how to tie it to the location over the head of the NPC so it follows them when you move or they do.

I have yet to find any script that does this. All text or text boxes , effects, sprites that I have found in any quest script are simply placed on the screen over the NPC while they are in talking range in center of the screen. No script I have been able to figure out or find will place an effect, sprite, or text over an NPC and follow them around like a halo.
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 17th Jul 2020 10:02
use the stock radar script as a guide, it has the logic you will need.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Jnick
8
Years of Service
User Offline
Joined: 10th Feb 2016
Location: U.S.A.
Posted: 17th Jul 2020 15:30
Thanks for the reply,

I was looking at that script also, but it places a marker on the radar map but not on the NPC when you are looking at it. I am currently checking out your script for light_npc that attaches a light to the NPC that stays with them as they walk around to see if I can use this to attach a sprite or text to them over their head.

A lot of games use a name plate function to show hit points, name and other information that follows the NPC around over the entity. That function is not in the game guru global. It is getting interesting to figure out how to get that to work.
PM
Jnick
8
Years of Service
User Offline
Joined: 10th Feb 2016
Location: U.S.A.
Posted: 17th Jul 2020 16:16 Edited at: 17th Jul 2020 18:11
Interesting enough in multiplayer when someone else approaches you they have a health bar above their head. How can I apply this effect in single player to an entity.

It may be possible to use the script that powers that effect to do what I am trying to get done.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 17th Jul 2020 18:47 Edited at: 17th Jul 2020 18:50
Attach a script to a decal that positions it above the entity.

Decals are effectively a sprite rendered in the 3d World.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 17th Jul 2020 19:53
ah i was thinking you wanted like a little marker at the top of the screen to point to the NPC but you want a marker above the NPC to more easily show he is the NPC of importance... as amen says, this is more easily done with decals not sprites... it will get blocked by objects in the way and likely cut off by the camera at long range but should work ok and you only really need a script to show / hide the decal at the desired times (i.e. if the quest is active or not)

to do it with sprites in GG would require a lot of maths to work out the 3D to 2D conversion (it's not simple as you need to take into account distance, camera depth and fov) and just isn't really worth it though you could check out amens mouse-click-and-move type script which will have the same sort of logic.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Jnick
8
Years of Service
User Offline
Joined: 10th Feb 2016
Location: U.S.A.
Posted: 17th Jul 2020 21:58 Edited at: 17th Jul 2020 22:01
Thanks for the script, but I cant get the health script to do anything or maybe i'm using it wrong. I place an npc and then place the decal with this as the main script, the decal just stays in one spot. Checking the lua the function AI_Attach_health_bar is not referenced in the script, is there another script you have running that refers to that function?

It looks like I need access to the same location information that PromptLocal uses to track the NPC around. Checking the forums several others have mentioned trying to get that information also. If you could just get the prompt to show above the entity instead of below it that tracking is what i'm after. I'm going to try to work with that function to see if I can find a way to use it.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 17th Jul 2020 22:33
The AI_Attach_health_bar function has to be called from the ai script so you need to add a line to your ai script to call it.

Also this was just to show you how I did it, you will need to adapt it for whichever decal you are using to make it usable.
Been there, done that, got all the T-Shirts!
PM
Jnick
8
Years of Service
User Offline
Joined: 10th Feb 2016
Location: U.S.A.
Posted: 18th Jul 2020 00:27 Edited at: 18th Jul 2020 00:35
Oh Well,

Looks like there is no current way to do what I was trying to do. Guess that's why no one has done it lol.

Going to change direction and look into making a custom HUD, that when looking at an entity will show any special information that I was trying to show over it's head in a special panel.
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 18th Jul 2020 16:27
This post has been marked by the post author as the answer.
"Going to change direction and look into making a custom HUD"
Nice. Sounds like a good plan, but this request is easy enough.
The trickier part is to get one that rotates in a circular path while
still following the character-- done that.

Personally I wouldn't work with or change up the AI script at all,
but just have the marker scripted to follow the character.
PM

Login to post a reply

Server time is: 2024-12-22 02:48:55
Your offset time is: 2024-12-22 02:48:55