unit sell unit bug when adding Condition

Yoshii

New Member
Reaction score
74
Hero is created
Trigger:
  • Events
    • Unit - A unit Sells a unit
    • Conditions
    • Actions
      • Set PlayerHasHero[(Player number of (Owner of (Buying unit)))] = True
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by (Owner of (Buying unit))) and do (Unit - Remove (Picked unit) from the game)
      • Unit - Create 1 (Unit-type of (Sold unit)) for (Owner of (Buying unit)) at (Random point in Start <gen>) facing Default building facing degrees

this is my trigger that work fine, I buy a hero from a tavern and everything but the hero created is deleted for the player.However since my map use save/load i need to have a variable in place that tell me if player already has a hero thus I Created an array Boolean named PlayerHasHero.

However when I write
Trigger:
  • Hero is created
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • PlayerHasHero[(Player number of (Owner of (Buying unit)))] Equal to False
      • Actions
        • Set PlayerHasHero[(Player number of (Owner of (Buying unit)))] = True
        • Unit Group - Pick every unit in (Units in (Playable map area) owned by (Owner of (Buying unit))) and do (Unit - Remove (Picked unit) from the game)
        • Unit - Create 1 (Unit-type of (Sold unit)) for (Owner of (Buying unit)) at (Random point in Start <gen>) facing Default building facing degrees

The game does run the whole thing and set the playerhashero correct but Im im still able to click and get more hero even tho its set to TRUE; I dont get it I tried everything from buying,trigger,sold unit and it just wont accept anthing when I setup the array has a condition before running the trigger

anyone know why?
 

HydraRancher

Truth begins in lies
Reaction score
197
Whats up with your trigger? your actions are coming out of your conditions o_O

instead of

PlayerHasHero[(Player number of (Owner of (Buying unit)))]

do

PlayerHasHero[(Player number of (Owner of (Triggering unit)))]

might aswell try
 

Yoshii

New Member
Reaction score
74
Whats up with your trigger? your actions are coming out of your conditions o_O

instead of

PlayerHasHero[(Player number of (Owner of (Buying unit)))]

do

PlayerHasHero[(Player number of (Owner of (Triggering unit)))]

might aswell try

as soon as you set up the playerhashero array to triggering unit the game let you create more hero if you click the tavern. The game just ignore the condition

edit: Beside since the unit doing the actual triggering is neutral( the building)(because its a unit sell a unit meaning neutral is selling a unit) so you cant refer to triggering unit because there are none beside the tavern owned by neutral.

also not only is the condition being bypass but It does not delete the additional hero either, I can make 50s if i wanted to when I use the array as cond
 

vypur85

Hibernate
Reaction score
803
Errr... Because you trained the unit? Which is why you get a unit?

Seems like you're creating 2 units now.

With the trigger on:
You remove the sold unit and create another unit.

With the trigger off conditionally:
You train a unit.

So, regardless of whether you have the trigger or not, you will still train something... Is that it? Or am I missing something?
 

Yoshii

New Member
Reaction score
74
Errr... Because you trained the unit? Which is why you get a unit?

Seems like you're creating 2 units now.

With the trigger on:
You remove the sold unit and create another unit.

With the trigger off conditionally:
You train a unit.

So, regardless of whether you have the trigger or not, you will still train something... Is that it? Or am I missing something?
WoW thx I been trying to figured that bug for awhile and it did not make sense, I totally forgot about the unit trained counting I was thinking that the shop doesnt create anything without trigger:).

heres my revised trigger

Hero is created
Trigger:
  • Events
    • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • If (PlayerHasHero[(Player number of (Owner of (Buying unit)))] Equal to False) then do (Set PlayerHasHero[(Player number of (Owner of (Buying unit)))] = True) else do (If (PlayerHasHero[(Player number of (Owner of (Buying unit)))] Equal to True) then do (Unit - Remove (Sold unit) from the game) else do (Do nothing))

+rep but I dont think you need actually need it
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top