- Joined
- Nov 21, 2016
- Messages
- 30
I have this trigger that increase Health and Mana according of value of a integer var with these two it works well the thing i did was just copy/paste that and change it so does the same on damage but
1) it doed not add the correct value
2)it does not reduce the damage when i decrease the integer and re-set the bonus
the custom value of the item its set in another trigger that is working as intended and works like 3 ItemID combined and set on the custom value so it tears apart the value with the substrings
EDIT: SRRY found the problem i didn't change the skills values just the skills names tag solved please
1) it doed not add the correct value
2)it does not reduce the damage when i decrease the integer and re-set the bonus
-
Exemplo em GUI
-
Events
-
Unit - A unit Acquires an item
-
-
Conditions
-
(Custom value of (Item being manipulated)) Greater than 1000
-
(Unit-type of (Triggering unit)) Not equal to Shop
-
-
Actions
-
Unit - Pause (Triggering unit)
-
For each (Integer A) from 1 to 3, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z)))) Greater than or equal to 14
-
(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z)))) Less than or equal to 16
-
-
Then - Actions
-
Set HealthTrigger[(Player number of (Owner of (Triggering unit)))] = (HealthTrigger[(Player number of (Owner of (Triggering unit)))] + Health[(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z))))])
-
Set X = (X + 2)
-
Set Z = (Z + 2)
-
-
Else - Actions
-
-
-
-
Set X = 1
-
Set Z = 2
-
For each (Integer A) from 1 to 3, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z)))) Greater than or equal to 17
-
(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z)))) Less than or equal to 19
-
-
Then - Actions
-
Set ManaTrigger[(Player number of (Owner of (Triggering unit)))] = (ManaTrigger[(Player number of (Owner of (Triggering unit)))] + Mana[(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z))))])
-
Set X = (X + 2)
-
Set Z = (Z + 2)
-
-
Else - Actions
-
-
-
-
Set X = 1
-
Set Z = 2
-
For each (Integer A) from 1 to 3, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z)))) Greater than or equal to 20
-
(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z)))) Less than or equal to 22
-
-
Then - Actions
-
Game - Display to (All players) the text: (Substring((String((Custom value of (Item being manipulated)))), X, Z))
-
Game - Display to (All players) the text: (String(Damage[(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z))))]))
-
Set DamageTrigger[(Player number of (Owner of (Triggering unit)))] = (DamageTrigger[(Player number of (Owner of (Triggering unit)))] + Damage[(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z))))])
-
Set X = (X + 2)
-
Set Z = (Z + 2)
-
-
Else - Actions
-
-
-
-
Set X = 1
-
Set Z = 2
-
Set unit = (Triggering unit)
-
Set int_HP = HealthTrigger[(Player number of (Owner of (Triggering unit)))]
-
Set int_MP = ManaTrigger[(Player number of (Owner of (Triggering unit)))]
-
Set int_DB = DamageTrigger[(Player number of (Owner of (Triggering unit)))]
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
int_HP Greater than or equal to 0
-
int_HP Less than or equal to 4140
-
-
Then - Actions
-
-------- Tudo certo, só a add. --------
-
Custom script: call AddUnitLife(udg_unit, udg_int_HP)
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
int_MP Greater than or equal to 0
-
int_MP Less than or equal to 2700
-
-
Then - Actions
-
-------- Tudo certo, só a add. --------
-
Custom script: call AddUnitMana(udg_unit, udg_int_MP)
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
int_DB Greater than or equal to 0
-
int_DB Less than or equal to 1024
-
-
Then - Actions
-
-------- Tudo certo, só a add. --------
-
Game - Display to (All players) the text: (String(int_DB))
-
Game - Display to (All players) the text: (String(DamageTrigger[(Player number of (Owner of (Triggering unit)))]))
-
Custom script: call AddUnitDamage(udg_unit, udg_int_DB)
-
-
Else - Actions
-
-
Unit - Unpause (Triggering unit)
-
-
-
Exemplo em GUI Copy
-
Events
-
Unit - A unit Loses an item
-
-
Conditions
-
(Custom value of (Item being manipulated)) Greater than 1000
-
(Unit-type of (Triggering unit)) Not equal to Shop
-
-
Actions
-
Unit - Pause (Triggering unit)
-
For each (Integer A) from 1 to 3, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z)))) Greater than or equal to 14
-
(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z)))) Less than or equal to 16
-
-
Then - Actions
-
Set HealthTrigger[(Player number of (Owner of (Triggering unit)))] = (HealthTrigger[(Player number of (Owner of (Triggering unit)))] - Health[(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z))))])
-
Set X = (X + 2)
-
Set Z = (Z + 2)
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z)))) Greater than or equal to 14
-
(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z)))) Less than or equal to 16
-
-
Then - Actions
-
Set HealthTrigger[(Player number of (Owner of (Triggering unit)))] = (HealthTrigger[(Player number of (Owner of (Triggering unit)))] - Health[(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z))))])
-
Set X = (X + 2)
-
Set Z = (Z + 2)
-
-
Else - Actions
-
-
-
-
Set X = 1
-
Set Z = 2
-
For each (Integer A) from 1 to 3, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z)))) Greater than or equal to 17
-
(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z)))) Less than or equal to 19
-
-
Then - Actions
-
Set ManaTrigger[(Player number of (Owner of (Triggering unit)))] = (ManaTrigger[(Player number of (Owner of (Triggering unit)))] - Mana[(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z))))])
-
Set X = (X + 2)
-
Set Z = (Z + 2)
-
-
Else - Actions
-
-
-
-
Set X = 1
-
Set Z = 2
-
For each (Integer A) from 1 to 3, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z)))) Greater than or equal to 20
-
(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z)))) Less than or equal to 22
-
-
Then - Actions
-
Set DamageTrigger[(Player number of (Owner of (Triggering unit)))] = (DamageTrigger[(Player number of (Owner of (Triggering unit)))] - Damage[(Integer((Substring((String((Custom value of (Item being manipulated)))), X, Z))))])
-
Set X = (X + 2)
-
Set Z = (Z + 2)
-
-
Else - Actions
-
-
-
-
Set X = 1
-
Set Z = 2
-
Set unit = (Triggering unit)
-
Set int_HP = HealthTrigger[(Player number of (Owner of (Triggering unit)))]
-
Set int_MP = ManaTrigger[(Player number of (Owner of (Triggering unit)))]
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
int_HP Greater than or equal to 0
-
int_HP Less than or equal to 2700
-
-
Then - Actions
-
-------- Tudo certo, só a add. --------
-
Custom script: call RemoveUnitLife(udg_unit, udg_int_HP)
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
int_MP Greater than or equal to 0
-
int_MP Less than or equal to 4140
-
-
Then - Actions
-
-------- Tudo certo, só a add. --------
-
Custom script: call RemoveUnitMana(udg_unit, udg_int_MP)
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
int_DB Greater than or equal to 0
-
int_DB Less than or equal to 486
-
-
Then - Actions
-
-------- Tudo certo, só a add. --------
-
Custom script: call RemoveUnitDamage(udg_unit, udg_int_DB)
-
-
Else - Actions
-
-
Unit - Unpause (Triggering unit)
-
-
-
ItenVarset
-
Events
-
Time - Elapsed game time is 0.10 seconds
-
-
Conditions
-
Actions
-
-------- -------------------------------------------------------------------- --------
-
Set ItemType[ItemArray] = Agility Relic
-
Set ItenName[ItemArray] = Agility Relic
-
Set ItemValue[ItemArray] = 5
-
Set ItemId[ItemArray] = 10.00
-
-------- -------------------------------------------------------------------- --------
-
Set ItemArray = (ItemArray + 1)
-
Set ItemType[ItemArray] = Agility Stone
-
Set ItenName[ItemArray] = Agility Stone
-
Set ItemValue[ItemArray] = 2
-
Set ItemId[ItemArray] = 11.00
-
-------- -------------------------------------------------------------------- --------
-
Set ItemArray = (ItemArray + 1)
-
Set ItemType[ItemArray] = Clarity Shard
-
Set ItenName[ItemArray] = Clarity Shard
-
Set ItemValue[ItemArray] = 1
-
Set ItemId[ItemArray] = 12.00
-
-------- -------------------------------------------------------------------- --------
-
Set ItemArray = (ItemArray + 1)
-
Set ItemType[ItemArray] = Clarity Stone
-
Set ItenName[ItemArray] = Clarity Stone
-
Set ItemValue[ItemArray] = 2
-
Set ItemId[ItemArray] = 13.00
-
-------- -------------------------------------------------------------------- --------
-
Set ItemArray = (ItemArray + 1)
-
Set ItemType[ItemArray] = Health Crystal
-
Set ItenName[ItemArray] = Health Crystal
-
Set Health[ItemArray] = 230
-
Set ItemValue[ItemArray] = 3
-
Set ItemId[ItemArray] = 14.00
-
-------- -------------------------------------------------------------------- --------
-
Set ItemArray = (ItemArray + 1)
-
Set ItemType[ItemArray] = Health Relic
-
Set ItenName[ItemArray] = Health Relic
-
Set Health[ItemArray] = 380
-
Set ItemValue[ItemArray] = 5
-
Set ItemId[ItemArray] = 15.00
-
-------- -------------------------------------------------------------------- --------
-
Set ItemArray = (ItemArray + 1)
-
Set ItemType[ItemArray] = Health Shard
-
Set ItenName[ItemArray] = Health Shard
-
Set Health[ItemArray] = 85
-
Set ItemValue[ItemArray] = 1
-
Set ItemId[ItemArray] = 16.00
-
-------- -------------------------------------------------------------------- --------
-
Set ItemArray = (ItemArray + 1)
-
Set ItemType[ItemArray] = Mana Crystal
-
Set ItenName[ItemArray] = Mana Crystal
-
Set Mana[ItemArray] = 150
-
Set ItemValue[ItemArray] = 3
-
Set ItemId[ItemArray] = 17.00
-
-------- -------------------------------------------------------------------- --------
-
Set ItemArray = (ItemArray + 1)
-
Set ItemType[ItemArray] = Mana Shard
-
Set ItenName[ItemArray] = Mana Shard
-
Set Mana[ItemArray] = 85
-
Set ItemValue[ItemArray] = 1
-
Set ItemId[ItemArray] = 18.00
-
-------- -------------------------------------------------------------------- --------
-
Set ItemArray = (ItemArray + 1)
-
Set ItemType[ItemArray] = Mana Stone
-
Set ItenName[ItemArray] = Mana Stone
-
Set Mana[ItemArray] = 105
-
Set ItemValue[ItemArray] = 2
-
Set ItemId[ItemArray] = 19.00
-
-------- -------------------------------------------------------------------- --------
-
Set ItemArray = (ItemArray + 1)
-
Set ItemType[ItemArray] = Power Crystal
-
Set ItenName[ItemArray] = Power Crystal
-
Set Damage[ItemArray] = 16
-
Set ItemValue[ItemArray] = 3
-
Set ItemId[ItemArray] = 20.00
-
-------- -------------------------------------------------------------------- --------
-
Set ItemArray = (ItemArray + 1)
-
Set ItemType[ItemArray] = Power Relic
-
Set ItenName[ItemArray] = Power Relic
-
Set Damage[ItemArray] = 27
-
Set ItemValue[ItemArray] = 5
-
Set ItemId[ItemArray] = 21.00
-
-------- -------------------------------------------------------------------- --------
-
Set ItemArray = (ItemArray + 1)
-
Set ItemType[ItemArray] = Power Shard
-
Set ItenName[ItemArray] = Power Shard
-
Set Damage[ItemArray] = 6
-
Set ItemValue[ItemArray] = 1
-
Set ItemId[ItemArray] = 22.00
-
-------- -------------------------------------------------------------------- --------
-
Set ItemArray = (ItemArray + 1)
-
Set ItemType[ItemArray] = Vitality Shard
-
Set ItenName[ItemArray] = Vitality Shard
-
Set ItemValue[ItemArray] = 1
-
Set ItemId[ItemArray] = 23.00
-
-------- -------------------------------------------------------------------- --------
-
Set ItemArray = (ItemArray + 1)
-
Set ItemType[ItemArray] = Vitality Stone
-
Set ItenName[ItemArray] = Vitality Stone
-
Set ItemValue[ItemArray] = 2
-
Set ItemId[ItemArray] = 24.00
-
Set ItemArray = 25
-
-------- ------------------------------------Basics End's Here-------------------------------- --------
-
Set ItemType[ItemArray] = Gerard's Lost Ledger
-
Set ItenName[ItemArray] = Gerard's Lost Ledger
-
Set ItemRecipe[ItemArray] = RECIPE
-
Set ItemValue[ItemArray] = 5
-
Set ItemId[ItemArray] = 25.00
-
Set ItemArray = (ItemArray + 1)
-
-
-
Carregar variaveis
-
Events
-
Time - Elapsed game time is 0.00 seconds
-
-
Conditions
-
Actions
-
-------- Health --------
-
Set LB_Abilities[0] = Item Life Bonus 1
-
Set LB_Abilities[1] = Item Life Bonus 2
-
Set LB_Abilities[2] = Item Life Bonus 4
-
Set LB_Abilities[3] = Item Life Bonus 8
-
Set LB_Abilities[4] = Item Life Bonus 16
-
Set LB_Abilities[5] = Item Life Bonus 32
-
Set LB_Abilities[6] = Item Life Bonus 64
-
Set LB_Abilities[7] = Item Life Bonus 128
-
Set LB_Abilities[8] = Item Life Bonus 256
-
Set LB_Abilities[9] = Item Life Bonus 512
-
Set LB_Abilities[10] = Item Life Bonus 1024
-
Set LB_Abilities[11] = Item Life Bonus 2048
-
Set LB_Abilities[12] = Item Life Bonus 4096
-
Set LB_Abilities[13] = Item Life Bonus 8192
-
-------- O total é de 14 habilidades, mas eu comecei a registrá-las a partir do número 0 no vetor das variáveis. --------
-
Set LB_Max = 13
-
-------- Mana --------
-
Set MB_Abilities[0] = Item Mana Bonus 1
-
Set MB_Abilities[1] = Item Mana Bonus 2
-
Set MB_Abilities[2] = Item Mana Bonus 4
-
Set MB_Abilities[3] = Item Mana Bonus 8
-
Set MB_Abilities[4] = Item Mana Bonus 16
-
Set MB_Abilities[5] = Item Mana Bonus 32
-
Set MB_Abilities[6] = Item Mana Bonus 64
-
Set MB_Abilities[7] = Item Mana Bonus 128
-
Set MB_Abilities[8] = Item Mana Bonus 256
-
Set MB_Abilities[9] = Item Mana Bonus 512
-
Set MB_Abilities[10] = Item Mana Bonus 1024
-
Set MB_Abilities[11] = Item Mana Bonus 2048
-
Set MB_Abilities[12] = Item Mana Bonus 4096
-
Set MB_Abilities[13] = Item Mana Bonus 8192
-
-------- O total é de 14 habilidades, mas eu comecei a registrá-las a partir do número 0 no vetor das variáveis. --------
-
Set MB_Max = 13
-
-------- - --------
-
Set DB_Abilities[0] = Item Damage Bonus 1
-
Set DB_Abilities[1] = Item Damage Bonus 2
-
Set DB_Abilities[2] = Item Damage Bonus 4
-
Set DB_Abilities[3] = Item Damage Bonus 8
-
Set DB_Abilities[4] = Item Damage Bonus 16
-
Set DB_Abilities[5] = Item Damage Bonus 32
-
Set DB_Abilities[6] = Item Damage Bonus 64
-
Set DB_Abilities[7] = Item Damage Bonus 128
-
Set DB_Abilities[8] = Item Damage Bonus 256
-
Set DB_Abilities[9] = Item Damage Bonus 512
-
Set DB_Abilities[10] = Item Damage Bonus 1024
-
Set DB_Abilities[11] = Item Damage Bonus 2048
-
Set DB_Abilities[12] = Item Damage Bonus 4096
-
Set DB_Abilities[13] = Item Damage Bonus 8192
-
-------- O total é de 14 habilidades, mas eu comecei a registrá-las a partir do número 0 no vetor das variáveis. --------
-
Set DB_Max = 13
-
-------- - --------
-
-
JASS:
//TESH.scrollpos=33
//TESH.alwaysfold=0
function AddUnitLife takes unit u, integer amount returns nothing
local integer array y
local integer x=amount
local integer z=1
local integer i=0
if amount<1 then
loop
exitwhen i > udg_LB_Max
call UnitRemoveAbility(u, udg_LB_Abilities[i])
set i = i + 1
endloop
return
endif
loop
exitwhen z==0
set z=x/2
set y[i]=x-z* 2
set x=z
set i=i+1
endloop
set i=0
loop
exitwhen i>udg_LB_Max
if y[i]==1 then
call UnitAddAbility(u, udg_LB_Abilities[i])
else
call UnitRemoveAbility(u, udg_LB_Abilities[i])
endif
set i=i+1
endloop
endfunction
function RemoveUnitLife takes unit u, integer amount returns nothing
local integer array y
local integer x=amount
local integer z=1
local integer i=0
if amount<1 then
loop
exitwhen i > udg_LB_Max
call UnitRemoveAbility(u, udg_LB_Abilities[i])
set i = i + 1
endloop
return
endif
loop
exitwhen z==0
set z=x/2
set y[i]=x-z* 2
set x=z
set i=i+1
endloop
set i=0
loop
exitwhen i>udg_LB_Max
if y[i]==1 then
call UnitAddAbility(u, udg_LB_Abilities[i])
else
call UnitRemoveAbility(u, udg_LB_Abilities[i])
endif
set i=i+1
endloop
endfunction
function AddUnitMana takes unit u, integer amount returns nothing
local integer array y
local integer x=amount
local integer z=1
local integer i=0
if amount<1 then
loop
exitwhen i > udg_MB_Max
call UnitRemoveAbility(u, udg_MB_Abilities[i])
set i = i + 1
endloop
return
endif
loop
exitwhen z==0
set z=x/2
set y[i]=x-z* 2
set x=z
set i=i+1
endloop
set i=0
loop
exitwhen i>udg_MB_Max
if y[i]==1 then
call UnitAddAbility(u, udg_MB_Abilities[i])
else
call UnitRemoveAbility(u, udg_MB_Abilities[i])
endif
set i=i+1
endloop
endfunction
function RemoveUnitMana takes unit u, integer amount returns nothing
local integer array y
local integer x=amount
local integer z=1
local integer i=0
if amount<1 then
loop
exitwhen i > udg_MB_Max
call UnitRemoveAbility(u, udg_MB_Abilities[i])
set i = i + 1
endloop
return
endif
loop
exitwhen z==0
set z=x/2
set y[i]=x-z* 2
set x=z
set i=i+1
endloop
set i=0
loop
exitwhen i>udg_MB_Max
if y[i]==1 then
call UnitAddAbility(u, udg_MB_Abilities[i])
else
call UnitRemoveAbility(u, udg_MB_Abilities[i])
endif
set i=i+1
endloop
endfunction
function AddUnitDamage takes unit u, integer amount returns nothing
local integer array y
local integer x=amount
local integer z=1
local integer i=0
if amount<1 then
loop
exitwhen i > udg_DB_Max
call UnitRemoveAbility(u, udg_DB_Abilities[i])
set i = i + 1
endloop
return
endif
loop
exitwhen z==0
set z=x/2
set y[i]=x-z* 2
set x=z
set i=i+1
endloop
set i=0
loop
exitwhen i>udg_DB_Max
if y[i]==1 then
call UnitAddAbility(u, udg_DB_Abilities[i])
else
call UnitRemoveAbility(u, udg_DB_Abilities[i])
endif
set i=i+1
endloop
endfunction
function RemoveUnitDamage takes unit u, integer amount returns nothing
local integer array y
local integer x=amount
local integer z=1
local integer i=0
if amount<1 then
loop
exitwhen i > udg_DB_Max
call UnitRemoveAbility(u, udg_DB_Abilities[i])
set i = i + 1
endloop
return
endif
loop
exitwhen z==0
set z=x/2
set y[i]=x-z* 2
set x=z
set i=i+1
endloop
set i=0
loop
exitwhen i>udg_DB_Max
if y[i]==1 then
call UnitAddAbility(u, udg_DB_Abilities[i])
else
call UnitRemoveAbility(u, udg_DB_Abilities[i])
endif
set i=i+1
endloop
endfunction
//===========================================================================
function InitTrig_Bonus takes nothing returns nothing
endfunction
the custom value of the item its set in another trigger that is working as intended and works like 3 ItemID combined and set on the custom value so it tears apart the value with the substrings
EDIT: SRRY found the problem i didn't change the skills values just the skills names tag solved please
Last edited: