10/02/2025
images

Para hacer que en tu mapa de Warcraft III cada árbol talado sea revivido, necesitas implementar un sistema que detecte cuándo un árbol es talado y, después de cierto tiempo, lo haga reaparecer en su lugar. Puedes hacerlo utilizando JASS. Aquí tienes un ejemplo básico:

globals
    real treeRespawnTime = 60.0 // Tiempo en segundos antes de que un árbol reviva
endglobals

function RespawnTree takes nothing returns nothing
    local rect r = GetRectFromLoc(GetEventDamageLoc())
    local real x = GetRectCenterX(r)
    local real y = GetRectCenterY(r)
    local destructable d
    local integer respawnEffect = 'CHEF' // Efecto visual de árbol renaciendo

    // Eliminar el árbol destruible talado
    call RemoveDestructable(GetFilterDestructable())

    // Crear un nuevo árbol en su lugar
    set d = CreateDestructableZ('LTlt', x, y, 0, 0, treeRespawnTime, 0)

    // Aplicar un efecto visual para mostrar que el árbol revive
    call AddSpecialEffect(d, respawnEffect)
    call DestroyEffect(GetLastCreatedEffect())

    call RemoveRect(r)
endfunction

function InitTriggers takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED)
    call TriggerAddCondition(t, Condition(function GetAttackedTree))
    call TriggerAddAction(t, function RespawnTree)
endfunction

function GetAttackedTree takes nothing returns boolean
    return IsTreeUnit(GetAttacker()) and GetDestructableLife(GetFilterDestructable()) <= 0.0
endfunction

function CreateTriggers takes nothing returns nothing
    call InitTriggers()
endfunction

//===========================================================================
function Init takes nothing returns nothing
    call CreateTriggers()
endfunction

Este código crea un sistema que detecta cuando un árbol es talado por un ataque y luego, después de un tiempo (definido en treeRespawnTime), hace reaparecer un nuevo árbol en el mismo lugar. Puedes ajustar treeRespawnTime al valor que desees.

Asegúrate de asociar el activador que llama a CreateTriggers al evento de inicio del mapa en el Editor de Mapas de Warcraft 3. Además, ten en cuenta que este es un ejemplo básico y que puedes personalizarlo según tus necesidades específicas, como efectos visuales o sonidos adicionales para hacer que la aparición de árboles sea más llamativa.

Danos tu opinion abajo usando tu cuenta de facebook.

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

This site uses Akismet to reduce spam. Learn how your comment data is processed.