Healing Circle Zone

Aerisetta

Active member
Hi all

I'm trying to create a healing circle that the player places on the ground, and periodically it will heal any player that stands in that zone. (Please see the pink circle below)

bor - 0037.png

Currently my healing circle is like this. How can I make increase player HP?
Ideally there is a healing zone in a width and depth X, Z axis
But even better is if there is height Y axis as well (or just player in the vertical gets healed even when jumping over it)

Code:
name        Heal
type        none
facing        1
palette        none
animationscript    data/scripts/prscript.c
lifespan    10

anim idle
 ################################################################ Princess Step ####
    offset    300 200
    delay 8
    loop 1
    drawmethod alpha 6
    drawmethod channel 0.7
    frame    data/chars/lisina/heal/heal01.png
    frame    data/chars/lisina/heal/heal02.png
    frame    data/chars/lisina/heal/heal03.png
    frame    data/chars/lisina/heal/heal04.png
    frame    data/chars/lisina/heal/heal05.png
    frame    data/chars/lisina/heal/heal06.png
    frame    data/chars/lisina/heal/heal07.png
    frame    data/chars/lisina/heal/heal08.png
    frame    data/chars/lisina/heal/heal09.png
 
Ah I just thought of something...

I could make the above object spawn an item that is auto picked up by the player that is a healing item (but invisible) that suicides shortly after spawning

Is there a better solution someone can think of? :)

EDIT:
I tried it has 1 major problem, I cannot add depth to the collision box
 
Last edited:
Okay I got it to work, the above item spawns this item every loop, which now moves quickly along the Z axis to try to hit the player and heal them as an auto pick up item lol.

It works, but if anyone else has any idea, please share.

Some extra things I would like
1. When it hits, there is a healing VFX + SFX that can play



Code:
name    Heal_Item
health    10
type    item
shadow    0
icon    data/chars/misc/applicon.gif
diesound        data/sounds/A_Death.wav
animationscript        data/scripts/player.c
lifespan    1
aimove chase

anim idle
 ################################################################ Princess Step ####
    offset    300 200
    delay 2
    drawmethod alpha 6
    drawmethod channel 0.7
    itembox    50 -300 500 500
    frame    data/chars/lisina/heal/heal01.png
    movez -10
    frame    data/chars/lisina/heal/heal02.png
    frame    data/chars/lisina/heal/heal03.png
    frame    data/chars/lisina/heal/heal04.png
    frame    data/chars/lisina/heal/heal05.png
    movez 10
    frame    data/chars/lisina/heal/heal06.png
    frame    data/chars/lisina/heal/heal07.png
    frame    data/chars/lisina/heal/heal08.png
    frame    data/chars/lisina/heal/heal09.png
    movez -10
    frame    data/chars/lisina/heal/heal02.png
    frame    data/chars/lisina/heal/heal03.png
    frame    data/chars/lisina/heal/heal04.png
    frame    data/chars/lisina/heal/heal05.png
    movez 10
    frame    data/chars/lisina/heal/heal06.png
    frame    data/chars/lisina/heal/heal07.png
    frame    data/chars/lisina/heal/heal08.png
    frame    data/chars/lisina/heal/heal09.png
    @cmd    suicide
 
@Aerisetta,

Item touching Z depth is actually controlled by the grabdistance property. That sounds weird, but a LOT of things are tied to grabdistance owning to backward compatibility with the original BOR.

Anyway, I'm not where I can post a lot of detail, but I would ditch the item box and set up a range instead. Ranges are similar to collision boxes in that you can specify the exact Z depth you want, and thus make an aura area around the item. Set your range cube up to roughly match the circle and there's your detection area. Academically you could script a cylinder shaped detection area to a perfect 1:1 match with your circle, but I promise players won't know the difference. Now all you need to do is make the item hostile to whatever types you want to heal (this helps simplify the next part).

You need a script function that enumerates the entity collection (there are tons of examples around for it). At each entity, you can run the native checkrange() function to see if the entity is within healing area. This is why you want the healing entity to be hostile to its healing targets. Otherwise you'd have to write your own range check routine and that's pretty involved. If an entity is in range, you can add some hit-points, spawn a visual effect, or whatever else. You can run this function as an update, an animation @cmd in the healing entity, or whatever best suits your module.

The process sounds complex in a post, but really it's far simper than what you're doing and will solve all the side effects you're wrestling with.

HTH,
DC
 
@Aerisetta,

Item touching Z depth is actually controlled by the grabdistance property. That sounds weird, but a LOT of things are tied to grabdistance owning to backward compatibility with the original BOR.

Anyway, I'm not where I can post a lot of detail, but I would ditch the item box and set up a range instead. Ranges are similar to collision boxes in that you can specify the exact Z depth you want, and thus make an aura area around the item. Set your range cube up to roughly match the circle and there's your detection area. Academically you could script a cylinder shaped detection area to a perfect 1:1 match with your circle, but I promise players won't know the difference. Now all you need to do is make the item hostile to whatever types you want to heal (this helps simplify the next part).

You need a script function that enumerates the entity collection (there are tons of examples around for it). At each entity, you can run the native checkrange() function to see if the entity is within healing area. This is why you want the healing entity to be hostile to its healing targets. Otherwise you'd have to write your own range check routine and that's pretty involved. If an entity is in range, you can add some hit-points, spawn a visual effect, or whatever else. You can run this function as an update, an animation @cmd in the healing entity, or whatever best suits your module.

The process sounds complex in a post, but really it's far simper than what you're doing and will solve all the side effects you're wrestling with.

HTH,
DC
Great! Thanks a lot, I'll probably need an example of it for reference, do you remember any game with it?

EDIT: I got it, works now thanks! :)

Definitely dont need to do the cylinder, i usually think being more liberal (making the area a bit bigger than the graphic) makes players happier
 
Last edited:
Back
Top Bottom