- Joined
- Aug 31, 2006
- Messages
- 132
I don't know what's wrong with it.
To explain it. There are 2 teams. Every team has 5 players and a computer player (Orange, brown).
When the ability is used on a hero, he gets an ability which reduces sight and loses ally vision from all players from his team.
But for some reason the spell doesnt wanna do it. I even used the game message to show me who removes ally vision to whom. It said "5 unallied vision to 0", but that didnt happen, i still had vision of Orange's units. Just what is wrong with it?
*The code*
To explain it. There are 2 teams. Every team has 5 players and a computer player (Orange, brown).
When the ability is used on a hero, he gets an ability which reduces sight and loses ally vision from all players from his team.
But for some reason the spell doesnt wanna do it. I even used the game message to show me who removes ally vision to whom. It said "5 unallied vision to 0", but that didnt happen, i still had vision of Orange's units. Just what is wrong with it?
*The code*
JASS:
function Trig_InvadeMind_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'A07U' then
return true
endif
return false
endfunction
function Trig_InvadeMind_Actions takes nothing returns nothing
local unit MindInvadedHero
local integer MindLoop = 0
set MindInvadedHero = GetSpellTargetUnit()
call DisplayTimedTextToForce( GetPlayersAll(), 5.00, I2S(GetPlayerId(GetOwningPlayer(MindInvadedHero))) )
call UnitAddAbilityBJ( 'A07T', MindInvadedHero )
call DisplayTimedTextToForce( GetPlayersAll(), 5.00, "Ability added." )
call SetUnitAbilityLevelSwapped( 'A07T', MindInvadedHero, GetUnitAbilityLevelSwapped('A07U', GetSpellAbilityUnit()) )
call DisplayTimedTextToForce( GetPlayersAll(), 5.00, "Ability adjusted." )
if GetPlayerId(GetOwningPlayer(MindInvadedHero)) <= 5 then
call DisplayTimedTextToForce( GetPlayersAll(), 5.00, "Loop 1 started." )
loop
exitwhen MindLoop == 6
if GetPlayerId(GetOwningPlayer(MindInvadedHero)) != MindLoop then
call SetPlayerAllianceBJ( ConvertedPlayer(MindLoop), ALLIANCE_SHARED_VISION, false, GetOwningPlayer(MindInvadedHero) )
call DisplayTimedTextToForce( GetPlayersAll(), 5.00, I2S(MindLoop) + " unallied sight with " + I2S(GetPlayerId(GetOwningPlayer(MindInvadedHero))) )
else
endif
set MindLoop = MindLoop + 1
endloop
set MindLoop = 0
call TriggerSleepAction( 10.00 )
loop
exitwhen MindLoop == 6
if GetPlayerId(GetOwningPlayer(MindInvadedHero)) != MindLoop then
call SetPlayerAllianceBJ( ConvertedPlayer(MindLoop), ALLIANCE_SHARED_VISION, true, GetOwningPlayer(MindInvadedHero) )
else
endif
set MindLoop = MindLoop + 1
endloop
set MindLoop = 0
else
loop
exitwhen MindLoop == 6
if GetPlayerId(GetOwningPlayer(MindInvadedHero)) != (MindLoop + 6) then
call SetPlayerAllianceBJ( ConvertedPlayer(( MindLoop + 12 )), ALLIANCE_SHARED_VISION, false, GetOwningPlayer(MindInvadedHero) )
else
endif
set MindLoop = MindLoop + 1
endloop
set MindLoop = 0
call TriggerSleepAction( 10.00 )
loop
exitwhen MindLoop == 6
if GetPlayerId(GetOwningPlayer(MindInvadedHero)) != (MindLoop + 6) then
call SetPlayerAllianceBJ( ConvertedPlayer(( MindLoop + 12 )), ALLIANCE_SHARED_VISION, true, GetOwningPlayer(MindInvadedHero) )
else
endif
set MindLoop = MindLoop + 1
endloop
set MindLoop = 0
endif
endfunction
//===========================================================================
function InitTrig_InvadeMind takes nothing returns nothing
set gg_trg_InvadeMind = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_InvadeMind, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_InvadeMind, Condition( function Trig_InvadeMind_Conditions ) )
call TriggerAddAction( gg_trg_InvadeMind, function Trig_InvadeMind_Actions )
endfunction
Last edited: