SOLVED Enemy count knifes

dantedevil

Well-known member
I have several enemies that have an attack to throw knives.
If these knives bounce off a wall, they fall to the floor and the players can grab them.
But it does not look very good when the enemy keeps throwing knives against the wall and they pile up on the floor. That is why I wanted to know if there is a way for the enemy to count the knives that are on the screen, so as not to keep throwing.
 
Remember the entity enumeration concept. You need to run a loop that goes through all entities on screen, and at each one look for some condition that identifies if it is a knife or not. If it IS a knife, then you add to a count.

Do this as the entity decides to throw a knife. If the count is too high, then cancel the knife throw action and do something else.

DC
 
Ok my friend, I have some knowledge about counting entities, but I don't know exactly how identify this.

This is the special knife the enemy throw:
Code:
name	KNIFE2
health	1
nolife  1
type	none
offscreenkill   30
candamage    player
subject_to_wall 1
subject_to_obstacle 0
subject_to_platform 0
bounce 0
flash		flash
noatflash	1



script  data/scripts/bounce3.c
animationscript data/scripts/script.h 

anim idle
	loop	1
	fastattack 1
	delay	5
	offset	17 17
	#bbox	15 13 18 8
        @cmd    degravity 1
        noreflect 1  
	attack  15 13 18 8 0 0 1 1 0
        hitfx   data/sounds/empty.wav
        followanim 1
        followcond 1
	frame	data/chars/misc/weapons/knife06.png
	frame	data/chars/misc/weapons/knife06.png
	frame	data/chars/misc/weapons/knife06.png
	frame	data/chars/misc/weapons/knife06.png
	frame	data/chars/misc/weapons/knife06.png
	frame	data/chars/misc/weapons/knife06.png
	frame	data/chars/misc/weapons/knife06.png
	frame	data/chars/misc/weapons/knife06.png
	frame	data/chars/misc/weapons/knife06.png
	frame	data/chars/misc/weapons/knife06.png
	attack  0 0 0 0
	frame	data/chars/misc/weapons/knife06.png



anim follow1
	loop	0
@script
void self = getlocalvar("self");

if(frame == 0){
  changeentityproperty(self, "type", openborconstant("TYPE_ENEMY"));
}

@end_script
        fastattack 1#
	offset	17 17
        delay   5
        @cmd ani0020 openborconstant("ANI_FOLLOW2") openborconstant("ANI_BLOCK")
        hitfx   data/sounds/empty.wav
	frame	data/chars/misc/weapons/knife00.png
        delay   5
        hitfx   data/sounds/cuth.wav
        hitflash    bloody
        forcedirection -1
       	attack  0 0 36 34 15 1 1 0 0	
	frame	data/chars/misc/weapons/knife00.png
        attack  0 0 0 0
	frame	data/chars/misc/weapons/knife00.png
        @cmd    killentity getlocalvar("self")
	frame	data/chars/misc/empty.png





anim follow2
@script
void self = getlocalvar("self");

if(frame == 0){
  changeentityproperty(self, "type", openborconstant("TYPE_NONE"));
}

@end_script
	loop	0
        followanim 3
        followcond 1
        delay   1
	offset	17 17
        fastattack 1#
        attack  0 0 0 0
	frame	data/chars/misc/weapons/knife00.png
        delay   5
        hitfx   data/sounds/empty.wav
        attack32  15 13 18 8 0 0 1 1 0
	frame	data/chars/misc/weapons/knife00.png	
        delay   1
        attack  0 0 0 0
	frame	data/chars/misc/weapons/knife00.png
        @cmd    anichange "ANI_FOLLOW3" 0
	frame	data/chars/misc/weapons/knife00.png


anim follow3
	loop	0
        delay   1
	offset	17 17
	frame	data/chars/misc/weapons/knife00.png	
        delay   1
        @cmd    killentity getlocalvar("self")
	frame	data/chars/misc/weapons/knife00.png
	frame	data/chars/misc/weapons/knife00.png


	
