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

Adding multiple rewards to claim to a single building.

Status
Not open for further replies.
Level 4
Joined
Jan 18, 2019
Messages
71
On my map, I have a system in which a player receives rewards in a building. As it stands, at the moment, I am adding abilities to the building, the player casts the ability, and then the trigger function allows them to gain the reward by detecting the spell. The issue with this system is that if multiple rewards, using the same ability, are inside it and clicked, they both go off.

My question is, is there a better system or option than using abilities?

Thank you!
 
Level 3
Joined
Jul 28, 2014
Messages
29
You could create a integer Variable,

If multiple players need to recieve rewards make it an array, then when you use the variable set the array to,
Player number(owner of unit(triggering unit)))

Now I assume you want the rewards to only go off once.

Event:
-Unit finishes casting an ability
Condition:
-Ability being cast equal to Blah
-Interger less than 2
Event:
-If, than, else, multiple functions:
If Condition:
-interger equal to 0
Then:
-Reward #1
-Set Interger equal to 1
Else:
-Reward #2
-Set Interger equal to 2
 
Level 3
Joined
Nov 12, 2018
Messages
43
You could check for OrderID instead. To get the orderID, use this trigger:
  • Get OrderID
    • Ereignisse
      • Einheit - A unit Erhält einen auf ein Objekt zielenden Befehl
      • Einheit - A unit Erhält einen auf einen Punkt zielenden Befehl
      • Einheit - A unit Erhält einen Befehl ohne Ziel
      • Einheit - A unit Fängt an zu bauen
    • Bedingungen
    • Aktionen
      • Custom script: call BJDebugMsg(I2S(GetIssuedOrderId()))
This should display an integer ingame, which you can use like this:
  • Unbezeichneter Auslöser 001
    • Ereignisse
    • Bedingungen
    • Aktionen
      • Custom script: if ( GetGetIssuedOrderId(TriggerUnit()) == 851983 ) then
      • -------- Do stuff... --------
      • Custom script: endif
Each ability has it's unique orderID.

*Sorry for german GUI
 
Status
Not open for further replies.
Top