Lua Question

Status
Not open for further replies.

Xkower8181

Member
So can a a object increase it's SpawnHealth by colect a ring (i know that colecting the ring by other object is possible but i don't know that increasing SpawnHealth is possible)?
So yeah that whole question.
 
Are you asking about whether a non-player object could collect a ring and increase its current health, like a player does? I am assuming this is for your NPCs.

It is possible with the hook MobjMoveCollide.

addHook("MobjMoveCollide", function(mo, touched)
if mo.z > (touched.z + touched.height) or touched.z > (mo.z + mo.height) or touched.health == 0 or mo.health == 0 or touched.type != MT_RING then return end
mo.health = $1 + 1
P_KillMobj(touched)
end, [the MT name of your NPCs])
EDIT: Wrote the code for you 'cause I'm nice.

Also, keep in mind SpawnHealth only affects spawning- ie, when you put the object in a level. It's different to an object's actual health, which is what we're changing here.
 
Last edited:
This is possible, but I don't know for LUA only for SOC...
Just paste this...

Code:
MT_PLAY
SPAWNHEALTH = X

There, PLAY means any enemy's name and the X means any no. of health. (You need to make states for the health more than 1.)

If I understood you wrong then sorry...
 
That wouldn't work anyway, Wagon; you need to start with "Object MT_OBJECTTYPE" at the top rather than just "MT_OBJECTTYPE" on its own.

That said, yeah, Xkower actually means to modify the Object's current health rather than SpawnHealth (which actually just tells the game what health to give an Object of that type when it first spawns, hence the name "Spawn Health").
 
Are you asking about whether a non-player object could collect a ring and increase its current health, like a player does? I am assuming this is for your NPCs.

It is possible with the hook MobjMoveCollide.

*code here*

EDIT: Wrote the code for you 'cause I'm nice.

Also, keep in mind SpawnHealth only affects spawning- ie, when you put the object in a level. It's different to an object's actual health, which is what we're changing here.
Thanks Toaster alot also I will contact LJ Sonik who's sometimes good friend so yeah thanks.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top