anim fall
	loop	0
	delay	3
	offset	17 17
        @cmd    degravity 0
        jumpframe 1 1 -0.6
	frame	data/chars/misc/weapons/knife08.png
	frame	data/chars/misc/weapons/knife07.png
	frame	data/chars/misc/weapons/knife06.png
	frame	data/chars/misc/weapons/knife05.png
	frame	data/chars/misc/weapons/knife04.png
	frame	data/chars/misc/weapons/knife03.png
	frame	data/chars/misc/weapons/knife02.png
	frame	data/chars/misc/weapons/knife01.png
	frame	data/chars/misc/weapons/knife08.png
	frame	data/chars/misc/weapons/knife07.png
	frame	data/chars/misc/weapons/knife06.png
	frame	data/chars/misc/weapons/knife05.png
	frame	data/chars/misc/weapons/knife04.png
	frame	data/chars/misc/weapons/knife03.png
	frame	data/chars/misc/weapons/knife02.png
	frame	data/chars/misc/weapons/knife01.png
	frame	data/chars/misc/weapons/knife08.png
	frame	data/chars/misc/weapons/knife07.png
	frame	data/chars/misc/weapons/knife06.png
	frame	data/chars/misc/weapons/knife05.png
	frame	data/chars/misc/weapons/knife04.png
	frame	data/chars/misc/weapons/knife03.png
	frame	data/chars/misc/weapons/knife02.png
	frame	data/chars/misc/empty.png
        @cmd    killentity getlocalvar("self")
	frame	data/chars/misc/empty.png


anim	follow10
        loop   0
        delay   6
	offset	17 17
        @cmd    degravity 0
        jumpframe 0 2 -0.5
        landframe 7
        sound  data/sounds/knifewall.wav
        @cmd    stop
	frame	data/chars/misc/weapons/knife05.png
	frame	data/chars/misc/weapons/knife04.png
	frame	data/chars/misc/weapons/knife03.png
	frame	data/chars/misc/weapons/knife02.png
	frame	data/chars/misc/weapons/knife01.png
	frame	data/chars/misc/weapons/knife08.png
        delay   100
	frame	data/chars/misc/weapons/knife07.png
        sound   data/sounds/weapfall1.wav
        delay   1
        @cmd    antiwall 30 -10 -1
        @cmd    spawn01 "knife" 0 0 1
        @cmd    killentity getlocalvar("self")
	frame	data/chars/misc/empty.png
	frame	data/chars/misc/empty.png
	frame	data/chars/misc/empty.png

After bounce in wall, they fall to the floor and turn in this knife:
Code:
name	 Knife
health   0
type     item
counter  999
shootnum  1
subtype  weapon
weapnum  2
nolife   1
antigravity 20
#offscreenkill  3000


script  data/scripts/bounce.c
animationscript data/scripts/spitems.h




anim spawn
      loop   0
      delay   12
	offset	17 17
      jumpframe 0 1 0.5
      landframe 4
      @cmd	move 25 0 50
      @cmd	antiwall4 0 -25
	frame	data/chars/misc/weapons/knife07.png
	frame	data/chars/misc/weapons/knife07.png
	frame	data/chars/misc/weapons/knife07.png
      delay   100
	frame	data/chars/misc/weapons/knife07.png
      sound  data/sounds/weapfall1.wav
      delay   8
	bbox   9 0 25 22
	frame	data/chars/misc/weapons/knife06.png
	frame	data/chars/misc/weapons/knife06.png



anim follow10
	loop   0
	offset	17 17
	bbox   9 0 25 22
        @cmd	move 0 0 -150
	frame	data/chars/misc/weapons/knife06.png


anim idle
	loop   0
	offset	17 17
	bbox   9 0 25 22
	frame	data/chars/misc/weapons/knife06.png


