disabling enemy type aimovement

ABK

Well-known member
I wanted to do this in versus mode of he-man so at the beginning of the round enemies cant move and attack, i know i can do it by editing their spawn animation but i would like to enable ai in the same time for enemies and players, it works good only for players but for some reason when i want to get target of player character (which is enemy) then disable ai script doesnt work on enemy.Its not called in player character, its called in VS entity which controls spawning of Versus text and end of the round etc.
This is very trivial task so i didnt expect it not to work when it works for playables.

Im using     
This to detect and disable enemy AI but it doesnt work
  void P1 = getplayerproperty(0,"entity");
  void opp = getentityproperty(P1, "opponent");

changeentityproperty(opp,"noaicontrol",1);

Any clues why it doesnt work? I have this script in spawn animation of VS entity and it runs when enemy and player are spawned in stage.
Is there any easier way to just disable AI for all "type enemy" entities in stage without detecting playables opponent etc ?
 
"Opponent" is misleading - it doesn't really have anything to do with who is an enemy and who isn't. It's the last entity that <ent> interacted with. Easiest way to think of it would be if you are a player, it's whatever entity shows up in the enemy lifebar area.

To shut down AI for enemies in the area, I'd probably do an entity collection loop and check for enemy types.

DC
 
I have another problem with replacing freeze effect, changing drawmethod isnt that hard but changing it back gives me hard time
@script
                void self = getlocalvar("self");

                void opp = getentityproperty(self, "opponent");
                  int animid2 = getentityproperty(opp, "animationid");
            if (  frame == 1  ) {
              changedrawmethod(opp,"reset",1);
  changedrawmethod(opp,"enabled",1);
  changedrawmethod(opp, "tintmode", 1);
    changedrawmethod(opp, "tintcolor", rgbcolor(100,150,200));
        changeentityproperty(self, "velocity", 0,0,0);
          changeentityproperty(self, "speed", 0);
}
if (  frame == 3  ) {

              changedrawmethod(opp,"reset",1);
  }
@end_script
forcedirection -1
offset 187 103
bbox 0 0 0 0
loop 0
delay 1
frame data/sprites/0.gif
delay 300
frame data/sprites/0.gif
delay 2
frame data/sprites/0.gif
frame data/sprites/0.gif
@cmd killentity getlocalvar("self")

This is my follow1 animation of projectile which froze enemy and went to follow1 animation to change drawmethod.
So i tried to get animation ID and then compare them with:

if ( getentityproperty(opp, "animationid") != animid2 );

But it just doesnt work, so how it should look like to make it work and unfreeze enemy when he gets hit or anim is changing to different one.
 
No matter what effect I'm using, I always bind a special effect entity. Even if there is no visible effect. On spawn, the special effect entity sets the tint color, and puts it back on death.

All I have to worry about from there is spawning/killing the special effect entity. Usually it is in animation bind mode - so if the primary entity is burning, the burn effect is automatically killed as soon as primary is out of its burn animation. But it works just as well for timed effects or other forms of control.

I find this much easier to deal with than trying to track tint and other draw effects on their own.

DC
 
but entity is removed when bindentity is set to 4, so how to disable tint when entity is not there anymore to disable it.
I have to use ondeathscript ? It all smells workarounds, chopping up the tree to make 1 small toothpick from it. :-\
 
That's the whole point: onspawn sets tint, ondeath sets normal. It's pretty simple if you ask me. Once the front end work of creating your effect entity is done, you can reuse it for pretty much anything, and usage is fire & forget. Much better than a bunch of workarounds or trying to store defaults into variables.

DC
 
Back
Top Bottom