Also, if the script is triggering within a heartbeat event on the pillar placeable now, then IIRC GetNearestObjectByTag shouldn’t recognize the pillar itself either.
That’s odd.
Did you copypaste the script, or did you try to write it anew and might have accidentally modified it, @Imtherealthing? If it’s modified, you can post your version without an ounce of shame, or take screenshots of your placeable setup so we can take a look at it, too. We do not make fun of newbie mistakes here; we’ve all been there, and we’ve been doing this for years and we still muck stuff up all the time even so.
It’s just about the most normal thing in the history of normal things.
Put code into brackets in your posts, like this, to keep the formatting:
[code]
Insert the code here.
[/code]
Info: You can define an object variable as OBJECT_SELF to stand for the caller (think the source of the script; the thing that is causing it to run) of the script. Who the caller is can vary from script to script. In a placeable heartbeat event, it’s the placeable whose heartbeat it is.
Defining an object variable for OBJECT_SELF is not usually necessary; you can use OBJECT_SELF directly in most cases. I’ll leave it in here, though. Copypaste this one into the placeable heartbeat event script, and give it a try:
void main()
{
// The placeable whose heartbeat event is ticking.
object oPillar = OBJECT_SELF;
// Find the nearest living player to oPillar.
object oTarget = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oPillar, 1, CREATURE_TYPE_IS_ALIVE, TRUE);
// Abort the script at this point if the nearest living PC is nonexistent or too far away.
if (oTarget == OBJECT_INVALID || GetDistanceBetween(oPillar, oTarget) > 15.0)
return;
// Assigning commands to speak strings:
AssignCommand(oTarget, SpeakString("I am oTarget."));
AssignCommand(oPillar, SpeakString("I am oPillar."));
// Assigning a command to cast a spell:
AssignCommand(oPillar, ActionCastSpellAtObject(SPELL_ISAACS_GREATER_MISSILE_STORM, oTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
// Applying an effect at a location, instantly:
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_MAGICAL_VISION), GetLocation(oPillar));
// Applying an effect to an object, temporarily:
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_PROT_PREMONITION), oPillar, 5.0);
}