anim respawn
      loop   0
      delay   12
	offset	17 17
      jumpframe 0 1 0.5
      landframe 4
      @cmd	move 25 0 70
      @cmd	antiwall4 0 -25
	frame	data/chars/misc/weapons/knife07.png
	frame	data/chars/misc/weapons/knife07.png
	frame	data/chars/misc/weapons/knife07.png
      delay   100
	frame	data/chars/misc/weapons/knife07.png
      sound  data/sounds/weapfall1.wav
      delay   8
	bbox   9 0 25 22
	frame	data/chars/misc/weapons/knife06.png
	frame	data/chars/misc/weapons/knife06.png


So I use this script for count enemies, courtesy of Bloodbane:
Code:
@script
    void self = getlocalvar("self");
    int Enemy = openborvariant("count_enemies");

    if(Enemy == 2){
      changeentityproperty(self, "velocity", 0, 0, 0); // Should be omitted if declared in IDLE
      performattack(self, openborconstant("ANI_FOLLOW10"));
    }
@end_script

But I don't know how use for count the "knife". As you see this 'knife" have type item, subtype weapon.
 
In you code, I would use "count_entities" instead, since they change their type. Btw, why you change the type only after hit?
Than just check the entity name. If its "knife" or "Knifer", add your logic here.
 
O Ilusionista said:
In you code, I would use "count_entities" instead, since they change their type. Btw, why you change the type only after hit?
Than just check the entity name. If its "knife" or "Knifer", add your logic here.

The type change is for the conterknife and some bug.
Sometimes the knifer get stuck into the wall when spawn the "knife".
Then when you kill all enemies, you can't advance. This way avoid the problem.
 
You can use this to count "knives":
Code:
@script
    void self = getlocalvar("self");			//Caller.

    if(frame==1){
      void vEntity;                                       //Target entity placeholder.
      int  iEntity;                                       //Entity enumeration holder.
      char iName;                                         //Entity Name.
      int  iMax      = openborvariant("ent_max");         //Entity count.
      int C = 0;

      //Enumerate and loop through entity collection.
      for(iEntity=0; iEntity<iMax; iEntity++){
        vEntity = getentity(iEntity);                 //Get target entity from current loop.
        iName   = getentityproperty(vEntity, "name"); //Get target name.

        if(iName == "knife"){
          C = C + 1;
        }
      }

      if(C >= 5){
        performattack(self, openborconstant("ANI_FOLLOW10"));
      }
    }
@end_script

You can alter frame==1, "knife", Knives limit and FOLLOW10 to suit your need :)
 
Bloodbane said:

Remember to use count_entities instead of ent_max. Otherwise you are wasting a ton of loop cycles.

  • count_entities: Number of entities currently in play. For most modules, that's a few dozen at most.
  • ent_max: The maximum allowed number of entities. At the time of this post, that's 5000. In other words, your loop is counting from 0 - 5000 every single time.
 
Thanks to both my friends!

I just tried the script and modified it so that the enemy stops throwing knives when there are 3 on the screen, but it does not work.
The enemy still throwing knifes like the script doesn't exist.

Here my try:
Code:
anim attack4
	range	200 350
@script
    void self = getlocalvar("self");			//Caller.

    if(frame==1){
      void vEntity;                                       //Target entity placeholder.
      int  iEntity;                                       //Entity enumeration holder.
      char iName;                                         //Entity Name.
      int  iMax      = openborvariant("count_entities");         //Entity count.
      int C = 0;

      //Enumerate and loop through entity collection.
      for(iEntity=0; iEntity<iMax; iEntity++){
        vEntity = getentity(iEntity);                 //Get target entity from current loop.
        iName   = getentityproperty(vEntity, "name"); //Get target name.

        if(iName == "knife"){
          C = C + 1;
        }
      }

      if(C >= 3){
        performattack(self, openborconstant("ANI_FOLLOW2"));
      }
    }
@end_script
	loop	0
	delay	1
	offset	82 177
	bbox	58 80 42 99
	frame	data/chars/gang1/slicer/idle0.png
@script
	void vSelf = getlocalvar("self");
	int xpos = openborvariant("xpos");
	int rWidth = openborvariant("hResolution");
	int x = getentityproperty(vSelf, "x");

	if(! (x > xpos && x < xpos + rWidth)){
		setidle(vSelf);
	}
@end_script
	frame	data/chars/gang1/slicer/throwk01.png
	delay	20
        sound   data/sounds/sw1.wav
	frame	data/chars/gang1/slicer/throwk01.png
	delay	6
        sound   data/sounds/m3at0.wav
	frame	data/chars/gang1/slicer/throwk02.png
	frame	data/chars/gang1/slicer/throwk03.png
        @cmd    antiwall 40 -40 -1 
	frame	data/chars/gang1/slicer/throwk04.png
        sound   data/sounds/knife.wav
	delay	4
	@cmd    shooter2 "knife2" 50 85 -1 2.8 0 0
	frame	data/chars/gang1/slicer/throwk05.png
	delay	60
	frame	data/chars/gang1/slicer/throwk05.png

And here the Knife2 that throws the enemy and that after bouncing off the wall and falling to the ground, spawn the knife.
Code:
name	 knife2
type	 none
shadow	0
health   1
nolife   1
nomove 1 1
falldie 2
nodieblink 1
candamage	player
subject_to_gravity 0
no_adjust_base	0
subject_to_hole 1
subject_to_wall 1
offscreenkill	1500
lifespan 5

load knife

script  data/scripts/bounce3.c
animationscript data/scripts/escript.h

anim idle
	loop      1
	fastattack 1
        delay	2
	offset 17 17
        hitfx   data/sounds/empty.wav
	followanim 1
	followcond 1
        noreflect 1 
	attack  15 13 18 8 0 0 1 1 0
        forcedirection -1
	frame	data/chars/misc/weapons/knife02.png
	attack  15 13 18 8 0 0 1 1 0
	frame	data/chars/misc/weapons/knife03.png
	attack  15 13 18 8 0 0 1 1 0
	frame	data/chars/misc/weapons/knife04.png
	attack  15 13 18 8 0 0 1 1 0
	frame	data/chars/misc/weapons/knife05.png
	attack  15 13 18 8 0 0 1 1 0
	frame	data/chars/misc/weapons/knife06.png
	attack  15 13 18 8 0 0 1 1 0
	frame	data/chars/misc/weapons/knife07.png
	attack  15 13 18 8 0 0 1 1 0
	frame	data/chars/misc/weapons/knife08.png
	attack  15 13 18 8 0 0 1 1 0
        frame	data/chars/misc/weapons/knife01.png

anim follow1
	loop	0
@script
void self = getlocalvar("self");

if(frame == 0){
  changeentityproperty(self, "type", openborconstant("TYPE_ENEMY"));
}

@end_script
        fastattack 1#
	offset	17 17
        delay   5
        @cmd ani0020 openborconstant("ANI_FOLLOW2") openborconstant("ANI_BLOCK")
        hitfx   data/sounds/empty.wav
	frame	data/chars/misc/weapons/knife00.png
        delay   5
        hitfx   data/sounds/cuth.wav
        hitflash    bloody
        forcedirection -1
       	attack  0 0 36 34 15 1 1 0 0	
	frame	data/chars/misc/weapons/knife00.png
        attack  0 0 0 0
	frame	data/chars/misc/weapons/knife00.png
        @cmd    killentity getlocalvar("self")
	frame	data/chars/misc/empty.png

anim follow2
@script
void self = getlocalvar("self");

if(frame == 0){
  changeentityproperty(self, "type", openborconstant("TYPE_NONE"));
}

