Specifying particular units for victory conditions

Asked by Travis

Trying to rewrite the victory conditions for the Human Expansion Campaign No.3 - "Once more into the Breach"

default script looks like this...

 return GetNumOpponents(GetThisPlayer()) == 0 and
    GetPlayerData(GetThisPlayer(), "UnitTypesCount", "unit-knight-rider") == 1 end,
  function() return ActionVictory() end)

I am trying to make it so once you have destroyed all the strongholds and/or fortresses, and taken Turalyon to the circle of power it then allows you to win.

So far I have tried this

  function() return GetPlayerData(4, "UnitTypesCount", "unit-stronghold") == 0 end,
  function() return IfNearUnit("this", "==", 1, "unit-knight-rider", "unit-circle-of-power") end,

  function() return ActionVictory() end)

Only trying it for one of the enemy players just to see if it works, but all I have been getting so far is constant "incorrect argument" errors. What parameters do I need to use to make it so when specific buildings/units of the enemy are destroyed, it then enables victory for the player?

Question information

English Edit question
Wargus Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
cybermind (iddqd-mail) said :

AddTrigger expects 2 arguments (condition and action) and you pass 3 - that produces crash. You should use logical operators to produce required effect, like this:
   function() return GetPlayerData(4, "UnitTypesCount", "unit-stronghold") == 0 and IfNearUnit("this", "==", 1, "unit-knight-rider", "unit-circle-of-power") end,

   function() return ActionVictory() end)

Revision history for this message
Travis (dinky-dye-aussie) said :

That worked man thanks

Can you help with this problem?

Provide an answer of your own, or ask Travis for more information if necessary.

To post a message you must log in.