wc3edit.net

United Warcraft 3 map hacking!
It is currently April 26th, 2024, 11:33 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: June 26th, 2011, 4:55 pm 
Offline
Newcomer

Joined: February 17th, 2011, 6:21 pm
Posts: 7
I have a weird problem concerning the kill/assist/revive trigger i use in my map.

Since the rework of my assist system it doesn't execute anymore at all, for checking i made a new trigger using the same condition and only giving me a debug msg. The debug msg works but my kill-trigger won't and i wonder how to fix this problem without reworking the entire function/trigger.

Condition:
Spoiler:
Code:
function KillCond takes nothing returns boolean
return((IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO))and(GetUnitTypeId(GetTriggerUnit())!='N00W'))
endfunction


Kill Function
Spoiler:
Code:
function KillAct takes nothing returns nothing
    local integer KillG1=5*GetHeroLevel(GetTriggerUnit())
    local integer KillG2
    local integer KillG3
    local integer AssistN=GetAssistants(GetTriggerUnit(),GetKillingUnit())
    local integer AssiG
    local integer AssiLoopI=0
    local string AssiS=""
   
    call BJDebugMsg("killcheck")
    call StartTimerBJ(av[(1+GetPlayerId(GetOwningPlayer(GetTriggerUnit())))],false,(4.+(2.*I2R(GetHeroLevel(GetTriggerUnit())))))
    if(NotKilledByCreeps())then
        set Vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]=(Vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+1)
    endif
    set Ev[(1+GetPlayerId(GetOwningPlayer(GetDyingUnit())))]=(Ev[(1+GetPlayerId(GetOwningPlayer(GetDyingUnit())))]+1)
   
    if(Team1or2())then
        set Vv[7]=(Vv[7]+1)
        set Ev[1]=(Ev[1]+1)
    else
        set Vv[1]=(Vv[1]+1)
        set Ev[7]=(Ev[7]+1)
    endif
   
    set uv[(1+GetPlayerId(GetOwningPlayer(GetTriggerUnit())))]=0
   
    if(NoDenie())then
        if(SpreeLessThan10())then
            set uv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]=(uv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+1)
        endif
       
        call SetPlayerState(GetOwningPlayer(GetTriggerUnit()),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetOwningPlayer(GetTriggerUnit()),PLAYER_STATE_RESOURCE_GOLD)-KillG1)
        if(KilledByKyuubi())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,("|c00ddc6a6Kyuubi|r has just pawned "+(vv[(1+GetPlayerId(GetTriggerPlayer()))]+"'s head.")))
        else
           
            if(SpreeLessEqual5())then
                set KillG2=50+uv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]*50
            else
                set KillG2=300
            endif
            set KillG3=KillG1+KillG2
            call SetPlayerState(GetOwningPlayer(GetKillingUnit()),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetOwningPlayer(GetKillingUnit()),PLAYER_STATE_RESOURCE_GOLD)+KillG3)
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" has just pawned "+vv[(1+GetPlayerId(GetOwningPlayer(GetTriggerUnit())))]+"'s head for |c00ffcc33"+I2S(KillG3)+"|r gold!!")             
       
            if(AssistN>0)then
                set AssiG=R2I(Factorial(AssistN+1)/Factorial(AssistN+2)*KillG3/2.5)*5+5*AssistN
                set AssiGold=AssiG
                set AssiS="|c000000FFAssists|r(|c00ffcc33"+I2S(AssiG)+"|r): "
                call ForForce(Assistants,function Assist)
                set AssiS=AssiS+SubString(AssiSP,0,StringLength(AssiSP)-1)
                call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,AssiS)
                call ForceClear(Assistants)
                set AssiSP=null
            endif
       
        endif
        if(Spree3())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" is on a |c0020c000KILLING SPREE!|r"))
            call PlaySoundBJ(Fx)
        endif
        if(Spree4())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" is |c001ce6b9DOMINATING!!|r"))
            call PlaySoundBJ(gx)
        endif
        if(Spree5())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" has a |c00fffc01MEGA KILL!!!|r"))
            call PlaySoundBJ(Gx)
        endif
        if(Spree6())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" is |c00e55bb0UNSTOPPABLE!!!|r"))
            call PlaySoundBJ(hx)
        endif
        if(Spree7())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" is |c00540081WICKED SICK!!!|r"))
            call PlaySoundBJ(Hx)
        endif
        if(Spree8())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" has a |c004e2a04MONSTER KILL!!!|r"))
            call PlaySoundBJ(jx)
        endif
        if(Spree9())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" is |c00ff8000GODLIKE!!!|r"))
            call PlaySoundBJ(Jx)
        endif
        if(Spree10())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" is |c00ff0303BEYOND GODLIKE!!!|r"))
            call PlaySoundBJ(kx)
        endif
    else
        call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+(" has denied "+(vv[(1+GetPlayerId(GetOwningPlayer(GetTriggerUnit())))]+"."))))
    endif
   
    call TriggerExecute(ao)
    call TriggerExecute(no)
   
    call QE(5.)
    if(RevivePoint1())then
        set X=GetRectCenter(Je)
    else
        set X=GetRectCenter(Se)
    endif
    call SetUnitPositionLoc(GetTriggerUnit(),X)
    call RemoveLocation(X)
    loop
        exitwhen(TimerHasEnded())
        call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL,.5))
    endloop
    call DisableTrigger(bo)
    set X=GetUnitLoc(GetTriggerUnit())
    call ReviveHeroLoc(GetTriggerUnit(),X,true)
    call EnableTrigger(bo)
    call PanCameraToTimedLocForPlayer(GetOwningPlayer(GetTriggerUnit()),X,.0)
    call RemoveLocation(X)