@end_script
	loop	0
        followanim 3
        followcond 1
        delay   1
	offset	17 17
        fastattack 1#
        attack  0 0 0 0
	frame	data/chars/misc/weapons/knife00.png
        delay   5
        hitfx   data/sounds/empty.wav
        attack32  15 13 18 8 0 0 1 1 0
	frame	data/chars/misc/weapons/knife00.png	
        delay   1
        attack  0 0 0 0
	frame	data/chars/misc/weapons/knife00.png
        @cmd    anichange "ANI_FOLLOW3" 0
	frame	data/chars/misc/weapons/knife00.png

anim follow3
	loop	0
        delay   1
	offset	17 17
	frame	data/chars/misc/weapons/knife00.png	
        delay   1
        @cmd    killentity getlocalvar("self")
	frame	data/chars/misc/weapons/knife00.png
	frame	data/chars/misc/weapons/knife00.png

anim fall
@script
    void self = getlocalvar("self");

    if(frame==0){
      changeentityproperty(self, "subject_to_gravity", 1);
    }
@end_script
	loop      0
      delay     6
	offset 17 17
	landframe 7
        jumpframe 0 2 -0.5
        sound  data/sounds/knifewall.wav
        @cmd    stop
	frame	data/chars/misc/weapons/knife05.png
	frame	data/chars/misc/weapons/knife04.png
	frame	data/chars/misc/weapons/knife03.png
	frame	data/chars/misc/weapons/knife02.png
	frame	data/chars/misc/weapons/knife01.png
	frame	data/chars/misc/weapons/knife08.png
        delay   100
	frame	data/chars/misc/weapons/knife07.png
        sound   data/sounds/weapfall1.wav
        delay   1
        @cmd    spawn01 "knife" 0 0 0
	frame	data/chars/misc/empty.png
      @cmd killentity getlocalvar("self")
	frame	data/chars/misc/empty.png

anim death
      loop      0
      delay     2
	offset 1 1
	frame	data/chars/misc/empty.png
      @cmd killentity getlocalvar("self")
	frame	data/chars/misc/empty.png

anim	follow10
@script
    void self = getlocalvar("self");

    if(frame==0){
      changeentityproperty(self, "subject_to_gravity", 1);
    }
@end_script
	loop      0
      delay     6
	offset 17 17
	landframe 7
        jumpframe 0 2 -0.5
        sound  data/sounds/knifewall.wav
        @cmd    stop
	frame	data/chars/misc/weapons/knife05.png
	frame	data/chars/misc/weapons/knife04.png
	frame	data/chars/misc/weapons/knife03.png
	frame	data/chars/misc/weapons/knife02.png
	frame	data/chars/misc/weapons/knife01.png
	frame	data/chars/misc/weapons/knife08.png
        delay   100
	frame	data/chars/misc/weapons/knife07.png
        sound   data/sounds/weapfall1.wav
        delay   1
        @cmd    spawn01 "knife" 0 0 0
	frame	data/chars/misc/empty.png
      @cmd killentity getlocalvar("self")
	frame	data/chars/misc/empty.png

 
I can't test it right now, but I do see somethings:

- I would use "model" instead of "name". So you will get the actual name of the entity, not the alias you give it
- I am kinda confuse. Its knife, knife2 or knifer?

This is the code I use in Beast to prevent him to call another NPC. See that he will go to the attack animation ONLY if there isn't a NPC, and that animation (freespecial3) is just the idle duplicated

anim freespecial3
        @script
