Stuck on ThunderHooves D:

Putting this under bug because maybe it is?

I’m currently stuck on thunderhooves :confused: It builds the blocking fences on the bottom correctly but for some reason on the last one, it runs up to the yak and build the fence then I die. I’m a noob but my scripting looks correct, any insight/advice?

   loop
    local yak = self:findNearestEnemy()
   
    if yak  then
       if yakY > self.pos.y  then
         local yakPos = yak.pos
        local yakX = yakPos.x
        local yakY = yakPos.y
            self:buildXY("fence", yakX , yak.pos.y - 10)
            
            
        else 
            local yakPos = yak.pos
        local yakX = yakPos.x
        local yakY = yakPos.y
            self:buildXY("fence", yakX, yakY + 10)
            end
       
        else
    
        
        self:moveXY(self.pos.x + 10, self.pos.y)
        
    end
end

Pl ease format your code according to the FAQ

sorry i have to say i am not onn that leval

nvm…I’m a total noob. Issue was resolved when changing the positioning of my first set of pos,x, and y variables for “yak”. Sorry for the noob moment.

Using:

loop
    local yak = self:findNearestEnemy()
   
    if yak  then
         local yakPos = yak.pos
        local yakX = yakPos.x
        local yakY = yakPos.y
       if yakY > self.pos.y  then
        
            self:buildXY("fence", yakX , yak.pos.y - 10)
            
            
        else 
            local yakPos = yak.pos
        local yakX = yakPos.x
        local yakY = yakPos.y
            self:buildXY("fence", yakX, yakY + 10)
            end
       
        else
    
        
        self:moveXY(self.pos.x + 10, self.pos.y)
        
    end
end

works perfectly fine. Sorry guys

It’s ok. :grinning: :grinning: