Scripts / Prompt ai health

Author
Message
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 29th Feb 2020 10:10
HI all i know it has been done some were long time back just cant find it again.
How do you prompt the health of an Ai_soldier.
and were do you put the prompt command , in the ai_soldier script or in module_combatcore

Any one know were i can find it.
any help would be awesome.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Feb 2020 10:39
Just put:
PromptLocal( e, g_Entity[ e ].health )
in the ai_soldier script.
Been there, done that, got all the T-Shirts!
PM
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 29th Feb 2020 13:44
AmenMoses, thanks, its working nicely
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 29th Feb 2020 14:38 Edited at: 29th Feb 2020 15:00
Sorry for all the dumb Questions.
here is another one.
if i use : PromptDuration("KIll",3000) how do i get the text "kill" in red letters.?
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Feb 2020 16:16
Don't think you can change the Prompt colour.

You can use TextColor(x,y,size,txt,r,g,b) instead.

x & y are in % of screen, so 50,50 would be in the middle of the screen, 10, 10 would be up in the top left etc.

Try:
TextColor( 45, 80, 1, "Kill", 255, 0, 0 )

You'll need to handle the duration of display yourself.
Been there, done that, got all the T-Shirts!
PM
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 29th Feb 2020 16:47
@AmenMoses, thanks , i will try this and make a plan for the delay of text display.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 29th Feb 2020 23:59
Ok, i have mod the ai_soldier.lua script

with this mod it works fine i can get Npc health after a hit and prompt it ( even if i am outside the ai view range. see pic below

the problem i have with this mod is when there is an entity between me and the Npc then you still see the
heath prompt, witch i don't want. see pic below


if i add something like this ( if g_Entity[e]['plrvisible'] == 1 ) in the script to stop it from displaying the health prompt when Npc is behind an entity

It works fine, but then it does not display the the health prompt if i am outside the Npc view range meaning then it only display the health prompt if the npc is looking at me not me looking at the Npc

Is there any other command i can use except these two because they don't work
g_Entity[e]['plrvisible'] == 1
GetEntityPlayerVisibility(e) == 1

Thanks for any help.
Pcs
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st Mar 2020 00:01
Yep, raycast from the AI back to the player and if anything is in the way suppress the prompt.

IntersectAll is the command you want btw.
Been there, done that, got all the T-Shirts!
PM
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 1st Mar 2020 00:05 Edited at: 1st Mar 2020 12:13
Slowly now AmeneMoses i do not know how the raycast function works , or the IntersectAll
Please explain

edited.

Ok i have figure it out got right with raycast used these two fucntions.::
RayTerrain(x1,y1,z1,x2,y2,z2)
IntersectAll(x1,y1,z1,x2,y2,z2,obj)
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 9th Mar 2020 04:14
I have a related question (should be simple so just hijacking this thread)

g_Entity[e]['obj'] = returns object number
I need to raycast and find the *entity* number. Looking all through globla.lua
for something like ray = g_Object[e]['ent'] LOL! so that the object number gets
translated into an entity (e) number-- from raycasting, etc. for to find
the health; g_Entity[e].health

Thanks.
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 9th Mar 2020 10:24
Quote: "g_Entity[e]['obj'] = returns object number
I need to raycast and find the *entity* number. Looking all through globla.lua
for something like ray = g_Object[e]['ent'] LOL! so that the object number gets
translated into an entity (e) number-- from raycasting, etc. for to find
the health; g_Entity[e].health"

'e' is the entity number
so
if ray == e then
thishealth = g_Entity[e]['health']
end
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 9th Mar 2020 10:48
Physlib has a function to return the entity id from the object id.

Can't be called in the _init function though as it needs all entities to have been created before it is called for the first time.
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 9th Mar 2020 17:34
Thanks for the tips guys.
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 10th Mar 2020 01:38
@ AmenMoses
I tried this, and didn't get it to pass the nil mark

lookahead = IntersectAll(thingx, thingy, thingz, newthingx, newthingy, newthingz, g_Entity[e]['obj'])
entnumber = P.ObjectToEntity( lookahead )
if entnumber == nil then entnumber = 9 end --------Arbitraty flagging #

Text(22,22,3,"entnum; "..entnumber) ===>> '9' -- always even though
a test reveals that lookahead becomes an object number.......

Also have ;;; local P = require "scriptbank\\physlib" before init
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 10th Mar 2020 19:57
Is the object being detected static?

Static objects aren't given an entry in the g_Entity list!

Means that you can't do anything useful for static entities, like get the name of them for example.
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 10th Mar 2020 22:15
Sorry, AmenMoses. I think I tried both?? Maybe not?!
Anyhow, what I left yesterday as not working, today is working!
I guess GG and or the computer needed a reboot! So thanks.
PM
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 10th Mar 2020 23:56 Edited at: 11th Mar 2020 02:44
ok this script works halfway.

it works half way because if you die, then while the red screen is on for a couple of seconds you can see how the script moves the ai to the start position, and at the same time is bouncing back at the position it was when you died.

can anyone just test it and see if they can see the same result as me.
also when you use more than one ai , it looks then as if not all of them are being moved back to the start point.


edit::::::::
My apologizes this was posted in the wrong thread.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 11th Mar 2020 00:37 Edited at: 11th Mar 2020 00:39
Been there, done that, got all the T-Shirts!
PM
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 11th Mar 2020 02:14 Edited at: 11th Mar 2020 02:45
thanks AmenMoses,
i have tested this script , there is no errors, but Npc's do not move they stay on one place if they walk or run.
video will follow.

edit::::::::
My apologizes this was posted in the wrong thread.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 11th Mar 2020 02:40
sorry last two post from me was in the wrong thread. lol
im getting old. sorry.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11

Login to post a reply

Server time is: 2024-04-19 20:16:20
Your offset time is: 2024-04-19 20:16:20