• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] MPI and Lightweight?

Level 18
Joined
Mar 16, 2008
Messages
721
Players only can have 1-max Pirate Ship.

Only other problem would be 'finishes casting' and not 'finishes effect'

Figured putting a unit-type comparison would make it more lightweight? idk.

Is this good besides that?

  • Pirate ship upgrade
    • Events
      • Unit - A unit owned by Player 5 (Yellow) Finishes casting an ability
      • Unit - A unit owned by Player 6 (Orange) Finishes casting an ability
      • Unit - A unit owned by Player 7 (Green) Finishes casting an ability
      • Unit - A unit owned by Player 8 (Pink) Finishes casting an ability
      • Unit - A unit owned by Player 9 (Gray) Finishes casting an ability
      • Unit - A unit owned by Player 10 (Light Blue) Finishes casting an ability
      • Unit - A unit owned by Player 11 (Dark Green) Finishes casting an ability
      • Unit - A unit owned by Player 12 (Brown) Finishes casting an ability
      • Unit - A unit owned by Player 17 (Wheat) Finishes casting an ability
      • Unit - A unit owned by Player 18 (Peach) Finishes casting an ability
      • Unit - A unit owned by Player 19 (Mint) Finishes casting an ability
      • Unit - A unit owned by Player 20 (Lavender) Finishes casting an ability
    • Conditions
      • (Unit-type of (Casting unit)) Equal to Pirate Ship (Knight's)
      • (Ability being cast) Equal to Upgrade Ship
      • (Max HP of (Casting unit)) Equal to (Integer((Life of (Casting unit))))
    • Actions
      • Set VariableSet pirate_upgrade_player = (Owner of (Casting unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current research level of Pirate Cannons for pirate_upgrade_player) Less than (Hero level of Knight_Hero_Var[(Player number of pirate_upgrade_player)])
        • Then - Actions
          • Player - Set the current research level of Pirate Cannons to ((Current research level of Pirate Cannons for pirate_upgrade_player) + 1) for pirate_upgrade_player
          • Player - Set the current research level of Pirate Hull to ((Current research level of Pirate Cannons for pirate_upgrade_player) + 1) for pirate_upgrade_player
        • Else - Actions
 
Last edited:
Level 20
Joined
Feb 27, 2019
Messages
594
Only other problem would be 'finishes casting' and not 'finishes effect'
The finishes casting an ability event fires when the units cast animation finishes. If it doesnt finish then the event doesnt fire f.e. using Fan of Knives then ordering the unit to move before the animation finishes will not fire the finishes casting an ability event even if the effect of the ability occurs.
Figured putting a unit-type comparison would make it more lightweight? idk.
Is the unit-type comparison required? If not I dont see any reason to add it, unless the unit-type comparison is faster than the ability comparison.
Is this good besides that?
Its good enough. I dont think there is much room for improvement in efficacy but there certainly is some room, either way the improvement in the overall game would still be close to non-existent. Is the Pirate Ship (Knight's) a permanent unit?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,597
This is the ideal casting Event in most cases:
  • Unit - A unit Starts the effect of an ability
This happens when the ability executes it's effects, which implies that is has gone on cooldown/spent mana.

This is an odd way of checking if the unit is at full hp:
  • (Max HP of (Casting unit)) Equal to (Integer((Life of (Casting unit))))
Just check the percentage life:
  • (Life percentage of (Casting unit)) Equal to 100.00
Also, remember that the trigger will end early if any of the Conditions fail to be met. This means that you should order your Conditions from least expensive to most expensive. For example:

This is efficient:
  • Conditions
    • (Ability being cast) Equal to Upgrade Ship
    • (Number of units in SomeUnitGroup) Equal to 5
This is inefficient:
  • Conditions
    • (Number of units in SomeUnitGroup) Equal to 5
    • (Ability being cast) Equal to Upgrade Ship
Checking the Ability type is an easier process than counting units in a Unit Group. It also gets straight to the point, this trigger is only meant to run when a unit casts Upgrade Ship - therefore we should ask this question first since everything else becomes irrelevant if it's a different ability.
 
Top