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

[Solved] How to give item to unit after dialogue button\How to add experience to heroes in region every 30 sec

1. Hi, how to give item to unit after dialogue button is triggered?
In the beginning of game PLAYERS choose gender and spawn in general spawn and choose their briefing (biography) (dialogue button thing)
There are several biographies and when they select them, I decided that it will create item that belongs to the bio and give it to the player chest near spawn. But I wanted to give it to character that is created afterwards. Or there is another solution: each player has hero unit-backpack that is always attached to player and it can store items in it and withdraw that specific item from biography... How do I do that?

2. How to add experience to heroes in region every 30 sec? Do not give experience after heroes reach level x. I tried to create scan like trigger so it looks for matching unit is hero in region and give exp to matching unit but it stopped working smh

Set ScanTrain = units in region matching matching unit is hero - yes
Pick every unit in ScanTrain and do stuff:
Hero add level exp to picked unit show level up graphics
call destro group udg_scantrain
 

Rheiko

Spell Reviewer
Level 26
Joined
Aug 27, 2013
Messages
4,214
Isn't World Editor Helper Zone more fitting for this? Unless, you're requesting someone to make it for you?

Anyway,
The first problem can be solved by storing the option they select into a variable first, then use IF block to check which option they selected before, then simply give them the corresponding item.

The second problem should be even simpler to solve.
  • Events
    • Time - Every 30.00 seconds of game time
  • Conditions
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in YourRegion <gen>) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked unit) is alive) Equal to True
            • ((Picked unit) is A Hero) Equal to True
            • (Hero level of (Picked unit)) Less than x
          • Then - Actions
            • Hero - Add x experience to (Picked unit), Show level-up graphics
          • Else - Actions
  • Custom script: set bj_wantDestroyGroup = true
This script allows us to destroy the next created group instance, preventing memory leak.
 
Top