#include "x4_inc_functions"
#include "x3_inc_horse"

//Put this on action taken in the conversation editor
void main()
{
    // Important system variables
    string sChainTag = "ch_pegasus";
    string sHorseResRef = "horse_pegasus";

    object oPC = GetPCSpeaker();
    location lTarget = GetLocation (oPC);

    if (GetItemPossessedBy(oPC, sChainTag)!= OBJECT_INVALID)
    {
        object oSteed = CreateObject (OBJECT_TYPE_CREATURE, sHorseResRef, lTarget);
        SetLocalString(oSteed, "sOwner", CharacterDB(oPC));
        // Assigns the mount to oPC.
        HorseSetOwner(oSteed, oPC, TRUE);
    }
    else
    {
        SendMessageToPC(oPC, "You don't have the required chain anymore!");
    }
}