Skip to content

[epScript] Reduce overuse of DoActions in basic actions #9

@phu54321

Description

@phu54321

Copied from phu54321/epScript#5

function afterTriggerExec() {
  while(Bring(P1, AtLeast, 1, "Zerg Drone", "Anywhere")) {
    MoveLocation("loc", "Zerg Drone", P1, "Anywhere");
    RemoveUnitAt(1, "Zerg Drone", "loc", P1);
    CreateUnit(1, "Zerg Mutalisk", "loc", P1);
  }
}

/* __epspy__ makes 3 Triggers for 3 actions, 2 objects are wasted.
def afterTriggerExec():
  if EUDWhile()(Bring(P1, AtLeast, 1, "Zerg Drone", "Anywhere")):
    DoActions(MoveLocation("loc", "Zerg Drone", P1, "Anywhere"))
    DoActions(RemoveUnitAt(1, "Zerg Drone", "loc", P1))
    DoActions(CreateUnit(1, "Zerg Mutalisk", "loc", P1))
  EUDEndWhile()
*/

It should use 1 DoActions in a series of actions for performance and map file size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions