• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Decreasing Research Level of Player

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
Is there any possible way to reduce the research level of an upgrade for a player via trigger?

When I make a trigger to set a research level to something lower than it already is it doesn't work.

for what u want use it?
coz like was upgrades isnt decreaseable but in few case unit techtree requiment also could be solution

make weapon abilties unit depend?
u could make unit type at techtree requiment

i use it for make abilties class depend, lets say for 7 weapon, need 7 dummy unit and at abilties i make that dummy unit requiment, if u want make ability unusable then kill dummy unit and create another (example if u change bow to axe then kill bow dummy unit and create axe dummy unit).

(Unit name appear at ability requiment so unit name must be that text what u want show like requiment)

this work only if u need for few thing, so isnt complex thing coz could be sucks when in complex thing u create 100unit only for make something useable/unuseable.
 
Level 8
Joined
Sep 23, 2007
Messages
357
What I was trying to do is use an upgrade to increase/decrease the damage of a hero in my map depending on what weapon he is using. So if he equips a sword that does 10 damage, his research level for damage is set to 10, but if he unequips it and then equips a sword that does 5 damage, his research level for damage is set to 5
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
What I was trying to do is use an upgrade to increase/decrease the damage of a hero in my map depending on what weapon he is using. So if he equips a sword that does 10 damage, his research level for damage is set to 10, but if he unequips it and then equips a sword that does 5 damage, his research level for damage is set to 5

then better if u add ability and increase decrease it
udg_Abilities2[14]=custom ability based on item glove of haste, 10 lv, lv1=0, lv2=0.01...lv10=0.09
udg_Abilities2[15]=custom ability based on item glove of haste, 10 lv, lv1=0, lv2=0.1...lv10=0.9
udg_Abilities2[16]=custom ability based on item glove of haste, 10 lv, lv1=0, lv2=1...lv10=9
udg_Abilities2[17]=custom ability based on item claw of attack, 10 lv, lv1=0, lv2=1...lv10=9
udg_Abilities2[18]=custom ability based on item claw of attack, 10 lv, lv1=0, lv2=10...lv10=90
udg_Abilities2[19]=custom ability based on item claw of attack, 10 lv, lv1=0, lv2=100...lv10=900
udg_Abilities2[20]=custom ability based on item claw of attack, 10 lv, lv1=0, lv2=1000...lv10=9000

in game just use this
Set Stat_Dmg[player number of triggering player] = (Stat_Dmg[player number of triggering player] + *new item damage* - *old item damage*)
Set Stat_AttSpeed[player number of triggering player] = (Stat_AttSpeed[player number of triggering player] + *new item speed* - *old item speed*)
for dmg=Custom script: call AddDMG(true, *unit*)
for speed=Custom script: call AddDMG(false, *unit*)

u can copy jass to map header
JASS:
//damage and attack speed setting
function AddDMG takes boolean DMG, unit u returns nothing
local integer i
local integer n
local integer a1
local integer a2
local integer a3
local integer a4
local integer p = GetConvertedPlayerId(GetOwningPlayer(u))
    if ( DMG == false ) then
        set a1 = udg_Abilities2[14]
        set a2 = udg_Abilities2[15]
        set a3 = udg_Abilities2[16]
        set i = udg_Stat_AttackSpeed
        set n = i / 100 + 1 
        call SetUnitAbilityLevel( u, a3, n )
        set i = i - (i / 100) * 100
        set n = i / 10 + 1 
        call SetUnitAbilityLevel( u, a2, n )
        set i = i - (i / 10) * 10
        set n = i + 1 
        call SetUnitAbilityLevel( u, a1, n )
    else
        set a1 = udg_Abilities2[17]
        set a2 = udg_Abilities2[18]
        set a3 = udg_Abilities2[19]
        set a4 = udg_Abilities2[20]
        set i = udg_Stat_Dmg
        set n = i / 1000 + 1
        call SetUnitAbilityLevel( u, a4, n )
        set i = i - (i / 1000) * 1000
        set n = i / 100 + 1 
        call SetUnitAbilityLevel( u, a3, n )
        set i = i - (i / 100) * 100
        set n = i / 10 + 1 
        call SetUnitAbilityLevel( u, a2, n )
        set i = i - (i / 10) * 10
        set n = i + 1 
        call SetUnitAbilityLevel( u, a1, n )
    endif
set u = null
endfunction
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Modify item ability (100 levels will do).
Each level add +1 damage (level 69 will add +69 damage).
Unit pick or drop item, just increase or reduce ability level.

if no equiped item then level 0? :p
i think atleast need 2-3 ability coz isnt much that +100 damage anyway its map depend of course just i think need more and could be just lv10 then, or aint better 4 ability with 10lv than 2 with 100lv?

(i think damage could be saved to variable then set it to more variable, example 1100 damage, if x > 1000 then ability4 level = mod (x,1000)+1 if ability at lv1 give 0 dmg and same routine for 0-900, 0-99, 0-9 abilities)
 
Well you can have ability that will go from 1 to 10 (level 11 can give 0 damage)
Another one that will go from 10 to 100 (10/20/30...) (level 11 can give 0 damage)
Another one from 100 to 1000 (100/200/300...) (level 11 can give 0 damage)
....

and then just add all 3 abilities to unit.
When unit pick item then just for 2350 damage

Set Ability 4 to level 2 (2000)
Set Ability 3 to level 3 (300)
Set Ability 2 to level 5 (50)
Set Ability 1 to level 11 (0)
=
2000 + 300 + 50 + 0 = 2350

Use hashtables to setup values for each item (gosh I should create system for this ^_^)
  • // Your hash, item raw code, ability1, ability level
  • Custom script: call SaveInteger(udg_hash, ItemRawCode, 1, 11)
  • Custom script: call SaveInteger(udg_hash, ItemRawCode, 2, 5)
  • Custom script: call SaveInteger(udg_hash, ItemRawCode, 3, 3)
  • Custom script: call SaveInteger(udg_hash, ItemRawCode, 4, 2)
When unit pick up item go
  • Custom script: set udg_Ability4level = LoadInteger(udg_hash, GetItemTypeId(GetManipulatedItem()), 4)
  • Custom script: set udg_Ability3level = LoadInteger(udg_hash, GetItemTypeId(GetManipulatedItem()), 3)
  • Custom script: set udg_Ability2level = LoadInteger(udg_hash, GetItemTypeId(GetManipulatedItem()), 2)
  • Custom script: set udg_Ability1level = LoadInteger(udg_hash, GetItemTypeId(GetManipulatedItem()), 1)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Take a look at existing bonus systems. The work like this.

You create abilities, each giving bonus following 2^n.

Abil 1 bonus: 1
Abil 2 bonus: 2
Abil 3 bonus: 4
Abil 4 bonus: 8
...

With these you can give any amount you want.

+100: 64 + 32 +4

With a loop, you can add/remove the required abilities.
 
Level 8
Joined
Sep 23, 2007
Messages
357
I already made the fullscreen inventory system from scratch, and it was fully functional with the upgrades the only thing was i couldnt decrease them... and it is kinda obvious how to make the system using abilities.... i was just asking about the upgrades because it would be a hell of a lot more efficient.

Thanks for your help though
 
Status
Not open for further replies.
Top