Two scripts that worked before but don't now!

Calling all scripting geniuses ! I’ve got two tried and tested scripts that worked before but don’t now when I use them in a different situation. I’ve checked the tags, put them in the right place, compiled them and for some reason they don’t fire.

Script 1. To blast a nasty little man from a conversation, he gets the ga_death two lines later in the conversation so is still alive to take the hit…

void main()
object oPC = GetPCSpeaker();
object oTarget;
oTarget = GetObjectByTag("trader_estate2");
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_HIT_SPELL_FINGER_OF_DEATH), oTarget);

Script 2. A man dies and a conversation starts, oTarget is a hidden invisible tiny kobold so it can’t be killed and is always available to own the conversation…

void main()
object oPC = GetLastKiller();
object oTarget;
oTarget = GetObjectByTag("freddead_kob");
AssignCommand(oTarget, ClearAllActions(TRUE));
DelayCommand(2.0, AssignCommand(oTarget, ActionStartConversation(oPC,"sewer_freddead",FALSE,FALSE,TRUE,FALSE)));

I have no idea why these wont work when they worked before, they both come from old modules of mine and the second one I’ve used recently in my new one and I’ve got no idea what’s wrong this time.

Thank you.

For the first script, try this:

void main()
	object oTarget = GetObjectByTag("trader_estate2");
	effect eEffect = EffectNWN2SpecialEffectFile("sp_finger_of_death");

	ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oTarget);

For the second script, change this…
object oPC = GetLastKiller();
to this…
object oPC = GetFirstPC();


travus… I’m sorry to say but that made no difference neither worked. I set up three new npcs in the first area of a module so I’d have the whole party jump straight in. Changed all tags etc. and ran it but it was the same.

The conversation is fine on the death script because I gave it to an npc and it all works as it should if you talk to him, so it’s not that. Just no effect and no instant conversation on death.

Why did this work before without an issue ? The only thing I changed was the spell from sunbeam to finger of death, I’m going back to sunbeam it now and will let you know.

I couldn’t find sunbeam in the effects so i went with inflict critical and nothing happened again. I’m off hunting in my old mod for the original.

Ok this is driving me mad now I took two scripts from an old mod of mine that worked for zapping people and they don’t work now, one for a lightning bolt and the other for a sunbeam. I really don’t get this all tags etc. are correct and the scripts compile.

I did a mock-up test and everything worked. Are you sure there are no other objects in the module with the same tag? Else, there is something else going on behind the scenes that is messing with things.
Is the kobold set to script hidden TRUE? Or are you using it some other way?

1 Like

I have Serene the Remake downloaded. If you can point me to the similar convo in it, maybe I can help tracking down the issue.

Definitely what Travus says (or even object oPC = GetFirstPC(FALSE);), and you could also try this …

DelayCommand(1.9, AssignCommand(oTarget, ClearAllActions(TRUE))); // EMPHASIS

i.e. Delay the clear actions to just prior the conversation.

And make sure scripts are not hidden for the kobold.

It’s difficult to say without full context.

Also, is this a second time in the same module? i.e. Have you left a kobold around from a previous conversation?


And you’re sure there’s no conflicting hak or override?

1 Like

Whenever I have problems with conversations not firing as they should, I use IpSpeaker. So here’s something to try (for Script 2 that is):

#include "ginc_ipspeaker"

void BeginTheConversation()
CreateIPSpeaker("freddead_kob", "sewer_freddead", GetLocation(GetFirstPC()), 0.0f);


void main()
object oPC = GetLastKiller();
object oTarget;
oTarget = GetObjectByTag("freddead_kob");
AssignCommand(oTarget, ClearAllActions(TRUE));


travus… I’m an idiot !

Yes there was a man elsewhere in the module being zapped by a finger of death and a kobold having a conversation with a wall !

I didn’t change the testing zapped man’s tag or the kobold I just presumed because they were in the same area and the ones that I could see that the computer would see them first too.

I will go away and hang my head in shame. Thanks for being totally right in the first place !

Lance_Botelle… I’m keeping that bit with the delay for later, thank you.

4760… I wish there was I might have noticed that.

andgalf… Thanks, is this IPSpeaker something that doesn’t exist which is why it says create or is it some sort of waypoint ? This could lead to mass unemployment and a recession in the tiny invisible kobold economy !


Yes, the game creates an invisible speaker object (I believe). I don’t use this as much any more, as it’s better (I’ve had this explained to me in the past but I don’t quite remember everything about it anymore) to try and use ActionStartConversation instead. However, when I’ve had problems with the PC walking through triggers and the conversation doesn’t start for some reason, this is a really good way to make it happen. The thing that is good with this, is that if the game gets interrupted in trying to run this conversation, it tries again and again until it succeeds. In my first module I had scripts with ActionStartConversation that wouldn’t trigger if there was a conversation between the PC and a companion, if the companion was too far behind. This solved that problem. Nowadays I use one of travus’ old scripts as templates with teleporting the companion to the PC instead when the player goes through the trigger. I’ve found this to be almost bullet-proof for starting conversations…and I oftentimes use SetCutsceneMode too, to prevent the player from doing anything until the conversation starts, and then on one of the nodes in the conversation I set SetCutsceneMode to Off (very important to not forget this).
However, when teleporting into the inside of a trigger, it won’t always fire, and then IpSpeaker can be a really good way to assure that the conversation fires.

