I’m trying desperately to create a script for a potion, that when drank, applies more than one effect simultaneously. In my case, improved haste and cats grace.
I cant seem to do this in the toolset as their are no script handlers for these items. Any help would be greatly appreciated . Also keep in mind that my scripting knowledge is poor to say the least.
You can create an item with a Unique effect that calls a script by Tagged-based scripting. You can then script it to do whatever you want.
/* Script generated by
Lilac Soul’s NWN Script Generator, v. 2.3
For download info, please visit:
http://nwvault.ign.com/View.php?view=Other.Detail&id=4683&id=625 */
void main()
{
object oPC;
oPC = GetItemActivator();
object oTarget;
oTarget = oPC;
effect eEffect;
eEffect = EffectHaste();
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);
eEffect = EffectHaste;
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);
eEffect = EffectInvisibility(INVISIBILITY_TYPE_IMPROVED);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);
}
I still dont understand where I would put this scri[pt from Lilac Souls generator?
Argh! This coding thing is beyond me. lol
So, you want to make an item in the toolset. Make its TAG something unique - example “unipotion01”.
Edit the item to have a Unique Power, with a single use.
Take your script above and save it as “unipotion01”
I think it should work without doing anything else to the script. You do have Haste applied twice. I think you can delete an instance of it.
In Game, when the PC uses the item, the spell effects should happen and the item vanish - or at least not be usable anymore.
Thanks for the help.
i tried this script but onlt made minimal progress. All that happened when the script fired with the smoke puff VFX. No haste or invisibility. But im getting closer…
heres the script:
void main()
{
object oPC;
oPC = GetItemActivator();
object oTarget;
oTarget = oPC;
if (!GetIsPC(GetItemActivatedTarget())
){
SendMessageToPC(GetItemActivator(), “Improper use of item!”);
return;}
//Visual effects can’t be applied to waypoints, so if it is a WP
//the VFX will be applied to the WP’s location instead
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), GetLocation(oTarget));
oTarget = GetObjectByTag(“unipotion01”);
effect eEffect;
eEffect = EffectHaste();
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);
effect eEffect2 = EffectInvisibility(INVISIBILITY_TYPE_IMPROVED);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect2, oTarget, 60.0f);
}
You are setting the target to the potion before you do the actual effects but after the smoke. Take that line out and see if it works better.
Oh thank you so much guys. Its been 20 years since ive scripted anything. Im flying by the seat of my pants here…
But it works now.
void main()
{
object oPC;
oPC = GetItemActivator();
object oTarget;
oTarget = oPC;
if (!GetIsPC(GetItemActivatedTarget())
){
SendMessageToPC(GetItemActivator(), “Improper use of item!”);
return;}
int nInt;
nInt = GetObjectType(oTarget);
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), oTarget);
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), GetLocation(oTarget));
effect eEffect;
eEffect = EffectHaste();
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oTarget, 60.0f);
effect eEffect2 = EffectInvisibility(INVISIBILITY_TYPE_IMPROVED);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect2, oTarget, 60.0f);
oTarget = GetObjectByTag(“unipotion01”);
}