For some reason, W.E can't read the custom value although we have successfully saved the value, but when we view it, it turns "0".
Trigger:
- Buy Gun
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- Actions
- For each (Integer A) from 1 to BUY_Number_of_guns, do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Ability being cast) Equal to CON_GUN_Buy_ability[(Integer A)]
- Then - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Custom value of (Casting unit)) Equal to 0
- (Unit-type of (Casting unit)) Equal to Asian Peasant
- Then - Actions
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- CON_GUN_REQ_Melee_Open[(Integer A)] Equal to 0
- Then - Actions
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- UNIT_SLOT_Melee[(Custom value of (Casting unit))] Equal to 0
- Then - Actions
- Else - Actions
- Game - Display to (Player group((Owner of (Casting unit)))) the text: (|cffD20000You cannot hold a |cff5ACE52 + (CON_GUN_Name[(Integer A)] + ( |cffD20000with your |cff5ACE52 + (CON_GUN_Name[UNIT_SLOT_Melee[(Custom value of (Casting unit))]] + |r))))
- Skip remaining actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- CON_GUN_REQ_SLOT_1_Open[(Integer A)] Equal to 0
- Then - Actions
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- UNIT_SLOT_GUN_1[(Custom value of (Casting unit))] Equal to 0
- Then - Actions
- Else - Actions
- Game - Display to (Player group((Owner of (Casting unit)))) the text: (|cffD20000You cannot hold a |cff5ACE52 + (CON_GUN_Name[(Integer A)] + ( |cffD20000with your |cff5ACE52 + (CON_GUN_Name[UNIT_SLOT_GUN_1[(Custom value of (Casting unit))]] + |r))))
- Skip remaining actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- CON_GUN_REQ_SLOT_2_Open[(Integer A)] Equal to 0
- Then - Actions
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- UNIT_SLOT_GUN_2[(Custom value of (Casting unit))] Equal to 0
- Then - Actions
- Else - Actions
- Game - Display to (Player group((Owner of (Casting unit)))) the text: (|cffD20000You cannot hold a |cff5ACE52 + (CON_GUN_Name[(Integer A)] + ( |cffD20000with your |cff5ACE52 + (CON_GUN_Name[UNIT_SLOT_GUN_2[(Custom value of (Casting unit))]] + |r))))
- Skip remaining actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- -------- -- --------
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- ((Owner of (Casting unit)) Current gold) Greater than or equal to CON_GUN_Price[(Integer A)]
- Then - Actions
- Else - Actions
- Game - Display to (Player group((Owner of (Casting unit)))) the text: (|cffD20000You are |cffD3B823 + ((String((CON_GUN_Price[(Integer A)] - ((Owner of (Casting unit)) Current gold)))) + ( Gold|r |cffD20000short of buying a |cff5ACE52 + (CON_GUN_Name[(Integer A)] + |r))))
- Skip remaining actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Unit-type of (Casting unit)) Equal to Asian Peasant
- Then - Actions
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Custom value of (Casting unit)) Equal to 0
- Then - Actions
- Set BUY_Counter[(Player number of (Owner of (Casting unit)))] = (BUY_Counter[(Player number of (Owner of (Casting unit)))] + 1)
- Unit - Set the custom value of (Casting unit) to ((10000 x (Player number of (Owner of (Casting unit)))) + BUY_Counter[(Player number of (Owner of (Casting unit)))])
- Set CUR_UNIT_LOC[(Custom value of (Picked unit))] = (Position of (Casting unit))
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- -------- -- --------
- Set BUY_UNIT[(Player number of (Owner of (Casting unit)))] = (Casting unit)
- Player - Set (Owner of (Casting unit)) Current gold to (((Owner of (Casting unit)) Current gold) - CON_GUN_Price[(Integer A)])
- Hero - Create CON_GUN_Item[(Integer A)] and give it to (Casting unit)
- Set ITEM_GUN_ID_gen[(Player number of (Owner of (Casting unit)))] = (ITEM_GUN_ID_gen[(Player number of (Owner of (Casting unit)))] + 1)
- Item - Set the custom value of (Last created item) to ITEM_GUN_ID_gen[(Player number of (Owner of (Casting unit)))]
- Unit Group - Add (Casting unit) to ATTACK_Pick_group[CON_GUN_Type[(Integer A)]]
- Set CUR_GUN_Ammo_max[(Custom value of (Last created item))] = CON_GUN_Ammo_Max[(Integer A)]
- Set BUY_GUN[(Player number of (Owner of (Casting unit)))] = (Last created item)
- Dialog - Change the title of BUY_Dialog to Coose your bullet t...
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- CON_GUN_Type[(Integer A)] Equal to 9
- Then - Actions
- Set UNIT_SLOT_Melee_Item[(Custom value of (Casting unit))] = (Last created item)
- Game - Display to (All players) the text: weapon in slot mele...
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- UNIT_SLOT_GUN_1[(Custom value of (Casting unit))] Equal to 0
- Then - Actions
- Game - Display to (All players) the text: weapon in slot 1
- Set UNIT_SLOT_GUN_1[(Custom value of (Casting unit))] = (Integer A)
- Set UNIT_SLOT_GUN_1_Item[(Custom value of (Casting unit))] = (Last created item)
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- UNIT_SLOT_GUN_2[(Custom value of (Casting unit))] Equal to 0
- Or - Any (Conditions) are true
- Conditions
- CON_GUN_Type[(Integer A)] Equal to 1
- CON_GUN_Type[(Integer A)] Equal to 2
- Conditions
- Then - Actions
- Set UNIT_SLOT_GUN_2[(Custom value of (Casting unit))] = (Integer A)
- Set UNIT_SLOT_GUN_2_Item[(Custom value of (Casting unit))] = (Last created item)
- Game - Display to (All players) the text: weapon in slot 2
- Else - Actions
- Game - Display to (Player group((Owner of (Casting unit)))) the text: |cffD20000Error Ite...
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- For each (Integer B) from 1 to BULLET_Number_of_Bullets, do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Integer((Substring(BULLET_Compatibility[(Integer B)], CON_GUN_Type[(Integer A)], CON_GUN_Type[(Integer A)])))) Equal to 1
- BULLET_Cost[(Integer B)] Less than or equal to ((Owner of (Casting unit)) Current gold)
- Then - Actions
- Set BULLET_DIA_TXT[(Integer B)] = ((|cffDCBA00 + ((String(BULLET_Cost[(Integer B)])) + ( g |cff94FF54 + (BULLET_Abbre[(Integer B)] + |cffFFFF19)))) + BULLET_Description[(Integer B)])
- Dialog - Create a dialog button for BUY_Dialog labelled BULLET_DIA_TXT[(Integer B)]
- Set BUY_Dialog_Button[(((Player number of (Owner of (Casting unit))) x 10000) + (Integer B))] = (Last created dialog Button)
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- Dialog - Show BUY_Dialog for (Owner of (Casting unit))
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- For each (Integer A) from 1 to BUY_Number_of_guns, do (Actions)
- Events
Trigger:
- Buy bullet 1
- Events
- Dialog - A dialog button is clicked for BUY_Dialog
- Conditions
- Actions
- Game - Display to (All players) the text: (String((Custom value of BUY_UNIT[(Player number of (Triggering player))])))
- Game - Display to (All players) the text: (String(UNIT_SLOT_GUN_1[(Custom value of BUY_UNIT[(Player number of (Triggering player))])]))
- For each (Integer A) from 1 to BULLET_Number_of_Bullets, do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Clicked dialog button) Equal to BUY_Dialog_Button[((1 x 10000) + (Integer A))]
- Then - Actions
- Hero - Create BULLET_Item[(Integer A)] and give it to BUY_UNIT[1]
- Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - BULLET_Cost[(Integer A)])
- Set CUR_GUN_Coldown_Multi[(Custom value of BUY_GUN[(Player number of (Triggering player))])] = BULLET_Cooldown_Multi[(Integer A)]
- Set CUR_GUN_Damage_Multi[(Custom value of BUY_GUN[(Player number of (Triggering player))])] = BULLET_Damage_multi[(Integer A)]
- Set CUR_GUN_Range_Multi[(Custom value of BUY_GUN[(Player number of (Triggering player))])] = BULLET_Range_Multi[(Integer A)]
- Set CUR_GUN_Recoil_Multi[(Custom value of BUY_GUN[(Player number of (Triggering player))])] = BULLET_Recoil_Multi[(Integer A)]
- Set CUR_GUN_Reload_Multi[(Custom value of BUY_GUN[(Player number of (Triggering player))])] = BULLET_Reload_Multi[(Integer A)]
- Dialog - Clear BUY_Dialog
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- Events