• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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