• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Computer with neutral passive unit, interrupt the order

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
this is kinda weird but allways neutral passive unit interrupt his channeling order.

i made this:
unit start casting channel then
boolean=true

if stoped casting/finish casting then
boolean=false

but its randomly will be interrupted without ordering the unit, unit dont got wander ability just sell item/sell unit/select hero/invulnarable/inventory hero

flee is off, also based on market building but with move speed, so randomly when start channel sometimes in 1st second sometimes after 2-3 second it is interrupted :/
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
I don't quite understand: Is your boolean not displaying the correct stuff or does the unit truly stop channeling?
Also, when does this occur? Does it happen when a unit enters sell range?

Btw you shouldn't make buildings able to 'walk'. Why not make it an ordinary unit in the first place?

indifferent unit or builidng, in both case stop the channeling....

also indifferent if another hero cloe or not, also tryed without select hero ability too but same,
randomly stop the order, so example he do 2x the whole channeling (each channeling 10sec) then at 3rd channeling at 1st sec he stop, i used boolean for monitor it, but it totally stop the otder

i tryed ignore guard thing for all neutral pasive unit with ai trigger thing (but acctually i dont use any ai thing but i tryed this ignore guard thing but same result)

here the trigger

JASS:
function Trig_Harvester_bot_Actions takes nothing returns nothing
    local integer i = 0
    local integer targetid
    local integer mat_filter
    local unit u
    local integer cv
    local real gtime = GetFloatGameState(GAME_STATE_TIME_OF_DAY)
local string s 
//temp string
    loop
        exitwhen i > udg_H_Max_Bot
        set u = udg_HarvesterBot[i]
        set cv = GetUnitUserData( u )
if udg_H_Channel[cv] then
set s = " Channel"   
else
set s = " Not Channel"
endif
    call DisplayTextToPlayer( Player(0),0,0, "1"+GetUnitName(u) + I2S(udg_H_Action[cv]) + GetUnitName(udg_H_Target[cv]) + s )
            if udg_H_Action[cv] != 0 and gtime < 18.00 and gtime > 6.00 then
                set udg_H_Action[cv] = 0
                call PauseUnit ( udg_HarvesterBot[i], false )
                call ShowUnit( udg_HarvesterBot[i], true )
                call DestroyEffect ( udg_H_SF[cv] )
                set udg_H_Target[cv] = null

                elseif udg_H_Action[cv] == 0 and udg_H_Target[cv] == null then

                set mat_filter = udg_H_Job[cv]
                set targetid = SearchUnitInMatList ( mat_filter, cv )
                if targetid != - 1 and not udg_H_Channel[cv] then
                    set udg_H_Target[cv] = udg_H_HUA[targetid]
                    call IssueTargetOrder( udg_HarvesterBot[i], "smart", udg_H_Target[cv] )
                    elseif not udg_H_Channel[cv] then
                    set udg_H_Action[cv] = 1
                    set udg_H_Target[cv] = null                      
                    call IssuePointOrder ( u, "move" , GetUnitX( udg_H_Home[cv] ), GetUnitY( udg_H_Home[cv] ) )
                endif
        endif
    call DisplayTextToPlayer( Player(0),0,0, "2"+GetUnitName(u) + I2S(udg_H_Action[cv]) + GetUnitName(udg_H_Target[cv]) + s )

        if not udg_H_Channel[cv] and udg_H_Target[cv] != null and udg_H_Action[cv] == 0 then
            call IssueTargetOrder( u, "smart", udg_H_Target[cv] )
        endif

       if ((( gtime > 18.00 or gtime < 6.00 ) and udg_H_Target[cv] == null and udg_H_Action[cv] == 0) and not udg_H_Channel[cv]) or (udg_H_Action[cv] == 1 and udg_H_Target[cv] == null and not udg_H_Channel[cv])  then
                    set udg_H_Action[cv] = 1
                    call IssuePointOrder ( u, "move" , GetUnitX( udg_H_Home[cv] ), GetUnitY( udg_H_Home[cv] ) )
       endif
    call DisplayTextToPlayer( Player(0),0,0, "3"+GetUnitName(u) + I2S(udg_H_Action[cv]) + GetUnitName(udg_H_Target[cv]) + s )

       set i = i + 1
    endloop
    set u = null
endfunction

//===========================================================================
function InitTrig_Harvester_bot takes nothing returns nothing
    set gg_trg_Harvester_bot = CreateTrigger( )
    call TriggerRegisterTimerEvent(gg_trg_Harvester_bot, 3.00, true)
    call TriggerAddAction( gg_trg_Harvester_bot, function Trig_Harvester_bot_Actions )
endfunction
 
Please correct the indendation ... this is unreadable :/

Also try to avoid giant AND and OR and NOT structures to improve readability. It's very likely to make a mistake there. Split them into logical units and seperate them with a new indended if.

But to answer your question: Neutral passive does nothing on its own. There must be some other trigger interfering. It's not the object data that is the problem here. The issue is with your code.
 
Status
Not open for further replies.
Top