killentity - damage entity is crashing openbor

oldyz

Well-known member
i was running an experiment &  this line command is crashing the game:

Code:
anim spawn
	delay	15
	offset  124 124
	bbox    0 0 0 0
	drawmethod 32 32
	@script
	if(frame == 0){
	void self = getlocalvar("self");
	int map = rand()%5;
	if(map < 0)
	{
	-map == map;
	}
	changeentityproperty(self, "map", map);
	}
	@end_script
	frame	data/chars/zombie/s1
	drawmethod 64 64
	frame	data/chars/zombie/s1
	drawmethod 128 128
	frame	data/chars/zombie/s1
	nodrawmethod
	frame	data/chars/zombie/s1
	frame	data/chars/zombie/s2
	sound   data/sounds/n2/zombgr.wav
	frame	data/chars/zombie/s3
	frame	data/chars/zombie/s4
	frame	data/chars/zombie/s5
@cmd killentity "zombie"                #----------------------------------------
	frame	data/chars/zombie/s6
	frame	data/chars/zombie/s7

when it reaches the frame, the game crashes.

on the other hand, i can't figure out how to use this next one

Also , i am not sure on how to use the damageentity
damageentity(entity, other, force, drop, type)

    Damage the entity.
    'entity' is the entity you want to damage.
    'other' who damage this entity, can be itself, if you specify a player's entity, score will be added. Default to the entity itself.
    'force' is the attack force. default to 1.
    'drop' is whether the attack knocks down the entity.
    'type' attack type, e.g., a shock attack or attack1-10, see openborconstant, the constants starts with 'ATK_'

i tried this
@cmd damageentity "zombie" self 200 0 attack1
 
The entity parameter {Entity} is an object pointer to the target entity, not a model name. Same principal as getting and setting entity properties.

DC
 
so in this situation , how would i be able to target "dog"?
i need zombie1 to kill dog when the right frame comes up

Code:
notime 1
settime 0
#background	data/bgs/library/testpanel
panel		data/bgs/0testlevel/testpanel
#frontpanel      data/bgs/library/p1
fglayer 	data/bgs/lv4/swc5a 4 1 0 0 0 99999999 0 2 1 1 2 
order	a
direction both
spawn1 100 45 0
spawn2 80 70 0
cameratype 1
#levelscript data/bgs/library/library.c
load zombiedr 1

#--group1-----
shadowalpha 2
at 0 
light 256 33
at 0
spawn	lvbegin2
flip 1
coords	320 244
at	0

#mark#

spawn zombietest
item bosslow
coords	35 200
at	0

spawn zombie
item brl
coords	95 220
at	0


spawn dog

coords	97 220
at	0

 
oldyz said:
how would i be able to target "dog"?

You'd need script to scan all active entities to find "dog". If it finds the "dog", acquire its holder and send it to function who wants to do something about it.

oldyz said:
i need zombie1 to kill dog when the right frame comes up

Just to make sure we are on same frequency here, killentity function removes the entity. It doesn't let the latter play DEATH animation at all.
So do you want zombie1 to remove dog or to kill dog so the dog plays DEATH animation?
 
well, if the dog had  a "bone" item set in the .txt file ,

spawn Dog
item Bone
coords 95 220
at 0


will he drop it if you kill him using killentity? -
as far as i can understand damage entity is very likely to do the dog's death animation, but it seems harder to code
 
O Ilusionista

Thanks, ill check it out, the whole point is to restore the item drop ability to a "randomized" entity by binding a normal spawn entity to a script-spawn entity

randomizer spawns a "rando" the rando's spawn animation binds randomizer to itself - when the "rando" dies - the onkillscript terminates randomizer & the item should drop -
there is a risk here tho, i have to test how the bind command behaves - example - what happens if another entity makes another bind command later?
does the randomizer "jump" from the rando to the other entity that made the call?

another method would be to merge "spawnbind" "spawnmate" & "randomizer" script - so when the randomizer spawns something - the "rando" generated binds the still alive randomizer to it - i figured if the 2 entities are now in "mate" mode when yo kill the "rando" you kill the randomizer & the item drop happens as normal (because randomizer is the one that drops it) -

The third method is something that has probably not been tried before and may  be less trouble:
how would you "pass" the item drop from one entity to another using script ?
or viceversa, how do you make an entity take or steal the item drop of  another?

here is an example:

hiddenturkeyleg  -----------------------------------  this entity's only purpose is to hold the "turkeyleg" item drop "flag"
item turkeyleg
coords 35 200
at 0

spawn jesterMizer
item brl
coords 95 220
at 0

spawn KingMIzer
coords 155 200
at 0

in this scenario - the jesters have a script on their spawn animations that "steal" the item drop from  hiddenturkeyleg - result, when you kill jester the turkey leg drops - and if any other jester spawns the turkey might move to it

Last one very basic thing i have not tested - how does the item drop flag itself behave - what happens if you kill the entity "holding" the flag with a throw? does the item still "drop"?
 
Back
Top Bottom