This is our script that declares the functions of our stunner.
But there is a problem I am not able to find...I'm sure the problem is pretty simple but still I can't see it :angry2:
The script is divided into two parts
As it is right now it only stuns the target <_<
This is how it is supposed to work:
The first time you activate the stunner on a player the player will be stunned and can't do anything...most of us know this effect I suppose :D
Then when you activate the item a second time on the stunned player the effect is supposed to be undone with some effects.
For Mel:
When you read this please could you simplify this script a little? That would be really great...I tend to do most things a little too complicated :D
Thanks a lot!
A happy new year to everyone!!!
[snapback]14436[/snapback]
Made a fix where you did get oSpieler and not oTarget (that's why it doesn't unstuns), and added a few checks. to be sure the target is pc and not yourself.
And gived the code a facelift :P
NOTE: the tag checked for is ante_stunner, you might want to change that again. I used that tag to check it.
void main()
{
object oItem = GetItemActivated();
object oTarget = GetItemActivatedTarget();
object oPC = GetItemActivator();
int iStunner = GetLocalInt(oTarget, "Stunned"); //this was oSpieler, wrong I think
int iChanged02 = GetLocalInt(oTarget, "AppChanged");
effect eEffect = GetFirstEffect(oTarget);
//stunvisual, impact (eVisual2)
effect eVisual1 = EffectVisualEffect(VFX_IMP_LIGHTNING_S);
effect eVisual2 = EffectLinkEffects(EffectVisualEffect(VFX_IMP_LIGHTNING_M),eVisual1);
//stunvisual, permanent (eHold5)
effect eVisual3 = EffectVisualEffect(VFX_DUR_FREEZE_ANIMATION);
effect eVisual4 = EffectLinkEffects(EffectVisualEffect(VFX_DUR_ICESKIN),eVisual3);
effect eVisual5 = EffectLinkEffects(EffectVisualEffect(VFX_DUR_PARALYZE_HOLD),eVisual4);
effect eHold = EffectLinkEffects(EffectStunned(),eVisual5);
effect eHold2 = EffectLinkEffects(EffectParalyze(),eHold);
effect eHold3 = EffectLinkEffects(EffectDominated(),eHold2);
effect eHold4 = EffectLinkEffects(EffectPetrify(),eHold3);
effect eHold5 = EffectLinkEffects(EffectFrightened(),eHold4);
//unstunvisual, impact(eVisual7)
effect eVisual6 = EffectVisualEffect(VFX_IMP_HEALING_L);
effect eVisual7 = EffectVisualEffect(VFX_IMP_HEAD_HEAL);
//check for cases the stuner may not work
if(GetTag(oItem) != "ante_stunner")return; //check itemtag
if(iChanged02 == 1)return; //check localint "AppChanged"
if(GetIsDM(oTarget) == TRUE)return; //check if target is DM
if(GetIsPC(oTarget) == FALSE)return; //check if targer is PC
if(oTarget == oPC)return; //check if the player targets himself
//stun/unstun depending in the iStunner variable ("Stunner" localint)
if (iStunner != 1)
{
//add stuneffects (adding plot as last, as blocks some effects)
AssignCommand(oTarget,ClearAllActions());
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual2, oTarget);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eHold5, oTarget);
SetCommandable(FALSE, oTarget);
SetLocalInt(oTarget, "DM_Hold_Flag", 1);
SetLocalInt(oTarget, "DM_No_Magic", 1);
SetLocalInt(oTarget, "Stunned", 1);
SetCutsceneMode(oTarget, TRUE);
DelayCommand(0.2, SetPlotFlag(oTarget,TRUE));
}
else
{
//remove stun effects (removeing plot as first , as it blocks some effects)
SetPlotFlag(oTarget,FALSE);
SetCutsceneMode(oTarget, FALSE);
SetLocalInt(oTarget, "Stunned", 0);
SetLocalInt(oTarget, "DM_No_Magic", 0);
SetLocalInt(oTarget, "DM_Hold_Flag", 0);
SetCommandable(TRUE, oTarget);
while (GetIsEffectValid(eEffect))
{
RemoveEffect(oTarget, eEffect);
eEffect = GetNextEffect(oTarget);
}
//do a healing visual
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual7, oTarget);
AssignCommand(oTarget, ClearAllActions());
}
}
:excl:
[snapback]14520[/snapback]
?? was there something wrong or so? :P
-Mel
:excl:
[snapback]14520[/snapback]
?? was there something wrong or so? :P
-Mel
[snapback]14534[/snapback]
I wanted to signal the player why the item won't work in some cases that you are checking for so I modified the script a little but at first smt went wrong and I thought you made a mistake but then I noticed I forgot to add a "return;"
now it works pretty fine and the player is told the reason why the item won't work in several cases :)
:excl:
[snapback]14520[/snapback]
?? was there something wrong or so? :P
-Mel
[snapback]14534[/snapback]
I wanted to signal the player why the item won't work in some cases that you are checking for so I modified the script a little but at first smt went wrong and I thought you made a mistake but then I noticed I forgot to add a "return;"
now it works pretty fine and the player is told the reason why the item won't work in several cases :)
[snapback]14569[/snapback]
k (http://lucidmagic.com/style_images/sparazero1103065721/folder_post_icons/icon4.gif)
Anyway, I'm going to be offline a lot. + this is what I think of nwn atm -> (http://lucidmagic.com/style_images/sparazero1103065721/folder_post_icons/icon8.gif)
And got some other work to do.
Have fun. B)
Mel.