Scripts / Simple Quest NPC

Author
Message
surron
3
Years of Service
User Offline
Joined: 20th Feb 2021
Location:
Posted: 20th Feb 2021 04:53 Edited at: 20th Feb 2021 16:59
New to GameGuru, was having a hard time finding existing examples of an invulnerable quest npc that just talks to you by cycling through E. Feel free to use, modify, provide tips.

module_quest_npc.lua



Attach this to your entity
sample.lua

PM
bluemeenie195
6
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 20th Feb 2021 19:39
Thanks surron for the scripts
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 20th Feb 2021 20:10
@ surron
The script works fine, it is a good start point, thanks for sharing.
Anyway, I can't understand why do you want to check char health?
It is unnecessary here and might produce a lot of performance impact.
Although if for any reason you need the char being invulnerable, then you can check the char health once on the init section, pass this value to a variable, and work with this var.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
surron
3
Years of Service
User Offline
Joined: 20th Feb 2021
Location:
Posted: 20th Feb 2021 23:07
Thank you

I agree it does seem rather dumb but I wasn't finding a way to make someone invulnerable, searching around the forums this was suggested.

If I set a variable from g_Entity[e]['health'] in init wont it just be irrelevant in the future as g_Entity[e]['health'] will update while the variable is still the initial health?

Technically I'd prefer the entity to just be a regular object (like a box) that I animate with scripts, but it's an entity created from Character Creator so it has some extra properties - not sure if something in the .fpe file of the entity can make it as such while still allowing PlayAnimation to work.
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 20th Feb 2021 23:31
To make something/someone invulnerable you can go via entity properties panel>strength = 0
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
surron
3
Years of Service
User Offline
Joined: 20th Feb 2021
Location:
Posted: 21st Feb 2021 00:12
There must be more to it than that because he just dies in 1 shot now when Strength is set to 0
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 21st Feb 2021 11:15
Quote: "If I set a variable from g_Entity[e]['health'] in init wont it just be irrelevant in the future as g_Entity[e]['health'] will update while the variable is still the initial health?"

This doesn't matter when you make someone invulnerable/immortal.

Quote: "There must be more to it than that because he just dies in 1 shot now when Strength is set to 0"

You are right, there should be something misconfigured on your side, I tested it for you right now, and it works fine for me.
Do you change something on the fpe file?


Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 21st Feb 2021 15:06
Quote: "You are right, there should be something misconfigured on your side, I tested it for you right now, and it works fine for me."

setting characters to 0 HP doesn't make them invincible in the current version - no idea if this is intentional or not.
checking the health in the script isn't likely to cause much of a performance drain though
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
surron
3
Years of Service
User Offline
Joined: 20th Feb 2021
Location:
Posted: 21st Feb 2021 17:38
Hey 3com, thanks for testing it out and the video. My tests match what smallg is saying how 0 Strength isn't working in current version. I think your video is working because you've attached the script I provided to the entity thus the health check is making them invincible, or you're on an older version of GG?
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 21st Feb 2021 20:30
@ surron
You both are right, I've missed your script, now I changed it to default.lua, and yes, the soldier died at the first shoot.
Now make sense you checking char health. sorry, a lot of time does not work with GG.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
Medmatheus
Reviewed GameGuru on Steam
9
Years of Service
User Offline
Joined: 18th Oct 2015
Location:
Posted: 24th Feb 2021 13:24
Set entity health to 99999999 and remove blood effects
exadion
GameGuru TGC Backer
10
Years of Service
User Offline
Joined: 1st Nov 2014
Location:
Posted: 12th Mar 2021 03:18 Edited at: 12th Mar 2021 03:20
Don't mind me, but as I have checked health 0 isn't working in march updates. Still easy to make a invulnerable charicter though. Simply:


Shop1 changes to script name. Simple, disable blood if you want.
It respawns so quickly usually you can't tell it died.
PM

Login to post a reply

Server time is: 2024-12-22 01:47:01
Your offset time is: 2024-12-22 01:47:01