Hide-and-seek, lightning activation rule?

Is it possible to activate the lightning
After engage into the fight with a brawler
As far as I understand
Lightning should be activated by a trigger at the point {40, 34}
But even if I directly “swap” brawler at this point
Or do as the brawler passes through {40, 34} on the way to me
Or when pushing it to the point by hero
Lightning is not activated

Code
function checkTakeHide(item) {
    if (item) 
    {
        if ( item.pos.x > 68 )
        {
            hero.cast( "haste", hero );   
        }
        hero.moveXY( item.pos.x, item.pos.y );
        itemCounter += 1;

        if ( item.pos.x > 41 )
        {
            hero.buildXY( "fire-trap", hero.pos.x + 4, hero.pos.y );
            hero.buildXY( "fire-trap", hero.pos.x + 4, hero.pos.y );
        }
        if ( item.pos.x < 41 )
        {
            hero.buildXY( "fire-trap", hero.pos.x - 4, hero.pos.y );
            hero.buildXY( "fire-trap", hero.pos.x - 4, hero.pos.y );
        }

        hero.moveXY( 25, 56 );
    }

}

hero.moveXY ( 54, 56 );
var itemCounter = 0;

while ( true ) {
    
    if ( itemCounter == 4 )
    {
        var brawler = hero.findNearest(hero.findByType( "brawler" ));
        if ( brawler ) 
        {
            if ( hero.canCast( "swap" ) )
            {
                hero.moveXY( 28, 56);
                hero.cast( "swap", brawler );   
            }
            
            while( true )         
            {
                if ( hero.canCast( "swap" )
                    && hero.distanceTo( brawler ) < 30 )
                {   
                    hero.cast( "swap", brawler );
                }      
                hero.move( { x:40, y:34 } );  
            }
        }   
    }
    
    var stone = hero.findNearest( hero.findItems() );
    if ( stone )
    {
		checkTakeHide( stone );
    }
    else if ( itemCounter < 4 )
    {
        hero.buildXY( "fire-trap", 27, 47 );   
    }
}
1 Like

The magic is activated only when all lightstones are collected and the brawler in the center.

Are you trying to get in the scoreboard or just to solve it? Your solution looks too complex for that level.

1 Like

I collected all lightstones
And brawler was at the {40, 34}
by cast swap on him

I tried to get into the scoreboard
I managed to kill brawler by fire-traps
Using a slightly different approach.

1 Like

Hm, It’s hard to say the reason. Could you send me your sessionID exactly for that case? I can see only your last session/replay.

1 Like

Sent sessionID for that case

1 Like

Thanks! There was one more condition - the brawler should not be alarmed. I removed it. Could you check it now?

1 Like

It works exactly as I planned
Thank you so much

In some way
This “not alarmed” condition
Was a good thing
At first I thought
A lot of time spend in vain
But excellent solution was near

1 Like