View Single Post
Old 05-03-2012, 11:12 AM   #183
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,625
Quote:
Originally Posted by Fair Strides 2 View Post
Also, the object of the script at
Code:
eBuff = EffectLinkEffects(eBuff, EffectAbilityIncrease(ABILITY_CONSTITUTION, 25));
and

Code:
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBuff, oTarget, 30.0);
was to increase one's CON by 25 for 30 seconds, or 10 combat rounds, and the revert to normal, at which point this

Code:
fDelayInSeconds = 30.0;
DelayCommand(fDelayInSeconds, eBuff = EffectLinkEffects(eBuff, EffectAbilityDecrease(ABILITY_CONSTITUTION, 15));
would administer a penalty of 15 CON below the normal value for 15 seconds.
Oh, I see. I just checked and you can do that. So you were on the right track, ignore my previous advice (I made some typing errors anyway ) and go with this:
Code:
object oTarget = GetSpellTargetObject(); 
effect eVFX = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);
effect eConI = EffectAbilityIncrease(ABILITY_CONSTITUTION, 25);
effect eConD = EffectAbilityDecrease(ABILITY_CONSTITUTION, 15);

ApplyEffectToObject(1, eVFX, oTarget, 3.0);
ApplyEffectToObject(1, eConI, oTarget, 30.0);
SetEffectIcon(eConI, 69);
DelayCommand(30.0, ApplyEffectToObject(1, eConD, oTarget, 15.0));
I also realized you were trying to link the effects. You did part of it right, but some of it was out of order, or not applicable, hence my confusion.

The primary purpose is to set up a "save and ignore" system; if a creature is immune to one of the effects, none of the effects will be applied. For example, movement speed decrease is a debilitating effect of poison; if you are immune to poison, your movement speed should not be decreased because you weren't poisoned. Its other purpose is to enable lazy coders. When you link effects, you just need to fire the link effect and then all the others will be fired at the same time - meaning you only need to apply one effect. So if you have a bunch of effects of the same type that will all be applied to the same object at the same time and will have the same duration type and length, then you can link all the effects into one and apply them all at once. It's a lot of work in the setup, but the reward is a more streamlined script. Of course, there are a lot of limitations; the effects must meet all the above criteria, and in general it's very sensitive - some effects just won't work.

Now, you have three effects (well, four, but visuals can't be linked) - two are fired at different times and last for different durations, and one is simply an icon. So you really don't need to link them. But if you insist on it, then it would look something like this:
Code:
object oTarget = GetSpellTargetObject(); 
effect eVFX = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);
effect eConI = EffectAbilityIncrease(ABILITY_CONSTITUTION, 25);
effect eIcon = SetEffectIcon(eConI, 69);
effect eLink = EffectLinkEffects(eConI, eIcon);
effect eConD = EffectAbilityDecrease(ABILITY_CONSTITUTION, 15);

ApplyEffectToObject(1, eVFX, oTarget, 3.0);
ApplyEffectToObject(1, eLink, oTarget, 30.0);
DelayCommand(30.0, ApplyEffectToObject(1, eConD, oTarget, 15.0));
That should simply link the icon and the CON increase. I don't believe it's necessary because SetEffectIcon should already function like that, but I could be wrong.

Let's say you want to add something like poison at the end of the spell, in addition to the Constitution penalty... and just for good measure, decreased movement speed. And if the character is immune to poison, their CON will simply return to normal, with no debilitating effects. Here's an example of what it should look like:
Code:
object oTarget = GetSpellTargetObject(); 
effect eVFX = EffectVisualEffect(VFX_IMP_BATTLE_MED_III);
effect eConI = EffectAbilityIncrease(ABILITY_CONSTITUTION, 25);
effect eConD = EffectAbilityDecrease(ABILITY_CONSTITUTION, 15);
effect ePoison = EffectPoison(POISON_ABILITY_SCORE_AVERAGE);
effect eMoveD = EffectMovementSpeedDecrease(50);
effect eIcon = SetEffectIcon(eLink, 69);

effect eLink;
eLink = eConD;
eLink = EffectLinkEffects(eLink, ePoison);
eLink = EffectLinkEffects(eLink, eMoveD);

ApplyEffectToObject(1, eVFX, oTarget, 3.0);
ApplyEffectToObject(1, eConI, oTarget, 30.0);
SetEffectIcon(eConI, 69);
DelayCommand(30.0, ApplyEffectToObject(1, eLink, oTarget, 15.0));
That's where linking comes in handy.

I also looked at k_inc_force and I believe you got the rest right, except for the aforementioned typos.
Quote:
Originally Posted by Fallen Guardian View Post
Do you know if I were to change the "Lightsaber" to say Blaster Pistol, if it would work or not?
Quote:
Originally Posted by JCarter426 View Post
Since you want to check for any sort of blaster, you'll need to use something else.
I found something:
Code:
// 397: Get the base item type (BASE_ITEM_*) of oItem.
// * Returns BASE_ITEM_INVALID if oItem is an invalid item.
int GetBaseItemType(object oItem);
So just set it up to check if the base item type is BASE_ITEM_BLASTER_PISTOL (12). The full list is in NWScript. You might want to repeat it for ion pistols, sonic pistols, and the like.


JCarter426 is offline   you may: quote & reply,