Talk:ActionCastSpellAtObject

From NWN Lexicon

[edit] Doesn't work with barrels?

The text said the following:

"Object oTarget should be a valid target such as a creature or PC. Experiment with different target types as some targets do not work with this function (verified that this function does not work with barrels)."

I just tried it on a barrel and it worked fine. When was this changed? Are there any objects the function still does not accept as targets? In the meantime, I've changed this to read as follows:

"Some object types may not work with this function (barrels work now, but they didn't at the time this article was first written). More experimentation is needed." - Squatting Monk (talk) 10:10, 7 September 2012 (UTC)


[edit] Amateur question

oTarget can be oPC without having to define it? Like following example? I'm asking this because Lilac Soul's generator gives me this:

void main()
{
object oPC = GetPCSpeaker();
object oTarget;
oTarget = OBJECT_SELF;
ActionCastSpellAtObject(SPELL_BARKSKIN, oTarget, METAMAGIC_ANY, FALSE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE);
oTarget = oPC;
ActionCastSpellAtObject(SPELL_BARKSKIN, oTarget, METAMAGIC_ANY, FALSE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE);
}

With several henchmen and lots of different buffs at some point, a script looks much cleaner like the following example. But is this still proper scripting?

void main()
{
object oPC = GetPCSpeaker();
object oTarget = OBJECT_SELF;
ActionCastSpellAtObject(SPELL_BARKSKIN, oTarget, METAMAGIC_ANY, FALSE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE);
ActionCastSpellAtObject(SPELL_BARKSKIN, oPC, METAMAGIC_ANY, FALSE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE);

--217.121.86.187 18:06, 30 May 2013 (UTC)

Whatever object you feed into that parameter will be the target, regardless of whether the variable is called "oTarget". The way you've scripted it is certainly preferable to what Lilac's gives. - Squatting Monk (talk) 20:13, 5 June 2013 (UTC)
Personal tools
Categories