[Trigger] Why this won't work

Status
Not open for further replies.
  • Human Lumber MIll Destroyed
  • Events
  • Unit - A unit Dies
  • Conditions
  • (Unit-type of (Dying unit)) Equal to Lumber Mill
  • (Number of units in (Units owned by (Owner of (Dying unit)) of type Lumber Mill)) Equal to 0
  • Actions
  • Player - Limit training of Blacksmith to 0 for (Owner of (Dying unit))
  • Player - Limit training of Stables to 0 for (Owner of (Dying unit))
  • Player - Limit training of Church to 0 for (Owner of (Dying unit))
  • Player - Limit training of Archer to 0 for (Owner of (Dying unit))
can someone help me D:
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
A dead unit is not nescescarily not owned. Basically the unit is still owneed by the player until it decays, which can take a while.

Try checking for all units owned by the owner of the dieing unit matching type lumbermill and is not dead (HP greater than 0).

Equally well, if you have it that buildings decay instantly it could be that dying unit is returning null.
 
Like DSG said,
  • (Number of units in (Units owned by (Owner of (Dying unit)) of type Lumber Mill)) Equal to 0
Includes dead units, such as the Lumber Mill that just died. Therefore, it will never be 0.

What I would suggest is:
  • Human Lumber Mill Destroyed
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Lumber Mill
    • Actions
      • Set TempGroup = (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to (Owner of (Triggering unit))) and ((((Matching unit) is alive) Equal to True) and ((Unit-type of (Matching unit)) Equal to Lumber Mill))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Equal to 0
        • Then - Actions
          • -------- Do Actions --------
        • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)
 
There's actually a way to deactivate a cheat, if you are able to detect which cheat was used.
A custom script:
  • Custom script: call Cheat("whosyourdaddy")
Would activate/deactivate the whosyourdaddy cheat. If the player chat event works with cheats as well, you could use this to deactivate synergy.

If it doesn't, your trigger would work.
 
There's actually a way to deactivate a cheat, if you are able to detect which cheat was used.
A custom script:
  • Custom script: call Cheat("whosyourdaddy")
Would activate/deactivate the whosyourdaddy cheat. If the player chat event works with cheats as well, you could use this to deactivate synergy.

If it doesn't, your trigger would work.

it won't work, tried it before, the game do not recognize the string whosyourdaddy and returns the string Cheat Eneabled! if you use the player chat event.
 
Oh yeah, I had a lot of problems back then in GUI with match strings and cheats.

Edit:
JASS:
scope test initializer init

    private function defeat takes nothing returns nothing
        if GetEventPlayerChatString() == "whosyourdaddy" then
            call MeleeDoDefeat(Player(0))
        endif
    endfunction

    private function init takes nothing returns nothing
        local trigger t = CreateTrigger()
        
        call TriggerAddAction(t, function defeat)
        call TriggerRegisterPlayerChatEvent(t, Player(0), "", false)
    endfunction

endscope

Can you try this and type whosyourdaddy?
 
Status
Not open for further replies.
Top