Okay, this should work with any single resref mount. I don't have cep 2.4 installed, so it was tested with a horse, but it should work for the alternate mounts in other packages as well.
First, the item script:
#include "x2_inc_switches"
void main()
{
if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return;
object oTarget = GetItemActivator();
location lTarget = GetLocation (oTarget);
if (!GetLocalInt (oTarget, "MOUNTED"))
{
SetLocalInt (oTarget, "MOUNTED", TRUE);
object oSteed = CreateObject (OBJECT_TYPE_CREATURE, "put_resref_here", lTarget);
// Assigns the mount to oTarget. The delay is just to ensure the Steed is created fully first.
DelayCommand (0.3, AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_ASSIGN_MOUNT, oSteed, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)) );
DelayCommand (0.4, AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_ASSIGN_MOUNT, oTarget, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)) );
DelayCommand (0.5, AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_MOUNT, oSteed, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE)) );
}
else
{
DeleteLocalInt (oTarget, "MOUNTED");
AssignCommand (oTarget, ActionCastSpellAtObject (SPELL_HORSE_DISMOUNT, oTarget, METAMAGIC_NONE, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
}
}
Then put this into the heartbeat event of the custom mount:
void main()
{
if (GetLocalInt (OBJECT_SELF, "UNMOUNTED"))
{
DeleteLocalInt (GetMaster (OBJECT_SELF), "MOUNTED");
DestroyObject (OBJECT_SELF);
}
else
{
SetLocalInt (OBJECT_SELF, "UNMOUNTED", TRUE);
}
}
It's nothing fancy, just destroys the mount on the second HB after the player dismounts. You could add a VFX to the "summoning" and "unsummoning" if you wanted, I just put the basic support in place.
Modifié par Failed.Bard, 04 octobre 2011 - 06:07 .