Multiple stages of pain

ABK

Well-known member
I want to do a barrel that gets destroyed mor and more with each hit, so 1 hit give it a scratch, next hit puts a hole and 3rd hit destroys it
What is the simplest most compact way to achieve this with single entity ? Last destroyed pic isnt included
I thought about storing entityvar and forcing more destroyued pain and idle each time but maybe with onpainscript not in animationscript as usual so the graphic change is immediate


barr.jpg
 
This is what I have when it comes to breaking obstacles into specific damages with animations, based on health points.

C:
name  floorcrash
health     30
nolife  1
antigravity 100
type obstacle
facing 1
death 1
nomove 1
noatflash 1
load floorcrashed

anim    idle
@script
    void self = getlocalvar("self"); //Get calling entity
    int MHP = getentityproperty(self, "maxhealth");
    int HP = getentityproperty(self, "health");

    if(HP < MHP*1){//20 < 30*1 = 30; 20<30
      changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
    }
    @end_script 
    loop    1
    delay    4
    offset    1 18
    bbox    0 0 33 18
    platform    1 18 -10 -10 33 33 18 18
    frame    Data/chars/misc/FloorCrash/1.png

anim    follow1
@script
    void self = getlocalvar("self"); //Get calling entity
    int MHP = getentityproperty(self, "maxhealth");
    int HP = getentityproperty(self, "health");

    if(HP < MHP*0.5){//10 <30*0.5 = 15; 10<15
      changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
    }
    @end_script 
    loop    1
    delay    4
    offset    1 18
    bbox    0 0 33 18
    platform    1 18 -10 -10 33 33 18 18
    frame    Data/chars/misc/FloorCrash/2.png
     
anim    follow2
    loop    1
    delay    4
    offset    1 18
    bbox    0 0 33 18
    platform    1 18 -10 -10 33 33 18 18
    frame    Data/chars/misc/FloorCrash/3.png

anim    death
    loop    0
    delay    4
    offset    1 1
    spawnframe    1 0 0 0 0 #spawnframe {frame} {x} {z} {y} {relative}
    custentity    floorcrashed
#    platform 1 1 1 1 1 1 1 1
    platform 1 1 0 0 0 0 0 0
    frame    Data/chars/misc/empty.gif
    frame    Data/chars/misc/empty.gif

C:
name  floorcrashed
#nolife  1
antigravity 100
type none
facing 1
nomove 1 0
lifespan 10000
setlayer 1

anim    idle
    loop    1
    delay    5
    offset    1 18
    frame    Data/chars/misc/FloorCrash/4.png

anim    fall
    loop    0
    delay    5
    offset    1 18
    frame    Data/chars/misc/FloorCrash/4.png

anim    death
    loop    1
    delay    5
    offset    1 18
    frame    Data/chars/misc/FloorCrash/4.png

This works when you give 10 damage points against this kind of obstacle.

Example:
Code:
anim    attack1
    delay    4
    offset    101 86
    bbox    88 43 23 43
    sound    data/Sounds/chain.wav
    @cmd    keyint "ANI_FOLLOW3" 0 "U" 0
    frame    data/chars/SimonB/13.gif
    bbox    88 43 23 43
    frame    data/chars/SimonB/14.gif
    bbox    88 43 23 43
    frame    data/chars/SimonB/15.gif
    attack10 69 30 99 28 10 0 1 0 0 0
    bbox    88 43 23 43
    frame    data/chars/SimonB/16.gif
    attack10 94 49 69 10 10 0 1 0 0 0
    bbox    88 43 23 43
    frame    data/chars/SimonB/17.gif
    attack10 88 48 97 12 10 0 1 0 0 0
    bbox    88 43 23 43
    frame    data/chars/SimonB/18.gif
    attack10 88 52 97 11 10 0 1 0 0 0
    frame    data/chars/SimonB/19.gif
    attack10 88 52 97 11 10 0 0 1 0 0
    frame    data/chars/SimonB/20.gif
    delay    2
    frame    data/chars/SimonB/21.gif
    frame    data/chars/SimonB/22.gif
    frame    data/chars/SimonB/23.gif
    frame    data/chars/SimonB/24.gif
    frame    data/chars/SimonB/25.gif
    frame    data/chars/SimonB/26.gif
    offset    100 86
    delay    1
    attack1 0 0 0 0 0 0 0 0 0 0
    frame    data/chars/SimonB/1.gif

I don't know if it would suit to your liking, but I believe it wouldn't.
 
Last edited:
@bWWd I made something like that long time ago, with facing support:
 
  • Like
Reactions: ABK
Back
Top Bottom