Leveling attributes with triggers, some questions

Mezion

New Member
Reaction score
0
Hi :)
I'm trying to make a simple system where you can level your hero attribute by using points, stored has food (I'm using lumber for something else)

I tried with 1 hero, has follow:

Trigger:
  • Level up
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • Player - Add 1 to (Owner of (Triggering unit)) Food used


And then

Trigger:
  • Level str
    • Events
      • Player - Player 1 (Red) types a chat message containing -Add str as An exact match
    • Conditions
      • ((Triggering player) Food used) Greater than or equal to 1
    • Actions
      • Hero - Modify Strength of |cff8A2BE2Rogue|r 0002 <gen>: Add 1
      • Player - Add -1 to (Triggering player) Food used


So here how my questions:
- First, the "A unit gain a level" thing is ok but, suppose that I level up from level 4 to 6 in a shot, I'm only getting 1 food... How could I fix this?
- I couldn't find a way to make the "Player 1 (Red) types a chat message containing" looks like "A player X types a chat message(etc.)" so that I can work for any player.
- I chose a unit already on the map to test. It's working fine with it. I'm going to store each players hero has a variable when they create them, so the trigger knows what unit to boost. I'm not sure how to modifiy my trigger to find the good unit depending on who is typing. (For exemple, if player3 type -Add str, it will find Hero03 and boost it's strength)
- Last question: I know that in some games, like Burb TD, you can type something like -give 03 40 and that player will get that amount of gold. How can this be acheived? I dont see any close in the actions that might look at some numbers ritten in the chat with the message.

Sorry for all those questions at once \_\ An ty for your time :D

-Mez
 

hgkjfhfdsj

Active Member
Reaction score
55
1. one way is to store the hero's level everytime and subtract current and previous, e.g
Hashtables
Trigger:
  • Level up
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • Set TempInt = (Load 0 of (Key (Triggering Unit)) from Hashtable)
      • Player - Add ((Level of (Triggering unit)) - TempInt) to Player 1 (Red) Food used
      • Hashtable - Save (Level of (Triggering unit)) as (Key Level) of (Key (Triggering unit)) in Hashtable

2. add that event for every player, ie player 2 (blue) types, player 3 etc, in the same event block
3. good unit?? store the player hero variable in an array
4. substrings:
an example (for level up)
Trigger:
  • Level Up
    • Events
      • Player - Player 1 (Red) types a chat message containing -level as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 7)) Equal to -level
    • Actions
      • Hero - Set TempUnit Hero-level to (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string)))))), Hide level-up graphics
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top