• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

I Don't Understand Actor Messages

Status
Not open for further replies.
Actor messages; how DO they work?

I can not find any sources to read on actor messages and really do not understand how they work. I've been trying to change a death model for an actor and can't figure it out. I reckon I'll have to use actor messagesfor attaching models to specific points on a unit such a putting a turret on the back of a truck or a gun in the hands of a marine.

These are the only things I have figured out. Changing the units main model (doesn't change death model) and changing the tint of the unit,
JASS:
int gf_ProjectileCreate (unit lp_projectile, string lp_model, fixed lp_speed, fixed lp_damage, fixed lp_size, string lp_tint) {
    // Projectile Custom Value
    int     cv  = IndexUnit(lp_projectile);
    actor   act = ActorFromScope(ActorScopeFromUnit(lp_projectile), "::Main");
    
    // Projectile Art
    ActorSend(act, "ModelSwap {" + lp_model + "} {" + IntToString(0) + "}");
    ActorSend(act, "SetTintColor " + lp_tint);
    UnitSetScale(lp_projectile, lp_size, lp_size, lp_size);
    
    // Projectile Attributes
    gv_projDmg[cv] = lp_damage;
    UnitSetPropertyFixed(lp_projectile, c_unitPropMovementSpeed, lp_speed);
    
    return cv;
}

and I also figured out how to make an animation play and to change the duration and timescale for the animation playing, though making the unit's actor face a certain direction does not seem to work D:.

JASS:
//--------------------------------------------------------------------------------------------------
// Fire projectiles at target point (hotkey = A).
//--------------------------------------------------------------------------------------------------
bool gt_onAbilityCommand_Func (bool testConds, bool runActions) {
    unit    u        = EventUnit();
    point   pt       = UnitGetPosition(u);
    point   ptB      = EventUnitTargetPoint();
    fixed   angle    = AngleBetweenPoints(pt, ptB);
    point   ptA      = PointWithOffsetPolar(pt, 0.75, angle);
    int     cv       = FixedToInt(UnitGetCustomValue(u, c_uIndex));
    actor   act;
    
    act = libNtve_gf_MainActorofUnit(u);
    libNtve_gf_PlayAnimation(act, c_animNameDefault, "Attack", 0, c_animTimeDefault);
    libNtve_gf_SetAnimationDuration(act, c_animNameDefault, 0.25);
    libNtve_gf_SetAnimationTimeScale(act, c_animNameDefault, 1.0);
    //libNtve_gf_MakeModelFaceAngle(libNtve_gf_MainActorofUnit(u), AngleBetweenPoints(UnitGetPosition(EventUnit()), OrderGetTargetPosition(EventUnitOrder())));
    ActorLookAtStart(act, "Chest", 100, 0.25, libNtve_gf_LookAtTargetFromPointWithZOffset(ptB, 0.5));
    UnitAbilityAddCooldown(u, ("AttackGround"), ("Abil/AttackGround"), 0.35);
    
    gf_WeaponFire(u, gv_uWeapon[cv], pt, ptB);
    return true;
}
//--------------------------------------------------------------------------------------------------
// Register the weapon fire ability.
void gt_onAbilityCommand_Init () {
    TriggerAddEventUnitAbility(gt_onAbilityCommand, null, AbilityCommand(c_projFireAbility, 0), c_unitAbilStageExecute, false);
}
//--------------------------------------------------------------------------------------------------

Please help, this has been holding me back for months. It's very discouraging...
 
Status
Not open for further replies.
Top