Skip to content

Henchman control

SeverumSeverum Member Posts: 15
edited January 2019 in Builders - Scripting
Hello
I'm working on the henchman control and like add new functions to the script created by Numos.
I want that summoned open and close doors and disarm traps.


But not accept ActionUnlockObject or other...

void main()
{
    object oUser = OBJECT_SELF;
    //SendMessageToPC(oUser, "Player Tool 01 activated.");
    object oTarget = GetSpellTargetObject();
    location lTarget = GetSpellTargetLocation();
    object oAssociate = GetLocalObject(oUser, "nu_minion");

    if (oTarget == oUser)
    {
        object oMinion = GetFirstFactionMember(oUser, FALSE);
        while (GetIsObjectValid(oMinion))
        {
            if (GetMaster(oMinion) == oUser)
            {
                AssignCommand(oMinion, ActionMoveToLocation(GetLocation(oUser)));
            }
            oMinion = GetNextFactionMember(oUser, FALSE);
        }
        SendMessageToPC(oUser, "El convocado va hasta tu posicion");
    }
    else if (GetIsObjectValid(oTarget) && GetMaster(oTarget) == oUser)
    {
        SetLocalObject(oUser, "nu_minion", oTarget);
        SendMessageToPC(oUser, "Has seleccionado a " + GetName(oTarget));
    }
    else if (GetIsObjectValid(oTarget) && GetIsObjectValid(oAssociate) && GetMaster(oTarget) != oUser)
    {
        AssignCommand(oAssociate, ClearAllActions());
        AssignCommand(oAssociate, ActionAttack(oTarget));
        SendMessageToPC(oUser, "El convocado atacara " + GetName(oTarget));
    }
    else if (!GetIsObjectValid(oTarget) && GetIsObjectValid(oAssociate))
    {
        AssignCommand(oAssociate, ClearAllActions());
        AssignCommand(oAssociate, ActionMoveToLocation(lTarget, TRUE));
        SendMessageToPC(oUser, "El convocado se desplaza...");
    }
     else if (!GetIsObjectValid(oTarget) && GetIsObjectValid(oAssociate))
    {
        AssignCommand(oAssociate, ClearAllActions());
        AssignCommand(oAssociate, ActionUnlockObject(oTarget, TRUE));
        SendMessageToPC(oUser, "El convocado se desplaza");

    }
    else if (!GetIsObjectValid(oTarget) && GetIsObjectValid(oAssociate))

    {

        SendMessageToPC(oUser, "Lo siento esa funcion no esta disponible para el convocado");
    }
    else
    {
        SendMessageToPC(oUser, "Lo siento esa funcion no esta disponible para tus convocados");
    }
}

Can someone help me?

Comments

  • ProlericProleric Member Posts: 1,281
    edited January 2019
    As it stands, the clause which contains ActionUnlockObject is only executed when the target is not valid, so it never happens. I guess you meant to say - do this when the target is valid.

    A more general function is

      ActionUseSkill(SKILL_OPEN_LOCK,    oTarget, 0, oTool);


    which allows the use of lockpicks.
  • SeverumSeverum Member Posts: 15
    edited February 2019
    Thanks for tip! 

    Works.

    else if (GetObjectType (oTarget) == OBJECT_TYPE_DOOR)
    AssignCommand (oAssociate, ClearAllActions ());
    AssignCommand (oAssociate, ActionUseSkill (SKILL_OPEN_LOCK, oTarget, 0, oTool);
    SendMessageToPC (oUser, "Abriendo la puerta ...");

        }



    Post edited by Severum on
Sign In or Register to comment.