Here I took the script of the OP and added item activation to it, hopefully it helps(untested).
#include "x2_inc_switches"
void Actions()
{
// The actions the clones carry out once created.
// Attack nearest enemy
ASSOCIATE_COMMAND_ATTACKNEAREST;
// if there is no master destroy the clone
if (GetMaster(OBJECT_SELF) == OBJECT_INVALID)
{
SetPCLike(GetMaster(OBJECT_SELF), OBJECT_SELF);
ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_COMMONER);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));
DestroyObject(OBJECT_SELF, 0.0);
}
// if the clone dies (so you can't loot it's items) revive then destroy it.
if (GetIsDead(OBJECT_SELF) == TRUE)
{
SetIsDestroyable(FALSE,TRUE,FALSE);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(OBJECT_SELF));
int nHealed = GetMaxHitPoints(OBJECT_SELF);
effect eRaise = EffectResurrection();
effect eHeal = EffectHeal(nHealed + 10);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eRaise, OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, OBJECT_SELF);
SetIsDestroyable(TRUE,FALSE,FALSE);
DestroyObject(OBJECT_SELF, 0.0);
}
// follow the master if there are no enemys, or if not dieing
ASSOCIATE_COMMAND_FOLLOWMASTER;
// repeat checks.
AssignCommand(OBJECT_SELF, Actions());
}
void main()
{// checking if you have any dominated people in your party if you do no clones will be summoned.
if(GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return;
object oPC = GetItemActivator();
object oClone;
int oCloneHandle;
if (GetAssociate(ASSOCIATE_TYPE_DOMINATED, oPC, 1) == OBJECT_INVALID)
{
oCloneHandle = 0;
}
else
{// set clones to summon equal to the casters level
oCloneHandle = GetCasterLevel(oPC);
}
for (;oCloneHandle
{// this is the clone creation process
oClone = CopyObject(oPC, GetLocation(oPC), OBJECT_INVALID, "Clone of "+GetName(oPC));
SetLootable(oClone, FALSE);
SetLocalObject(oClone, "Player", oPC);
ChangeToStandardFaction(oClone, AI_LEVEL_VERY_HIGH);
AssignCommand(oPC, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectCutsceneDominated(), oClone));
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1), GetLocation(oClone));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_IOUNSTONE_BLUE), oPC, 5.0);
AssignCommand(oPC, AddToParty(oPC, oClone));
// tell clone to do it's checks
AssignCommand(oClone, Actions());
}
}
Modifié par Baragg, 09 décembre 2010 - 01:23 .