endfunction


Old Kill Action:
Spoiler:
Code:
function lA takes nothing returns nothing
    local integer KillG1=5*GetHeroLevel(GetTriggerUnit())
    local integer KillG2
    local integer KillG3
    local integer Assistants=LoadInteger(AssiTable,GetPlayerId(GetOwningPlayer(GetTriggerUnit())),GetPlayerId(GetOwningPlayer(GetTriggerUnit())))
    local integer AssiG
    local integer AssiLoopI=0
    local string AssiS1=""
    local string AssiS2=""
   
    call StartTimerBJ(av[(1+GetPlayerId(GetOwningPlayer(GetTriggerUnit())))],false,(4.+(2.*I2R(GetHeroLevel(GetTriggerUnit())))))
    if(NotKilledByCreeps())then
        set Vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]=(Vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+1)
    endif
    set Ev[(1+GetPlayerId(GetOwningPlayer(GetDyingUnit())))]=(Ev[(1+GetPlayerId(GetOwningPlayer(GetDyingUnit())))]+1)
   
    if(Team1or2())then
        set Vv[7]=(Vv[7]+1)
        set Ev[1]=(Ev[1]+1)
    else
        set Vv[1]=(Vv[1]+1)
        set Ev[7]=(Ev[7]+1)
    endif
   
    set uv[(1+GetPlayerId(GetOwningPlayer(GetTriggerUnit())))]=0
   
    if(NoDenie())then
        if(SpreeLessThan10())then
            set uv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]=(uv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+1)
        endif
       
        call SetPlayerState(GetOwningPlayer(GetTriggerUnit()),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetOwningPlayer(GetTriggerUnit()),PLAYER_STATE_RESOURCE_GOLD)-KillG1)
        if(KilledByKyuubi())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,("|c00ddc6a6Kyuubi|r has just pawned "+(vv[(1+GetPlayerId(GetTriggerPlayer()))]+"'s head.")))
        else
           
            if(SpreeLessEqual5())then
                set KillG2=50+uv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]*50
            else
                set KillG2=300
            endif
            set KillG3=KillG1+KillG2
            call SetPlayerState(GetOwningPlayer(GetKillingUnit()),PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(GetOwningPlayer(GetKillingUnit()),PLAYER_STATE_RESOURCE_GOLD)+KillG3)
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" has just pawned "+vv[(1+GetPlayerId(GetOwningPlayer(GetTriggerUnit())))]+"'s head for |c00ffcc33"+I2S(KillG3)+"|r gold!!")
           
            call SaveInteger(AssiTable,GetPlayerId(GetOwningPlayer(GetTriggerUnit())),GetPlayerId(GetOwningPlayer(GetTriggerUnit())),LoadInteger(AssiTable,GetPlayerId(GetOwningPlayer(GetTriggerUnit())),GetPlayerId(GetOwningPlayer(GetTriggerUnit())))-1)
            call SaveInteger(AssiTable,GetPlayerId(GetOwningPlayer(GetTriggerUnit())),GetPlayerId(GetOwningPlayer(GetKillingUnit())),0)
            if(LoadInteger(AssiTable,GetPlayerId(GetOwningPlayer(GetTriggerUnit())),GetPlayerId(GetOwningPlayer(GetTriggerUnit())))>0)then
                set AssiG=R2I(I2R(Factorial(Assistants+1))/I2R(Factorial(Assistants+2))*R2I(KillG3)/2.5)*5+5*Assistants
                set AssiS1="|c000000FFAssists|r(|c00ffcc33"+I2S(AssiG)+"|r): "
                loop
                    if(LoadInteger(AssiTable,GetPlayerId(GetOwningPlayer(GetTriggerUnit())),AssiLoopI)!=0)and(IsPlayerAlly(GetOwningPlayer(GetTriggerUnit()),Player(AssiLoopI))==false)then
                        call SaveInteger(AssiTable,GetPlayerId(GetOwningPlayer(GetTriggerUnit())),GetPlayerId(GetOwningPlayer(GetTriggerUnit())),LoadInteger(AssiTable,GetPlayerId(GetOwningPlayer(GetTriggerUnit())),GetPlayerId(GetOwningPlayer(GetTriggerUnit())))-1)
                        call SaveInteger(AssiTable,GetPlayerId(GetOwningPlayer(GetTriggerUnit())),AssiLoopI,0)
                        set AssiS2 = AssiS2+vv[1+AssiLoopI]
                        if(LoadInteger(AssiTable,GetPlayerId(GetOwningPlayer(GetTriggerUnit())),GetPlayerId(GetOwningPlayer(GetTriggerUnit())))>0)then
                            set AssiS2=AssiS2+", "
                        endif
                        call SetPlayerState(Player(AssiLoopI),ConvertPlayerState(1),GetPlayerState(Player(AssiLoopI),ConvertPlayerState(1))+AssiG)
                        set Assists[AssiLoopI+1]=Assists[AssiLoopI+1]+1
                    endif
                    exitwhen(AssiLoopI==11)
                    set AssiLoopI = AssiLoopI+1
                endloop
                set AssiS1=AssiS1+AssiS2
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,AssiS1)
            endif
       
                   
        endif
        if(Spree3())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" is on a |c0020c000KILLING SPREE!|r"))
            call PlaySoundBJ(Fx)
        endif
        if(Spree4())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" is |c001ce6b9DOMINATING!!|r"))
            call PlaySoundBJ(gx)
        endif
        if(Spree5())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" has a |c00fffc01MEGA KILL!!!|r"))
            call PlaySoundBJ(Gx)
        endif
        if(Spree6())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" is |c00e55bb0UNSTOPPABLE!!!|r"))
            call PlaySoundBJ(hx)
        endif
        if(Spree7())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" is |c00540081WICKED SICK!!!|r"))
            call PlaySoundBJ(Hx)
        endif
        if(Spree8())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" has a |c004e2a04MONSTER KILL!!!|r"))
            call PlaySoundBJ(jx)
        endif
        if(Spree9())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" is |c00ff8000GODLIKE!!!|r"))
            call PlaySoundBJ(Jx)
        endif
        if(Spree10())then
            call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+" is |c00ff0303BEYOND GODLIKE!!!|r"))
            call PlaySoundBJ(kx)
        endif
    else
        call DisplayTimedTextToForce(bj_FORCE_ALL_PLAYERS,10.,(vv[(1+GetPlayerId(GetOwningPlayer(GetKillingUnit())))]+(" has denied "+(vv[(1+GetPlayerId(GetOwningPlayer(GetTriggerUnit())))]+"."))))
    endif
   
    call TriggerExecute(ao)
    call TriggerExecute(no)
   
    call QE(5.)
    if(RevivePoint1())then
        set X=GetRectCenter(Je)
    else
        set X=GetRectCenter(Se)
    endif
    call SetUnitPositionLoc(GetTriggerUnit(),X)
    call RemoveLocation(X)
    loop
        exitwhen(TimerHasEnded())
        call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL,.5))
    endloop
    call DisableTrigger(bo)
    set X=GetUnitLoc(GetTriggerUnit())
    call ReviveHeroLoc(GetTriggerUnit(),X,true)
    call EnableTrigger(bo)
    call PanCameraToTimedLocForPlayer(GetOwningPlayer(GetTriggerUnit()),X,.0)
    call RemoveLocation(X)
endfunction


Trigger Part (only names are different rest is 100% same)
Spoiler:
Code:
set KillTrigger=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(KillTrigger,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(KillTrigger,Condition(function KillCond))
call TriggerAddAction(KillTrigger,function KillAct)


N00W is a Hero used for a spell, the different arrays are used for saving Kills/Deaths and starting the timer.
The working trigger is only 1 line sending a DebugMsg so i won't post it here.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 28 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)