PDA

View Full Version : Script problems


Miltiades
07-11-2007, 12:47 PM
I'm getting problems with certain scripts lately. There's one script which makes two NPCs follow me. Instead of following me, one of the NPCs is just spawning next to me whenever I take a few steps. Weird, because the other NPC follows me like he has to. This (http://www.lucasforums.com/showpost.php?p=2262275&postcount=7) is the script I used. Both NPCs sometimes have the urge to stand still, so I have to go all the way back to where they stopped and pick them up.

Another problem I have is with a script that fires a conversation after three hostile NPCs, with the same tag, are dead. But the conversation doesn't always fire after the three NPCs are dead. I used the first script of this (http://www.lucasforums.com/showpost.php?p=1796954&postcount=12) post.

And the last problem I have, is with a script where an NPC stuns my party. I've asked this in another thread a few days ago, but I may not have explained it clearly enough, and I don't want to triple post in the other thread :p. What I want is after a conversation, an NPC stuns my party, which consist of the PC and two other partymembers (which can be any of the ten partymembers). This effect should only last until the conversation is over. What I've done so far is added an empty node after the last spoken line in the dialog file, wherein I put the name of the script in the script field. I've made sure the NPC knows how to stun, although I don't think that's necessary. But in the conversation, the NPC just skips the line in which he should stun my party. I used this (http://www.lucasforums.com/showpost.php?p=2341149&postcount=4) script. Apart from the tag in the script, I haven't changed anything.

I hope somebody can help me with these.

Miltiades
07-12-2007, 10:26 AM
Sorry to double post again(!), but I tried some things concerning the script that should stun my party. I tried this (http://www.lucasforums.com/showpost.php?p=2316837&postcount=2) script, which should stun only one NPC, and not the party. The attacking NPC should stun Visas (tag: p_visas I hope), but he didn't. Now, I must say that my NPC is a Twi'lek, and I thought, maybe the Twi'lek models can't use those animations. Could this be it?

Anyway, whatever it is, the scripts should work fine. The problem must lie elsewhere.

Tupac Amaru
07-12-2007, 10:41 AM
I'm getting problems with certain scripts lately. There's one script which makes two NPCs follow me. Instead of following me, one of the NPCs is just spawning next to me whenever I take a few steps. Weird, because the other NPC follows me like he has to. This (http://www.lucasforums.com/showpost.php?p=2262275&postcount=7) is the script I used. Both NPCs sometimes have the urge to stand still, so I have to go all the way back to where they stopped and pick them up. Could be one NPC is blocking the other's path. ActionForceMoveToObject will make an NPC teleport to a location if it can't find an unobstructed way. I would try to set the IgnoreCrePath flag in the characters' .utc file.

....What I've done so far is added an empty node after the last spoken line in the dialog file, wherein I put the name of the script in the script field. I've made sure the NPC knows how to stun, although I don't think that's necessary. But in the conversation, the NPC just skips the line in which he should stun my party.Dialogue nodes have a delay field. Add a delay of a few seconds there and the game won't skip the node.

The attacking NPC should stun Visas (tag: p_visas I hope), but he didn't.Visas' tag is 'VisasMarr', 'p_visas' is the template resref.

Miltiades
07-12-2007, 01:23 PM
Could be one NPC is blocking the other's path. ActionForceMoveToObject will make an NPC teleport to a location if it can't find an unobstructed way. I would try to set the IgnoreCrePath flag in the characters' .utc file.

I've changed the value of IgnoreCrePath to 1. He doesn't stay behind anymore, but keeps spawning next or into me.


Dialogue nodes have a delay field. Add a delay of a few seconds there and the game won't skip the node.

Visas' tag is 'VisasMarr', 'p_visas' is the template resref.

Yes, stupid mistake there. But it still doesn't work. I've put a delay of 5 (seconds?) in the node, made the node unskippable, made sure the tag of Visas was correct, but the NPC doesn't do what he should do.

Tupac Amaru
07-13-2007, 02:28 PM
I've changed the value of IgnoreCrePath to 1. He doesn't stay behind anymore, but keeps spawning next or into me.Does this problem only occur if you spawn both NPCs?

Yes, stupid mistake there. But it still doesn't work. I've put a delay of 5 (seconds?) in the node, made the node unskippable, made sure the tag of Visas was correct, but the NPC doesn't do what he should do.Hmm, I am having the same problem with the script. Try removing the two lines with the SetCommandable commands. They seem to lock the action queue too early.

Miltiades
07-14-2007, 02:35 PM
Does this problem only occur if you spawn both NPCs?

No. I left one of the NPCs out of my module, but the other NPC still spawns next to me instead of following me.


Hmm, I am having the same problem with the script. Try removing the two lines with the SetCommandable commands. They seem to lock the action queue too early.

Yes, it did. Now it works! Only one thing remaining. To stop the paralyzing effect, this script should do it:void main() {
object oMerc = GetObjectByTag("trooper3");
AssignCommand(oMerc, ClearAllEffects());
}

But since it is the party that gets paralyzed, this script needs a change. What needs to change?

stoffe
07-14-2007, 03:12 PM
Yes, it did. Now it works!

Hmm, the setcommandable call that locks the action queue should probably have been assigned as well for it to work as intended. But if you're going to use it in a cutscene anyway there shouldn't be any need to lock the action queue since the standard combat AI is unlikely to interfere with it there. :)


Only one thing remaining. To stop the paralyzing effect (snip)
But since it is the party that gets paralyzed, this script needs a change. What needs to change?


void main() {
int i;
for (i = 0; i < GetPartyMemberCount(); i++) {
AssignCommand(GetPartyMemberByIndex(i), ClearAllEffects());
}
}

Miltiades
07-14-2007, 05:59 PM
Great. Thanks. Oh yeah, if I want the NPC to attack only my partymembers, not myself, how do I do that?