Page 1 of 1

Health pickups

Posted: Mon Dec 23, 2013 11:25 pm
by Faad3e_
Is there anyway for a health pickup to act as a % instead of a constant?

Example:
I have 9 classes in my mod, each class with diferent HP, can i make a pickup that restores 50% of the HP? so for a class that haves 125 maxHP it restores 62.5HP and for a class that haves 200 maxHP it restores 100HP?

RE: Health pickups

Posted: Mon Dec 23, 2013 11:53 pm
by agaures
Something like:

Code: Select all

Health Player.MaxHealth / 2

RE: Health pickups

Posted: Tue Dec 24, 2013 12:26 am
by Ijon Tichy
health only accepts a numerical value
I hope you like acs, because you'll need it for this

also is this perchance a tf2 mod

edit: I figured him out and now he won't return

RE: Health pickups

Posted: Fri Dec 27, 2013 7:19 pm
by Faad3e_
Ijon Tichy wrote: health only accepts a numerical value
I hope you like acs, because you'll need it for this

also is this perchance a tf2 mod

edit: I figured him out and now he won't return
Hmm, quite clever are you, yeah, i wanna do sth like a mix between TF2 and a modern FPS (with Aim down scope and that stuff)

RE: Health pickups

Posted: Tue Dec 31, 2013 11:39 am
by Lollipop
If you know the percentage each class will obtain from the pickup (if you know that the scout will get x amount of hp and the spy will get the y amount), then you can make a "fake" health item, like so:
Spoiler: code (Open)
actor fakemedikit : pickup
(stuffs here)
states:
pickup:
ASDF 0 A_JumpIfInventory("is_spy", 1, "spyhealth")
ASDF 0 A_JumpIfInventory("is_scout", 1, "scouthealth")

spyhealth:
ASDF 0 A_GiveInventory ("health", 15)

scouthealth:
ASDF 0 A_GiveInventory ("health", 25)
When you are making something like a tf2 thingy, I take it for granted you already know DECORATE to such an extent, that you actually understand the code I have spoilered for you.

RE: Health pickups

Posted: Tue Dec 31, 2013 11:03 pm
by Faad3e_
Lollipop wrote: If you know the percentage each class will obtain from the pickup (if you know that the scout will get x amount of hp and the spy will get the y amount), then you can make a "fake" health item, like so:
Spoiler: code (Open)
actor fakemedikit : pickup
(stuffs here)
states:
pickup:
ASDF 0 A_JumpIfInventory("is_spy", 1, "spyhealth")
ASDF 0 A_JumpIfInventory("is_scout", 1, "scouthealth")

spyhealth:
ASDF 0 A_GiveInventory ("health", 15)

scouthealth:
ASDF 0 A_GiveInventory ("health", 25)
When you are making something like a tf2 thingy, I take it for granted you already know DECORATE to such an extent, that you actually understand the code I have spoilered for you.
Whoa, havent though about that, and yeah, i know decorate :P, thanks a lot sir, you really helped me out

EDIT: In case anyone needs it, i made the code here
Spoiler: code (Open)
actor IS_Soldier : Inventory
{
inventory.maxamount 1
}

actor IS_Scout : Inventory
{
inventory.maxamount 1
}

ACTOR SmallHealthkit : CustomInventory
{
Inventory.PickupMessage "Picked up a health kit"
States
{
Spawn:
STIM A -1
Stop
Pickup:
ASDF A 0 A_JumpIfInventory("is_scout",1,"scouthealth")
ASDF A 0 A_JumpIfInventory("is_soldier",1,"soldierhealth")

ScoutHealth:
ASDF A 0 A_GiveInventory("healthbonus2", 31)
stop
SoldierHealth:
ASDF A 0 A_GiveInventory("healthbonus2", 50)
stop
}
}

In order for this to work, you have to give the "IS_Soldier" item or "Is_Scout" item for your class

Hope this helps someone