1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Weave light to take you to your highest hopes - the 6th Special Effect Contest is here!
    Dismiss Notice
  4. Lead your forces to battle in the 15th Techtree Contest. The call is yours, commander!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Change the time for a spell or effect to resolve?

Discussion in 'StarCraft II Modding' started by Kabel, Jan 1, 2012.

  1. Kabel

    Kabel

    Joined:
    Nov 5, 2008
    Messages:
    535
    Resources:
    0
    Resources:
    0
    Is it possible to change the time it takes for a spell or effect to resolve?

    For example, when I click burrow on a lurker, it burrows immediately. Can a 2 sec delay be added? When I press burrow, it takes 2 seconds before it begins it´s burrow order, OR it burrows 2 seconds slower, so it looks like it burrows in slow motion?

    The same goes with the spider mine. When a target comes close to the mine, it pops up from the ground, waits 2 seconds, and then follows it´s target and blows up.

    How can this be done? I can´t really find any field to edit it.
     
  2. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,996
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Yes this is possible. Just add a duration to the burrow morph. That way it will be stuck in borrowing morph for a period of time and not be able to do anything during that time. Animations might need some actor changes to match the delay though.

    The field is part of the morph information (where you specify morphs the unit is allowed to make and the appropiate stats that accompany them).

    Look into the mechanics of how a spider mine opperates. You will probably need to add an extra effect with the purpose of just delaying the actions of the mine.
     
  3. Kabel

    Kabel

    Joined:
    Nov 5, 2008
    Messages:
    535
    Resources:
    0
    Resources:
    0
    I have found a way to make the spider mine pop up from the ground slower. For some reason the spider mine won´t follow it´s target if the target gets to far away.

    For example, a fast zergling runs past the mine. The Mine unburrows at a slower pace. Since the zergling is to far away when the mine has unburrowed, the mine burrows back again.


    Anyone knows how to change how far the spider mine can follow an enemy?
     
    Last edited: Feb 20, 2012
  4. BlueBerryWizard

    BlueBerryWizard

    Joined:
    Aug 13, 2007
    Messages:
    309
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Code (vJASS):
    // Unit behaviors

    // Behavior categories
    const int c_unitBehaviorFlagPermanent           = 0;
    const int c_unitBehaviorFlagRestorable          = 1;
    const int c_unitBehaviorFlagTemporary           = 2;
    // Behavior buff flags
    const int c_unitBehaviorFlagChanneled           = 3;
    const int c_unitBehaviorFlagChanneling          = 4;
    const int c_unitBehaviorFlagCountdown           = 5;
    const int c_unitBehaviorFlagExtend              = 6;
    const int c_unitBehaviorFlagDisableBuilding     = 7;
    const int c_unitBehaviorFlagRemoveDamageResponseExhausted = 8;
    const int c_unitBehaviorFlagRefreshStack        = 9;
    // Behavior info flags
    const int c_unitBehaviorFlagHidden              = 10;
    // Behavior count
    const int c_unitBehaviorCountAll                = -1;

    native void     UnitBehaviorAdd (unit inUnit, string inBehavior, unit inCaster, int inCount);
    native void     UnitBehaviorAddPlayer (unit inUnit, string inBehavior, int inPlayer, int inCount);
    native int      UnitBehaviorCountAll (unit inUnit);
    native int      UnitBehaviorCount (unit inUnit, string inBehavior);
    native fixed    UnitBehaviorDuration (unit inUnit, string inBehavior);
    native void     UnitBehaviorSetDuration (unit inUnit, string inBehavior, fixed inDuration);
    native bool     UnitBehaviorEnabled (unit inUnit, string inBehavior);
    native string   UnitBehaviorGet (unit inUnit, int inIndex);
    native bool     UnitHasBehavior (unit inUnit, string inBehavior);
    native void     UnitBehaviorRemove (unit inUnit, string inBehavior, int inCount);
    native void     UnitBehaviorRemovePlayer (unit inUnit, string inBehavior, int inPlayer, int inCount);
    native void     UnitBehaviorTransfer (unit inSource, unit inDest, string inBehavior, int inCount);
    native bool     UnitBehaviorHasFlag (string inBehavior, int inCategory);
    native void     UnitBehaviorRemoveCategory (unit inUnit, int inCategory);

    native void     UnitBehaviorAddChargeRegen (unit inUnit, string inBehavior, string inCharge, fixed inVal);
    native fixed    UnitBehaviorGetChargeRegen (unit inUnit, string inBehavior, string inCharge);
    native void     UnitBehaviorAddChargeUsed (unit inUnit, string inBehavior, string inCharge, fixed inVal);
    native fixed    UnitBehaviorGetChargeUsed (unit inUnit, string inBehavior, string inCharge);

    native void     UnitBehaviorAddCooldown (unit inUnit, string inBehavior, string inCooldown, fixed inVal);
    native fixed    UnitBehaviorGetCooldown (unit inUnit, string inBehavior, string inCooldown);

    native void     UnitXPGainEnable (unit inUnit, string inBehavior, bool inEnable);

    // Unit markers
    native marker   UnitMarker (unit inUnit, int inIndex);
    native void     UnitMarkerAdd (unit inUnit, marker inMarker);
    native int      UnitMarkerCount (unit inUnit, marker inMarker);
    native void     UnitMarkerRemove (unit inUnit, marker inMarker);


    Notice this line:
    Code (vJASS):
    native void     UnitBehaviorSetDuration (unit inUnit, string inBehavior, fixed inDuration);


    You use that line for example,
    Code (vJASS):
    UnitBehaviorSetDuration(lv_u, "BroodlingFate", 1.0);


    Doing that would, assuming you have this behavior applied to the unit, set it to last 1.0 seconds before the broodling meets its fate. I've used this for applying a timed life to projectiles.