Мне нужно отловить цвет что бы в зависемости от цвета игрока менять содержымое таблички
я вроде сказал тригер юнит если синий перекрасить в красный по почему то не перекрашываеца
`
ОЖИДАНИЕ РЕКЛАМЫ...
23
Похожие вопросы:

ответ
Реализовал через второй вариант:
Дальше пришла в голову другая идея. Думаю, можно сделать с помощью ремонта зданий Альянса: на месте смерти героя создаётся здание с моделью креста со здоровьем 1/100 ед., а союзные герои ремонтируя крест будут повышать её здоровье, получается некая иллюзия прогресс бара. И если спрятать способность ремонта с помощью функции HideAbilityButton( ) из мемхака, то будет ли она срабатывать при нажатии на ПКМ? Также, как отловить момент полного ремонта здания? С помощью таймера проверять процент здоровья каждые доли секунды?
раскрыть
scope HeroRevive initializer Initialization


    struct herorevive
        private                    unit           dyingUnit
        private                    unit           reincarnate
        private                    real           life

        private                    thistype       prev
        private                    thistype       next

        public   static  constant  trigger        trig    =  CreateTrigger( )
        public   static  constant  timer          period  =  CreateTimer( )


        private static method iterate takes nothing returns nothing
            local  thistype  this  =  thistype( 0 ).next

            loop
                exitwhen ( this == 0 )

                if ( GetWidgetLife( this.reincarnate ) > this.life ) then
                    set  this.life  =  GetWidgetLife( this.reincarnate )

                elseif ( GetWidgetLife( this.reincarnate ) >= GetUnitState( this.reincarnate, UNIT_STATE_MAX_LIFE ) ) then
                    call ReviveHero( this.dyingUnit, GetUnitX( this.dyingUnit ), GetUnitY( this.dyingUnit ), true )
                    call RemoveUnit( this.reincarnate )

                    set  this.reincarnate  =  null
                    set  this.life         =  0.0

                    set  this.prev.next    =  this.next
                    set  this.next.prev    =  this.prev

                    if ( thistype( 0 ).next == 0 ) then
                        call PauseTimer( thistype.period )
                    endif

                    call thistype.deallocate( this )

                elseif ( GetWidgetLife( this.reincarnate ) <= this.life ) then
                    set  this.life  =  1.0
                    call SetWidgetLife( this.reincarnate, this.life )
                endif

                set this = this.next

            endloop
        endmethod


        public static method actions takes nothing returns nothing
            local  thistype  this  =  thistype.allocate( )

            set  this.next         =  0
            set  this.prev         =  thistype( 0 ).prev
            set  this.next.prev    =  this
            set  this.prev.next    =  this

            set  this.dyingUnit    =  GetDyingUnit( )
            set  this.reincarnate  =  CreateUnit( GetOwningPlayer( this.dyingUnit ), 'h003', GetUnitX( this.dyingUnit ), GetUnitY( this.dyingUnit ), 0.0 )
            set  this.life         =  1.0

            call SetUnitPathing( this.reincarnate, false )
            call SetWidgetLife( this.reincarnate, this.life )

            if ( this.prev == 0 ) then
                call TimerStart( thistype.period, 0.10, true, function thistype.iterate )
            endif
        endmethod


        public static constant method conditions takes nothing returns boolean
            return IsUnitType( GetDyingUnit( ), UNIT_TYPE_HERO )
        endmethod


    endstruct


    public function Initialization takes nothing returns nothing
        call TriggerRegisterPlayerUnitEvent( herorevive.trig, Player( 1 ), EVENT_PLAYER_UNIT_DEATH, null )
        call TriggerRegisterPlayerUnitEvent( herorevive.trig, Player( 2 ), EVENT_PLAYER_UNIT_DEATH, null )
        call TriggerRegisterPlayerUnitEvent( herorevive.trig, Player( 3 ), EVENT_PLAYER_UNIT_DEATH, null )
        call TriggerRegisterPlayerUnitEvent( herorevive.trig, Player( 4 ), EVENT_PLAYER_UNIT_DEATH, null )

        call TriggerAddCondition( herorevive.trig, Condition( function herorevive.conditions ) )
        call TriggerAddAction( herorevive.trig, function herorevive.actions )
    endfunction


endscope
Вот только если спрятать кнопку через HideAbilityButton( ), то способность ремонта зданий исчезает и не работает через ПКМ.

28
Color of Owner of Triggering unit.

Вообще странно что у тебя в условиях и Triggering Player и Triggering Unit , условия работают от разных ивентов.

Ивенты по типу Triggering Unit - отвечают когда какой-то юнит вызывает ивент (например - Юнит кастует абилку)
Trigering Player - когда какой-то игрок вызывает ивент. (например - игрок пропустил диалог)
Ответы (1)
26
Roy Mustang, и что? Разве они не могут работать вместе? Например событие выбора юнита работает с Triggering Player'ом (тем кто выбрал юнита) и с Triggering Unit'ом (юнит которого выбрали).
14
Все спасибо все работает это я не додумался имя написать вот у меня и была пустая страка
Чтобы оставить комментарий, пожалуйста, войдите на сайт.