Bottom line: You could begin to use this if you wanted, but if you prefer the tried out method of using the tiny kobold workers (maybe you shouldn’t upset them) that could actually be a better method if you’ve found that they don’t go on strike that often, and if you’ve seen that they do their duty well.


andgalf… Thanks for the explanation I like the sound of these things.

I am pleased to see your compassion regarding my tiny kobolds they have indeed performed their duties well. I only had one misbehave and that’s because I left him as hostile by mistake which was actually highly amusing because I got attacked by something on the ground that you can’t see and is immortal !

I also create people that “own” speak triggers into areas so I can leave the speak trigger in an area and when a condition is met create the owner and next time the PC hits the trigger it fires. Really good in cities not much use in the woods unless you have a wandering druid. My latest mod has goblins appearing in the woods to control triggers but they have a valid excuse for being there.

It’s only when you go back to a module after a while like I did with Serene that you have a real problem because it’s hard to remember how I did things and everything is linked up like a bowl of spaghetti !

1 Like

I know exactly what you mean. I dare not go back to my first module (it’s still quite buggy since it never got a proper beta-test) since I didn’t know what I was doing back then, and I’ll probably be confused by how I did things back then (and it’s only about 4 years ago, but it feels so long, since I’ve created four modules now, and I do stuff quite differently now).

1 Like

andgalf…The only advantage with going back to a mod after a while is that when you play it you forget things and see it more from the player’s point of view and what you missed. Other than that it’s not easy, avoid it if possible.

I got questioned recently by someone who got stuck in an old mod of mine and it was a nightmare trying to work out what was going on.

that is going to work only if you have an object with the tag “trader_estate2” and only one. if you have 2 object like that in your mod, it will select the first one created accross all area. Also note that “lights” object loose their tag on save, so you can’t access them with tags. Others type don’t have a proper position when placed. Waypoints, Ipoint, Creatures, Placeable normally works.

DelayCommand(2.0, AssignCommand(oTarget, ActionStartConversation(oPC,"sewer_freddead"

That won’ t work, beceause the object is “dead”, or “inactiv”, it won’ t be able to support the execution of a script, you need to “wrap” your script

in the death script : ExecuteScript(“my_delayed_script”,GetModule());

and place your action in the “my_delayed_script” I launch on module object here, which is always activ.

You can also use group function stored in “ginc_group”, but a few are bugged, I don’ t remember which one, I corrected and completed that library, but put your Kobold in a group, and assign a conversation on death for the group should also work.

#include “ginc_group”

object oKobold = Create …blabba
GroupOnDeathStartConversation(“MyGroup”,"MyConvo) or whatever its name is and set the correct variable.

That object isn’t dead. He said so himself:

It’s the man that’s dead, not the kobold.

Again, he already stated his mistake on that:


Other than that, what you say is of course correct.

The man(object) dies, the “on_death_script” is launched and is supported by the dead object wich becomme invalid shortly after death, beceause of the delayed function it doesn t trigger. When the Delay kicks in, the object supporting this execution has become invalid, forcing the execution to be canceled or halted.

The kobold exist but ```
DelayCommand(2.0,BeginTheConversation()); isn’ t run. Beceause the one supporting this script is the “dead” object and beceause of the 2s delay.

That why it needs to be wrapped, and run on a valid object. I usually use the module object but a creature, an iPoint, works as well. Placeable should also work in this case, but sometimes I get trouble with them.

If i understand correctly it’s the “dead object” who grab the “kobold” and assign the action to the kobold.
But when it should do it, it has becomme invalid and is unable to run the ActionStartConversation command which should be wrapped inside BeginTheConversation() function.

A “dead object” is unable to act very quickly after “death”, they can only run a short set of instructions before beeing shut down by the game engine. That why you need wrap and launch your “post death actions” on a valid object for delayed or hudge chunks of instructions.

This game pattern is pretty standard and happens often in Shadow of Amn(BG2), now I sometime use the group functions for this pattern.

here for exemple a little piece for the "limited wish quest"

It will force the module to start the conversion between the player, and the object tagged "loutcapt", with the conversation "LOUTCAPT"

But that sometime is not enought beceause by doing it this way the conversation will launch with the "default" parameters scripted in the "ginc_group" library, and when I want different parameters I need to make a "custom wrapper".

	if(	GetLocalInt(GetModule(),"VittorioJob")==1 && !GetLocalInt(OBJECT_SELF,"VittorioDone")){
		object oLout = CreateObject(OBJECT_TYPE_CREATURE,"lout",GetLocation(GetObjectByTag("wp_ar0514_lout")));
		string sGLout = "GLOUT";
1 Like

But, the oTarget in this case is “freddead_kob” which I’m pretty sure is the kobold. So the kobold owns the conversation.

I think it’s run from the conversation. You mean that if the dead creature is the owner of the conversation it can’t “grab” the kobold since it’s dead then. Is that really how it works?

I’m totally with you when it comes to the “can’t run scripts from dead objects” since I’ve experienced that in my own modules, so to that point I agree.

Yes, @Tsongo says that the kobold owns this conversation so I think there should be no issues with this: