• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Question and Problem

Status
Not open for further replies.

sentrywiz

S

sentrywiz

Sup everyone.

I have a problem and a question. They aren't related to one another. If you know one but don't know the other, just say what you think might work. Thank you

#1 Buff icons from custom pictures are green (the path is correct, they show as hotkeys) and I this problem only happens if I set the custom icon as a buff icon.

#2 Can I set maximum mana/health through triggers? I have disabled the health/mana gain through intelligence/strength and want to custom level a unit, giving it X health and mana. Can I do it via triggers or do I need to make tomes of health/mana and give them to the units when they level? Of course if you know another way, please say.
 
Level 17
Joined
Mar 21, 2011
Messages
1,611
1: normally it should work, did you import BTN and DISBTN part correctly?, maybe you forgot to change the buff to the custom one in the spell (if the ability cannot find a buff it will show green)

2: you can do it as you said with tomes, or you give each unit an ability based on the talisman of vitality life bonus. give that ability some levels
level 1: 4 life bonus
level 2: 8 life bonus
level 3 : 12 life bonus
now you can do a trigger where you set the level of the ability equal to the level of the unit, so you will get 4 life each level
 

sentrywiz

S

sentrywiz

For #2, you can use SetUnitMaxState. I've converted it to GUI, it's in this map.
There are examples in the map, I hope you can figure it out with that.
(You don't need BonusStat I believe).

#1: it shows up for me. Do you mind sending the map over?

for #1, i don't mind but i don't see why. here ill copy one link of the icon i am using whose buff icon is shown green:

-ReplaceableTextures\CommandButtons\BTNPoison Enemy (R, Active).blp
-ReplaceableTextures\CommandButtonsDisabled\DISBTNPoison Enemy (R, Active).blp

for #2, thanks thats a nice solution. i dont get it but i will figure it out eventually.

1: normally it should work, did you import BTN and DISBTN part correctly?, maybe you forgot to change the buff to the custom one in the spell (if the ability cannot find a buff it will show green)

2: you can do it as you said with tomes, or you give each unit an ability based on the talisman of vitality life bonus. give that ability some levels
level 1: 4 life bonus
level 2: 8 life bonus
level 3 : 12 life bonus
now you can do a trigger where you set the level of the ability equal to the level of the unit, so you will get 4 life each level

for #1, yes i did. the icon shows normally as a hotkey. i have BTN, DISBTN and PASBTN. i think most of the icons dont show as a buff

for #2 this is crude solution, but it works. not sure how can i hide the spell
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Don't use comma's in the path. Apparently that makes it bug.

Works: ReplaceableTextures\CommandButtons\BTNPoison Enemy (R Active).blp
Doesn't: ReplaceableTextures\CommandButtons\BTNPoison Enemy (R, Active).blp

#2: You don't understand how to use the system, or you don't understand how the system's made?

If you don't understand how to use it, this is a simple example:
  • Gain Level
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • Set Bonus_Type = 0
      • Set Bonus_Unit = (Triggering unit)
      • Set Bonus_Amount = ((Integer((Max life of Bonus_Unit))) + 50)
      • -------- Run trigger --------
      • Trigger - Run Set MaxState <gen> (ignoring conditions)
This gives the leveling hero +50 base HP.
Bonus_Type = 0 just means that you're adjusting HP (if it's 1, you're adjusting mana). Bonus_Amount is the number that Bonus_Unit's HP will be set to.
Then run the trigger and it will be done.

  • Gain Level
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • Set Bonus_Unit = (Triggering unit)
      • -------- === HP === --------
      • Set Bonus_Type = 0
      • Set Bonus_Amount = ((Integer((Max life of Bonus_Unit))) + 50)
      • Trigger - Run Set MaxState <gen> (ignoring conditions)
      • -------- === Mana === --------
      • Set Bonus_Type = 1
      • Set Bonus_Amount = ((Integer((Max mana of Bonus_Unit))) + 25)
      • Trigger - Run Set MaxState <gen> (ignoring conditions)
It will probably give a slight FPS drop the first time it is used, this can be avoided by preloading it (use it at map init).
(create dummy, set Bonus_Amount to 1, use the system for HP and mana, remove dummy).
 

sentrywiz

S

sentrywiz

GIMLI_2

I tried with giving unit item ability to modify str/int/agi, changed it to unit (doesn't matter both ways) and added levels. made trigger to increase the level of item ability on gain level, the ability increased levels via triggers, but the stats don't change.
which is dissapointing this would of been a great simple solution.

ap0calypse i see its useful but i don't understand how it works.

for example:

  • Set Bonus_Abilities[(Bonus_Int + 1)] = BonusMod - Damage (+0001)
Why is the init storing abilities with different amounts of dmg when you need to set the stat to whatever you like?

does this allow to change the values of the ability? if yes, why are there so many different abilities, when you can create one ability and modify its values to whatever you need.

since its scripts i don't get how its actually modifying the values of the stat.
 
Last edited by a moderator:
Level 28
Joined
Jan 26, 2007
Messages
4,789
Why is the init storing abilities with different amounts of dmg when you need to set the stat to whatever you like?
The bonuses are all powers of 2: it gives +1, +2, +4, +8, +16, ... bonus armor.
These armor bonuses stack. So if you give a unit the +1 armor-ability and the +4 armor-ability, he will end up with +5 armor.

does this allow to change the values of the ability?
No! Absolutely not! The system works via these powers of 2 and it's key to this system.
With 16 abilities (set up with binary values), you can generate any number between -32k and 32k.
This is extremely efficient (imagine giving a unit 32k tomes :p).

You can add/remove abilities, but it must follow the same guideline (keep in mind that the last ability must be the negative of 2 times the max ability).
The current (13 abilities) is any number between -4096 and 4095. If you need less, you can remove some abilities; if you need more, you can add some.

Of course, there are other series that can do this.
Prime numbers (you have to include 1, which isn't technially prime though) is an example that also works, but it's less efficient (16 abilities = any number between about -500 and 500).
Fibonacci numbers can do it too (16 abilities = any number between -2.5k and 2.5k)


since its scripts i don't get how its actually modifying the values of the stat.
Can I direct you to this post perhaps?

To reiterate: when you use the system to add, say "+22 armor", it does this:
(skip +32, because 32 > 22)
"add +16 armor" --> new val = 6 (22-16)
(skip +8, because 8 > 6)
"add +4 armor" --> new val = 2 (6-4)
"add +2 armor" --> new val = 0 (2-2)
(skip +1, because 1 > 0)
 

sentrywiz

S

sentrywiz

ah thanks - that makes sense. was wondering why the numbers are in Fibonacci sequence. but it didn't occur to me that you can compose any number with those numbers. that's efficient coding logic

+rep but the solution wasn't what i was looking for. its complex even though its great. i made what i want to use for leveling, but it doesn't work idk why.

basically like GIMLI_2 said, i've added item(unit) ability with X levels, gave it to the unit and set the vars like: level 1 - 0 agi, level 2 - 1 agi, level 3 - 2 agi... can you help me fix that one?

basically this is what i've done:

step 1: add item ability with X levels, each level giving +1 stats
step 2: on gain level event, increase this ability's level

but like i said it doesn't work and idk why. the unit has the ability and the ability levels up. i even tried removing the ability and adding it again with increased level. though that doesn't work either
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
(They aren't in fibonacci sequence, they're the powers of 2).
Well, the advantage of a system is that it is (usually) very easy to use, despite the possible complexity of the system itself.
You don't even need to look at the triggers to make it work :p.

Something to note about abilities with many levels: they increase loading time by quite a bit (just throwing that in here so you're not up for any surprises).
If you only need like 40 levels of them, that's pretty much fine (still increases loading time of course, but it's fine).

- For HP/Mana, your method won't work (GIMLI_2 is wrong on that one).
- For other stats, it should work just fine.
This works:
  • Add Stats
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • Unit - Increase level of Attribute Bonus for (Triggering unit)
Could you show me your triggers perhaps?
 
Status
Not open for further replies.
Top