sekan Posted August 22, 2008 Posted August 22, 2008 Hello, I have added a new force power that freeze an enemy for 25 seconds. But during that progress the hostile shall become neutral so you can't attack him\her during the freezing. Then I want the enemy to return to the faction he\she had before. The freezing works fine but turning npc to neutral doesn't work for some reason. Here is the script: #include "k_inc_force" void main() { object oFollower = GetSpellTargetObject(); object oSource = OBJECT_SELF; ActionDoCommand(SetCommandable(TRUE,oFollower)); int nFaction = GetStandardFaction(oFollower); ChangeToStandardFaction((oFollower), 5); effect eFreeze = EffectSleep(); eFreeze = EffectLinkEffects(eFreeze, EffectVisualEffect(VFX_DUR_HOLD)); eFreeze = SetEffectIcon(eFreeze, 15); ApplyEffectToObject((DURATION_TYPE_PERMANENT), eFreeze, oFollower); DelayCommand(25.0, AssignCommand(oFollower, ClearAllEffects())); ChangeToStandardFaction(oFollower, nFaction); AssignCommand (oFollower,ActionAttack( oSource)); ActionDoCommand(SetCommandable(FALSE,oFollower)); } Why is my npcs not becoming neutral? Thanks and take care
glovemaster Posted August 23, 2008 Posted August 23, 2008 Your NPC is actually becoming neutral but only for the duration of the script as your line: ChangeToStandardFaction(oFollower, nFaction); is not delayed and therefore the NPC is changed to Neutral and then back to hostile. Here is a more cleaned up script: void GM_SwitchFaction(float Delay, object NPC, int Faction) { int nFaction = GetStandardFaction(NPC); ChangeToStandardFaction(oFollower, Faction); DelayCommand(Delay, AssignCommand(NPC, ClearAllEffects())); DelayCommand(Delay, ChangeToStandardFaction(NPC, nFaction)); DelayCommand(Delay, AssignCommand(NPC, ActionAttack(oSource))); DelayCommand(Delay, ActionDoCommand(SetCommandable(FALSE, NPC))); } void main() { object oFollower = GetSpellTargetObject(); object oSource = OBJECT_SELF; effect eFreeze = EffectSleep(); eFreeze = EffectLinkEffects(eFreeze, EffectVisualEffect(VFX_DUR_HOLD)); eFreeze = SetEffectIcon(eFreeze, 15); GM_SwitchFaction(25.0, oFollower, STANDARD_FACTION_NEUTRAL); ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFreeze, oFollower, 25.0); ActionDoCommand(SetCommandable(TRUE, oFollower)); }
Recommended Posts
Archived
This topic is now archived and is closed to further replies.