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

[Trigger] My attempt at limiting an ownership command

Status
Not open for further replies.
Level 4
Joined
Jan 27, 2008
Messages
72
  • Giving Limitation
    • Events
      • Unit - A unit Changes owner
      • Unit - A unit Is attacked
    • Conditions
      • (((Triggering unit) is A structure) Equal to True) and ((Owner of (Attacking unit)) Equal to (Previous owner))
    • Actions
      • Player - Set (Previous owner) Current gold to 0
      • Player - Set (Previous owner) Current lumber to 0
In the map, there is a "-give" command, which allows players to give their bases to their allies. However, I do not want people to be able to benefit from attacking a base they have previously given to someone. I'm also wondering if the game records previous owners of things as well as I think it does.

The above is what I have so far, but I'm very skeptical if it works or not. It would probably be better to separate this into two triggers, with one turning on the another, but I'm not quite sure how the split would look like.
 
Level 8
Joined
Aug 13, 2009
Messages
466
First off, you can always test the variable's dependability ingame; seems reasonable. I can't see any (externally visible, may be internal) global variable in the API, and the function seems to be a native, so there's always the possibility.

Second, you have a problem. If this trigger happens to run first (before gold is given in whatever way you do it) and the person attacking has currently spent all his resources, he loses nothing and can potentially gain some (probably not if it's set as bounty, more likely if the resource giving is from a trigger).

Third, another abuse: If the buildings are given full life when they change owners (by being attacked, seen in some maps) the give command can potentially be used to heal buildings (give to other guy, attack it, now yours and healed).

Fourth, an option is to create a hash table storing given units and their last owner.

Fifth, some more insight into what exactly the giving function does would be good. Does it give all your buildings, or just a selected one?

Sixth, just kidding there is no sixth
 
Level 7
Joined
Apr 5, 2011
Messages
245
You want to nullify resources of player that gives his base or attacks base he gave, aren't you? This seems strange, but exactly what you did with triggers. Anyway it will not work this way, because you use 2 events and mixed condition, I mean it use Attacking Unit which defines at second event only. That's why yeah, you should separate them.
edit:
  • Giving Limitation 1
    • Events
      • Unit - A unit Changes owner
    • Conditions
      • ((Triggering unit) is A structure) Equal to True)
    • Actions
      • Player - Set (Previous owner) Current gold to 0
      • Player - Set (Previous owner) Current lumber to 0
  • Giving Limitation 2
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (((Triggering unit) is A structure) Equal to True) and ((Owner of (Attacking unit)) Equal to (Previous owner))
    • Actions
      • Player - Set (Previous owner) Current gold to 0
      • Player - Set (Previous owner) Current lumber to 0
 
Status
Not open for further replies.
Top