Custom Rolldrum

dantedevil

Well-known member
I'm working in a special rolldrum for a boss, this rolldrums has a special behavior

Here are some tips of the behavior that I want to have:

1) As you see has 20 health, so when you hit with a simple blow the drum perform the fall a turn the opposite direction. But now can hit enemies and obstacles.

2) I you hit them with an attack of 20 or more, the drum it will be directly destroyed.

3) If the drum hit an enemy or an obstacle during play fall, it will be directly destroyed.

Code:
name		Rollhdrum
health	        20
type		enemy
subtype         arrow
gfxshadow       1
score           1000
hostile	player
candamage	player obstacle
noquake  	1
nolife  	1
flash		flash
noatflash	1
#nodieblink	2
offscreenkill 200
diesound 	data/sounds/klunk.wav
subject_to_hole 1
no_adjust_base  0
speed  10
cantgrab 1
falldie  1

#palette data/chars/misc/obstacles/drum00b.png

defense normal44 0 200 01
defense normal45 0 200 01

anim spawn
        loop    0 
	offset	42 52
        bouncefactor 2
        landframe 2
	bbox	2 -20 77 79
	hitfx    data/sounds/klunk.wav
	hitflash  flash
        jumpframe 0 0.5 1   
        attack13  2 0 77 59 10 1 1 0 0 15
	delay	10
        frame	data/chars/misc/obstacles/rldrum01.png
	delay	999
        frame	data/chars/misc/obstacles/rldrum01.png
	sound    data/sounds/klunk.wav
        attack  0 0 0 0 
	delay	1
        frame	data/chars/misc/obstacles/rldrum01.png



anim idle
        loop    1 
        #followanim 1
        #followcond 1
	offset	42 52
        bouncefactor 2
	bbox	2 -20 77 79
	hitfx    data/sounds/klunk.wav
	hitflash  flash
        attack13  2 0 77 59 10 1 1 0 0 15
	delay	10
        frame	data/chars/misc/obstacles/rldrum01.png
        frame	data/chars/misc/obstacles/rldrum02.png
        attack  0 0 0 0 
        frame	data/chars/misc/obstacles/rldrum03.png
        frame	data/chars/misc/obstacles/rldrum04.png




anim fall
        loop    0
        followanim 1
        followcond 1
	offset	42 52
        bouncefactor 2
	bbox	2 -20 77 79
	hitfx    data/sounds/klunk.wav
	hitflash  flash
        attack13  2 0 77 59 15 1 1 0 0 15
	delay	10
        frame	data/chars/misc/obstacles/rldrum01.png
@script
    void self = getlocalvar("self");
    changeentityproperty(self, "candamage", openborconstant("TYPE_ENEMY"), openborconstant("TYPE_OBSTACLE"));   
@end_script
        frame	data/chars/misc/obstacles/rldrum01.png
        frame	data/chars/misc/obstacles/rldrum02.png
        frame	data/chars/misc/obstacles/rldrum03.png
        frame	data/chars/misc/obstacles/rldrum04.png
        frame	data/chars/misc/obstacles/rldrum01.png
        frame	data/chars/misc/obstacles/rldrum02.png
        frame	data/chars/misc/obstacles/rldrum03.png
        frame	data/chars/misc/obstacles/rldrum04.png
        frame	data/chars/misc/obstacles/rldrum01.png
        frame	data/chars/misc/obstacles/rldrum02.png
        frame	data/chars/misc/obstacles/rldrum03.png
        frame	data/chars/misc/obstacles/rldrum04.png





anim follow1
        loop    0
	delay	25
	offset	28 82
        frame	data/chars/misc/obstacles/drum02.png
	delay 5
	frame data/chars/misc/empty
	delay	25
        frame	data/chars/misc/obstacles/drum01.png
	delay 5
	frame data/chars/misc/empty
        frame	data/chars/misc/obstacles/drum02.png
	frame data/chars/misc/empty
        frame	data/chars/misc/obstacles/drum02.png
	frame data/chars/misc/empty
        frame	data/chars/misc/obstacles/drum02.png
	frame data/chars/misc/empty
        frame	data/chars/misc/obstacles/drum02.png
        @cmd    killentity getlocalvar("self")
	frame data/chars/misc/empty





anim death
        loop    0
	delay	25
	offset	28 82
        frame	data/chars/misc/obstacles/drum02.png
	delay 5
	frame data/chars/misc/empty
	delay	25
        frame	data/chars/misc/obstacles/drum01.png
	delay 5
	frame data/chars/misc/empty
        frame	data/chars/misc/obstacles/drum02.png
	frame data/chars/misc/empty
        frame	data/chars/misc/obstacles/drum02.png
	frame data/chars/misc/empty
        frame	data/chars/misc/obstacles/drum02.png
	frame data/chars/misc/empty
        frame	data/chars/misc/obstacles/drum02.png
        @cmd    killentity getlocalvar("self")
	frame data/chars/misc/empty

For some reason that I do not know, the script does not work for me to damage the enemies in the "amim fall", it does not work.
I've tried making different changes, but I can not get the drum to meet all the objectives.
 
This is maybe because it does not have the "projectilehit" command.
Try to add this on its header:  projectilehit  enemy obstacle

And another thing is to try to add the script on the top of the fall animation like this:
anim fall
@script
    void self = getlocalvar("self");
    changeentityproperty(self, "candamage", openborconstant("TYPE_ENEMY"), openborconstant("TYPE_OBSTACLE")); 
@end_script

        loop    0
        followanim 1
        followcond 1
offset 42 52
        bouncefactor 2
bbox 2 -20 77 79
hitfx    data/sounds/klunk.wav
hitflash  flash
        attack13  2 0 77 59 15 1 1 0 0 15
delay 10
        frame data/chars/misc/obstacles/rldrum01.png
        frame data/chars/misc/obstacles/rldrum01.png

By the way, with the "projectilehit" command set like above, you may not need to set this script at all. Just try both and see.
 
Back
Top Bottom