Hi all…
Question; I can’t seem to get a hostile creature to speak his one liner after CreateObject,“ref” scripts fires and the hostile is spawned in. I’ve DelayedCommand(, and the script compiles correctly. I’ve also declared GetObjectByTag(’'tag"); as well and it hasn’t been successful. As always, any advice is greatly appreciated!
Posting the code would help spot where it’s going wrong.
If it helps here, you can target a newly-created object directly after spawning it by declaring it as an object variable, skipping the GetObjectByTag bit entirely.
object oCreature = CreateObject(OBJECT_TYPE_CREATURE, "InsertCreatureResRefHere", InsertTargetLocationHere);
DelayCommand(2.0, AssignCommand(oCreature, SpeakString("Test.")));
You could also put the spawning one-liner into the creature’s OnSpawn event script.
I’m almost embarrassed to have not tried that myself before posting. Thanks so much ‘TheBarbarian!’ It works and will be a nice little added detail for my project. Thanks to you and all the knowledgable vault members for such helpful information!
1 Like