this code I have, does a whole bunch of things, but function Alignment_Options, and the end part are really the things needed to show you,
The problem hasn't occured yet, as I only test single player, but my problem Im thinking I will have is because of these lines
JASS:
callDialogSetMessageBJ(udg_Alignment_Dialog[pn], "|cffff0000Select your alignment|r")
callDialogAddButtonBJ(udg_Alignment_Dialog[pn], "|cfffff000Become Righteous|r")
setudg_Alignment_Dialog_Button[0] = GetLastCreatedButtonBJ()
callDialogAddButtonBJ(udg_Alignment_Dialog[pn], "|cffff0000Become Unholy|r")
setudg_Alignment_Dialog_Button[1] = GetLastCreatedButtonBJ()
callDialogDisplayBJ(true, udg_Alignment_Dialog[pn], p)
callBJDebugMsg("This trigger should work, and you should see an alignment dialog, however if it doesnt or you dont see the dialog, email me at [email][email protected][/email]")
callResetTrigger(gg_trg_SelectAlignmentDialog)
callTriggerRegisterDialogEventBJ(gg_trg_SelectAlignmentDialog, udg_Alignment_Dialog[pn])
callTriggerAddAction(gg_trg_SelectAlignmentDialog, functionAlignment_Option)
its a dialog array, it adds the event that you click it to SelectAlignmentDialog (A trigger), now before it does that it resets that trigger, so im thinking, if soon as someone purchases a hero, this is going to run, and IF someone purchases a hero while someone else is, cause of ResetTrigger() its going to screw that up... Im wondering if theres an easy way to fix this
What the code does is, opens a dialog with 2 options, Become Righteous, and Become Unholy (Alignment), then sets a String to that, so you can view it, and a few other minor things, so im wondering what I should do
Is this going to be a problem?, will I have to make 11 triggers store it in a trigger variable, then add the events / and so on, to those triggers, should I not use an array dialog?
Any Idea's
(CODE BELOW)
Hidden information:
JASS:
globalsunitarrayudg_Herorectgg_rct_Rect_035booleanarrayudg_Attack_Masterybooleanarrayudg_Magic_Masterybooleanarrayudg_Strength_Masteryunitarrayudg_Backpack_Unitunittypearrayudg_Backpack_Typebooleanarrayudg_Player_Has_Bought_Herodialogarrayudg_Alignment_Dialogtriggergg_trg_SelectAlignmentDialogbuttonarrayudg_Alignment_Dialog_Buttonintegerarrayudg_Alignment_Levelbooleanarrayudg_Alignment_Boolstringarrayudg_Alignment_Stringtriggergg_trg_Move_To_Baseendglobalsfunctionsell_c1takesnothingreturnsbooleanlocalbooleanc1 = GetUnitTypeId(GetTriggerUnit()) == 'n00J'returnc1endfunctionfunctionrem_hstakesnothingreturnsnothingcallRemoveUnit(GetEnumUnit())
endfunctionfunctionAlignment_Optiontakesnothingreturnsnothinglocalintegerpn = GetPlayerId(GetTriggerPlayer())+1localstringarrayallocalintegeri = 0localbooleanarrayblocalstringarraydsetd[0] = GetPlayerName(Player(pn-1))+" has decided to become Righteous"setd[1] = GetPlayerName(Player(pn-1))+" has decided to become Unholy"setb[0] = truesetb[1] = falsesetal[0] = "You are Righteous, [Level "+I2S(udg_Alignment_Level[pn])+"]"setal[1] = "You are Unholy, [Level "+I2S(udg_Alignment_Level[pn])+"]"loopexitwheni > 1ifudg_Alignment_Dialog_Button[i] == GetClickedButtonBJ() thensetudg_Alignment_Bool[i] = b[i]
setudg_Alignment_String[i] = al[i]
callDisplayTextToForce(GetPlayersAll(), "|c00008B"+d[i]+"|r")
endifseti = i + 1endloopendfunction// if udg_Alignment_Dialog_Button[i] == GetClickedButtonBJ() then// set udg_Alignment_Dialog_Button[1] = GetLastCreatedButtonBJ()functionselltakesnothingreturnsnothinglocalunitu = GetTriggerUnit()
localunits = GetSoldUnit()
localintegerpn = GetPlayerId(GetOwningPlayer(s))+1localplayerp = Player(pn-1)
localrectr = gg_rct_Rect_035localgroupg = GetUnitsOfPlayerAndTypeId(p, 'n000')
locallocationloc = GetUnitLoc(s)
localintegerx = GetRandomInt(0,1)
setudg_Hero[pn] = scallForGroup(g, functionrem_hs)
callDisplayTextToForce(GetPlayersAll(), "|c9400D3"+GetPlayerName(p)+" has just bought the hero "+GetUnitName(s)+"|r")
callDisplayTextToPlayer(p, 0, 0, "|c8B4513The default stat that has been set is \"attack\", you can change this by typing -strength, or -magic|r")
setudg_Attack_Mastery[pn] = truesetudg_Strength_Mastery[pn] = falsesetudg_Magic_Mastery[pn] = falsecallAdjustPlayerStateBJ(400, p, PLAYER_STATE_RESOURCE_GOLD)
setudg_Backpack_Unit[pn] = CreateUnit(p, udg_Backpack_Type[x], GetRectCenterX(r), GetRectCenterY(r), 270.00)
callUnitAddTypeBJ(UNIT_TYPE_MECHANICAL, GetSoldUnit())
callSelectUnitForPlayerSingle(s, p)
setudg_Player_Has_Bought_Hero[pn] = trueifGetUnitTypeId(s) == 'N00U'thencallUnitAddAbility(s, 'A01G')
endifcallDialogSetMessageBJ(udg_Alignment_Dialog[pn], "|cffff0000Select your alignment|r")
callDialogAddButtonBJ(udg_Alignment_Dialog[pn], "|cfffff000Become Righteous|r")
setudg_Alignment_Dialog_Button[0] = GetLastCreatedButtonBJ()
callDialogAddButtonBJ(udg_Alignment_Dialog[pn], "|cffff0000Become Unholy|r")
setudg_Alignment_Dialog_Button[1] = GetLastCreatedButtonBJ()
callDialogDisplayBJ(true, udg_Alignment_Dialog[pn], p)
callBJDebugMsg("This trigger should work, and you should see an alignment dialog, however if it doesnt or you dont see the dialog, email me at [email][email protected][/email]")
callResetTrigger(gg_trg_SelectAlignmentDialog)
callTriggerRegisterDialogEventBJ(gg_trg_SelectAlignmentDialog, udg_Alignment_Dialog[pn])
callTriggerAddAction(gg_trg_SelectAlignmentDialog, functionAlignment_Option)
endfunction//===========================================================================functionInitTrig_Move_To_Basetakesnothingreturnsnothingsetgg_trg_Move_To_Base = CreateTrigger( )
callTriggerRegisterAnyUnitEventBJ(gg_trg_Move_To_Base, EVENT_PLAYER_UNIT_SELL )
callTriggerAddCondition(gg_trg_Move_To_Base, Condition(functionsell_c1))
callTriggerAddAction(gg_trg_Move_To_Base, functionsell)
endfunction