- Joined
- Oct 31, 2007
- Messages
- 30
It seems that every time this particular if clause is executed the involved tech building loses the ability to upgrade to any other building i.e. the buttons stay grayed out, whether the upgrade order was finished or aborted. The trigger fires on all research finished events, the if when the finished research is the one that the player selected to repeat endlessly (until resources run out). All techs have multiple levels.
Am I right in my assumption that IssueImmediateOrderById() does not do the same as adding objects to the queue manually? Because I observed that orders given with this function have precedence over the queue. Or am I just doing something wrong?
And here - should it be of any importance - the trigger that sets the ai_repeat variables:
Any help would be appreciated.
EDIT: Could a mod please move this to the correct subforum? I overlooked it, sorry.
Could a mod please move this to the Jass Scripting forum? I overlooked it, sorry.
JASS:
function Trig_ResearchPoints_Actions takes nothing returns nothing
//...
//stuff that gets called all the time and never caused problems..basically some global var maths
//...
if ( GetResearched() == udg_ai_repeat_order_tech[GetUnitUserData(GetResearchingUnit())] or GetResearched() == udg_ai_repeat_order_civic[GetUnitUserData(GetResearchingUnit())] ) then
call IssueImmediateOrderById( GetResearchingUnit(), GetResearched() )
endif
endfunction
//===========================================================================
function InitTrig_ResearchPoints takes nothing returns nothing
set gg_trg_ResearchPoints = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ResearchPoints, EVENT_PLAYER_UNIT_RESEARCH_FINISH )
call TriggerAddAction( gg_trg_ResearchPoints, function Trig_ResearchPoints_Actions )
endfunction
Am I right in my assumption that IssueImmediateOrderById() does not do the same as adding objects to the queue manually? Because I observed that orders given with this function have precedence over the queue. Or am I just doing something wrong?
And here - should it be of any importance - the trigger that sets the ai_repeat variables:
JASS:
function Trig_ResearchAutoOrder_Actions takes nothing returns nothing
if ( udg_ai_repeat_next[GetPlayerId(GetOwningPlayer(GetResearchingUnit()))+1] == true or udg_ai_repeat_always[GetPlayerId(GetOwningPlayer(GetResearchingUnit()))+1] == true ) then
set udg_ai_repeat_next[GetPlayerId(GetOwningPlayer(GetResearchingUnit()))+1] = false
call DisplayTimedTextToPlayer( GetOwningPlayer(GetResearchingUnit()), 0.0, 0.0, udg_ply_set_msg[GetPlayerId(GetOwningPlayer(GetResearchingUnit()))+1], ( "Repeat: " + GetObjectName(GetResearched()) ) )
if ( IsUnitInGroup(GetResearchingUnit(), udg_UG_TechCenter) ) then
set udg_ai_repeat_order_tech[GetUnitUserData(GetResearchingUnit())] = GetResearched()
endif
if ( IsUnitInGroup(GetResearchingUnit(), udg_UG_ProdCenter) ) then
set udg_ai_repeat_order_civic[GetUnitUserData(GetResearchingUnit())] = GetResearched()
endif
elseif ( IsUnitInGroup(GetResearchingUnit(), udg_UG_TechCenter) and udg_ai_repeat_order_tech[GetUnitUserData(GetResearchingUnit())] != GetResearched() ) then
set udg_ai_repeat_order_tech[GetUnitUserData(GetResearchingUnit())] = 'R01P' //Dummy Upgrade "Do Nothing"
elseif ( IsUnitInGroup(GetResearchingUnit(), udg_UG_ProdCenter) and udg_ai_repeat_order_civic[GetUnitUserData(GetResearchingUnit())] != GetResearched() ) then
set udg_ai_repeat_order_civic[GetUnitUserData(GetResearchingUnit())] = 'R01P'
endif
endfunction
//===========================================================================
function InitTrig_ResearchAutoOrder takes nothing returns nothing
set gg_trg_ResearchAutoOrder = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ResearchAutoOrder, EVENT_PLAYER_UNIT_RESEARCH_START )
call TriggerAddAction( gg_trg_ResearchAutoOrder, function Trig_ResearchAutoOrder_Actions )
endfunction
Any help would be appreciated.
EDIT: Could a mod please move this to the correct subforum? I overlooked it, sorry.
Could a mod please move this to the Jass Scripting forum? I overlooked it, sorry.
Last edited by a moderator: