• 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.

Little help with my formula?

Status
Not open for further replies.
Level 11
Joined
May 13, 2010
Messages
167
Hello there! I've created a simple formula in 5 minutes to penalty dying heroes in mi rpg. The system works by decreasing hero experiencie, player gold and hero stats based on the dying hero's level.

  • Herodies
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set HeroDie = (Triggering unit)
      • Set HeroLvl = (Real((Hero level of HeroDie)))
      • Set HeroExpLoss = ((Real((Hero experience of HeroDie))) / 5.00)
      • Set HeroGoldLoss = (HeroLvl x 300.00)
      • Set HeroStatLoss = (HeroLvl x 0.35)
      • Wait 10.00 seconds
      • Hero - Instantly revive HeroDie at (Center of Region 039 <gen>), Show revival graphics
      • Hero - Set HeroDie experience to ((Hero experience of HeroDie) - (Integer(HeroExpLoss))), Hide level-up graphics
      • Player - Set (Owner of HeroDie) Current gold to (((Owner of HeroDie) Current gold) - (Integer(HeroGoldLoss)))
      • Hero - Modify Strength of HeroDie: Subtract (Integer(HeroStatLoss))
      • Hero - Modify Agility of HeroDie: Subtract (Integer(HeroStatLoss))
      • Hero - Modify Intelligence of HeroDie: Subtract (Integer(HeroStatLoss))
      • Game - Display to (Player group((Owner of HeroDie))) the text: (La muerte te ha costado: |cffDEA510I + ((String(HeroExpLoss)) + ( |rde experiencia, |cffDEA510I + ((String(HeroGoldLoss)) + ( |rde oro, y |cffDEA510I + ((String(HeroStatLoss)) + ( |r de atributos + !)))))))
When i test it, the variable's values loss is somehow balanced (though not what i expected) and the shown text is not exactly the same value. What am i doing wrong? Thanks in adavance! :grin:
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
This system is not MUI. If another hero dies within 10 seconds of the previous hero dying, it will override the values and the first dying hero will not receive the correct penalties. Also, you have a leak (revive hero at center of region 039).

I could write the vJASS version for you if you want?
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
I have a problem: I don't think you can subtract experience from a hero. I tried and it seemed I can only add experience...

Is this correct (I don't know Spanish):

"La muerte te ha costado: XPde experiencia, GOLDde oro, y STATS de atributos!"

"XP", "GOLD" & "STATS" will obviously show as the actual numbers in-game, this is just showing the format. An example could be:

"La muerte te ha costado: 150de experiencia, 600de oro, y 2 de atributos!"

Is this correct?
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
I have a problem: I don't think you can subtract experience from a hero. I tried and it seemed I can only add experience...

You can Set the experience of a hero instead of adding it, simply set it to the current experience - ....
If you want to de-level the hero, you simply set the experience and then set the level of the hero to the corresponding experience.
A simple condition that checks if the experience - experience penalty < some exp needed for a specific level can fix this.

I don't have the editor open but as I recall from my personal experience I did it before so it is possible...
There should be an action out there to set the experience instead of adding it.

EDIT: I didn't really look at the first post (doh)
Can't you simply do what the OP did in post 1?

EDIT 2: and yes it is also possible to substract gold from a player and stats from a hero...
You did it in your first trigger so it's definitly possible in Jass and vJass too, since GUI simply calls Jass natives.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
@Hashjie:
I tested it by setting the hero level to the maximum (10) and then trying to remove experience. It didn't work.

It's hard for me to check since I'm at work, could you perhaps tell me what the amount of experience is when the hero is on it's max lvl?
Also, have you tryed displaying the amount of exp for the hero when at max lvl and when decreased? It might be that the bar shows as if it is full even though it did decrease, or that the experience gets set to its maximum since the hero is on it's maximum level?

I'm not sure since I can't check :(
 
Level 11
Joined
May 13, 2010
Messages
167
@Hashjie:
I tested it by setting the hero level to the maximum (10) and then trying to remove experience. It didn't work.

@BeTaGod-:
You didn't answer my question: is the Spanish text in my previous post correct, i.e. correct grammar etc?

That is perfetc. Btw, there is no problem at all if there is no possible way of substract XP, GOLD and STAT penalty is just enough

Don't even worry about the exp..not THAT important
 
Status
Not open for further replies.
Top