if(frame ==0)
{
void self = getlocalvar("self");
setlocalvar("Beast_Bot_count" + self, 0);
  int mp    = getentityproperty(self, "mp");

int i;
    for (i = 0; i < openborvariant("count_entities"); ++i)
{
void ent = getentity(i);
if ( getentityproperty(ent, "exists") )
  {
                if ( getentityproperty(ent, "type") == openborconstant("TYPE_NPC") &&
    getentityproperty(ent,"model")== "Beast_Bot")
    {
setlocalvar("Beast_Bot_count" + self, getlocalvar("Beast_Bot_count" + self) +1);
}
  }
}
        int Beast_Bot_count = getlocalvar("Beast_Bot_count" + self);
        if(Beast_Bot_count <1 && mp >=60 )

{
  changeentityproperty(self,"mp", mp - 60);
  performattack(self, openborconstant("ani_follow4"));
  }
        setlocalvar("Beast_Bot_count" + self, NULL());
        }
@end_script
delay 15
offset 72 109
bbox 55 53 35 56
frame data/chars/beast/id1.gif

Lagarto made this code for me. Reading it again, I don't understand why checking if the entity exist...if we already counted the available anyway.
 
- I would use "model" instead of "name". So you will get the actual name of the entity, not the alias you give it
- I am kinda confuse. Its knife, knife2 or knifer?

I see the differences now.
After the "knife2" bounce in the wall and fall in the floor, spawn the "knife" (weapon) and and kill himself.
So in the Stage remains the knife in the floor.
Then I need the script checks how many "knife" are on the floor.

I'm going to try using "model" instead of name and I'll see what happens.


Later...
I try to modify the script based on yours, but I don't understand the logic to mix both.
I'm sorry, but this exceeds my knowledge.
 
So you need to count only the entity which are on the floor and they are called "knife"?
Remember that, in script, names are CASE SENSITIVE.

In your code, you are checking for "knife", but in your entity is "Knife"
 
O Ilusionista said:
So you need to count only the entity which are on the floor and they are called "knife"?
Remember that, in script, names are CASE SENSITIVE.

In your code, you are checking for "knife", but in your entity is "Knife"

Finally works my friend, thanks!
Was my error as you say:

I check "knife" instead "Knife", so now works.

But now I found 2 new problems:

1) After the enemy is hit and loses the weapon, when it recovers it can not launch it, it only executes the animation that says the Script, even though there is no knife on the screen.

2) I just realized that when you spawn an enemy with a weapon, the system not take into account the health that you put and always leave the one you have in the header of their txt.

spawn  slicer
health  300
at          0

In their Slicer txt have health  80, and always spawn with this health, when spawn the weapon.
Is this true or is it a bug?
And if so, is there a way to allocate more health?
 
1) After the enemy is hit and loses the weapon, when it recovers it can not launch it, it only executes the animation that says the Script, even though there is no knife on the screen.

Well, after sone test I finally can solve the problem 1.

Here my solution:
anim attack2
range 200 350
@script
    void self = getlocalvar("self"); //Caller.

    if(frame>=1){
      void vEntity;                                      //Target entity placeholder.
      int  iEntity;                                      //Entity enumeration holder.
      char iName;                                        //Entity Name.
      int  iMax      = openborvariant("count_entities");        //Entity count.
      int C = 0;

      //Enumerate and loop through entity collection.
      for(iEntity=0; iEntity<iMax; iEntity++){
        vEntity = getentity(iEntity);                //Get target entity from current loop.
        iName  = getentityproperty(vEntity, "name"); //Get target name.

        if(iName == "Knife"){
          C = C + 1;
        }
      }

      if(C >= 3){
        performattack(self, openborconstant("ANI_FOLLOW2"));
      }
    }
@end_script
loop 0
delay 1
offset 82 177
bbox 58 80 42 99
frame data/chars/gang1/slicer/idle0.png
@script
void vSelf = getlocalvar("self");
int xpos = openborvariant("xpos");
int rWidth = openborvariant("hResolution");
int x = getentityproperty(vSelf, "x");

if(! (x > xpos && x < xpos + rWidth)){
setidle(vSelf);
}
@end_script
frame data/chars/gang1/slicer/throwk01.png
delay 20
        sound  data/sounds/sw1.wav
frame data/chars/gang1/slicer/throwk01.png
delay 6
        sound  data/sounds/m3at0.wav
frame data/chars/gang1/slicer/throwk02.png
frame data/chars/gang1/slicer/throwk03.png
        @cmd    antiwall 40 -40 -1
frame data/chars/gang1/slicer/throwk04.png
        sound  data/sounds/knife.wav
delay 4
@cmd    shooter2 "knife2" 50 85 -1 2.8 0 0
frame data/chars/gang1/slicer/throwk05.png
delay 60
frame data/chars/gang1/slicer/throwk05.png




anim follow2
loop 0
@script
void vSelf = getlocalvar("self");
int xpos = openborvariant("xpos");
int rWidth = openborvariant("hResolution");
int x = getentityproperty(vSelf, "x");

if(! (x > xpos && x < xpos + rWidth)){
setidle(vSelf);
}
@end_script
delay 1
offset 82 177
bbox 58 80 42 99
frame data/chars/gang1/slicer/throwk01.png
        throwframe 6 1
        custknife eflash
frame data/chars/gang1/slicer/throwk01.png
delay 20
        sound  data/sounds/sw1.wav
frame data/chars/gang1/slicer/throwk01.png
delay 6
        sound  data/sounds/m3at0.wav
frame data/chars/gang1/slicer/throwk02.png
frame data/chars/gang1/slicer/throwk03.png
        @cmd    antiwall 40 -40 -1
frame data/chars/gang1/slicer/throwk04.png
        sound  data/sounds/knife.wav
delay 4
@cmd    shooter2 "knife2" 50 85 -1 2.8 0 0
frame data/chars/gang1/slicer/throwk05.png
delay 60
frame data/chars/gang1/slicer/throwk05.png

As you see, when the enemy detect the counter script reach the limit, then change the amimation when he use and spend the weapon.
This is very useful to make an enemy get more use for a simple gun like a knife.

About the problem 2, I hope someone can give an alternative to give more health when spawn an enemy with weapon.
 
2) I just realized that when you spawn an enemy with a weapon, the system not take into account the health that you put and always leave the one you have in the header of their txt.

spawn  slicer
health  300
at          0

In their Slicer txt have health  80, and always spawn with this health, when spawn the weapon.
Is this true or is it a bug?
A good question. But thinking about it, I think its right on this way, because it will go on this order:
- header
- level spawn
- weapon

Since weapon is the last one, it will override all the previous one (I am taking a wild guess here).

How you spawn the entity on the level? Try this

spawn  slicer
weapon {name} {bi}
health  300
at          0

If it doesn't works, I think I have a solution for it.
 
Try this:

spawn  slicer
@script void main() {
void self = getlocalvar("self"); // get caller
int iLife = 300;
changeentityproperty(self, "maxhealth",iLife );
changeentityproperty(self, "health",iLife );
} @end_script
weapon {name} {bi}
at          0
 
Code:
spawn  slicer
@script void main() {
void self = getlocalvar("self"); // get caller
int iLife = 300;
changeentityproperty(self, "maxhealth",iLife );
changeentityproperty(self, "health",iLife );
} @end_script
weapon knife 0
coords  362 242 0
at      0


Sorry my friend, but not work...

The same before, the enemy spawn with the health of the header txt.

Code:
name	SLICER2
health	60
speed	10
type	none
risetime -200 -200 
gfxshadow  1
aggression -30
dust		dust
hmap 1 5
fmap 2
aimove avoid

load knife2


typeshot      0
weaploss      0 
modelflag     1



icon	data/chars/gang1/slicer/icon.png 1
 
Because we already managed to solve the problem by which we opened this thread, I decided it was resolved.
The new problem that we have found is derived from a new thread, since it is something different:


http://www.chronocrash.com/forum/index.php?topic=3994.msg55064#msg55064


Thanks Bloodbane and O Ilusionista for all the help to solve this!!!
 
Back
Top Bottom