Aller au contenu

Photo

npc attacking npc


  • Veuillez vous connecter pour répondre
7 réponses à ce sujet

#1
PJ156

PJ156
  • Members
  • 2 982 messages
I may be being dim but I can't get this to work.

In a cut scene I want an NPC to attack another one. I have a script which goes something like this:

void main()
{

object oPC = GetPCSpeaker();

objectoTarget;
oTarget = GetObjectByTag("et");

AssignCommand(oTarget,ActionAttack(GetObjectByTag("tt")));

}

I just typed this so if the issue is syntax, it is correct in the script (I assume since Lilac soul wrote it)

I want et to attack tt but it does not happen in the cut scene and I dont know why.

Thanks,

PJ

Modifié par PJ156, 23 juillet 2010 - 07:58 .


#2
Orion7486

Orion7486
  • Members
  • 161 messages
If this is within a convo, ga_attack_target should do it. What are the npc's doing prior to this script. Might need to call a ClearAllActions before this. Also, are the npc's able to perceive each other?

#3
LeeMer47

LeeMer47
  • Members
  • 111 messages
Their factions must be hostile to each other. Friends don't fight friends. If it is a campaign mod you must set the campaign switch to allow fighting NPCs.



If it is a conversation cutscene you go to animations, choose owner, pick IDLE_MELEE. The other NPC can use KNEELDEATH.

#4
PJ156

PJ156
  • Members
  • 2 982 messages
Thanks for the the replies guys, they can see each other and I do use a clear all actions before. I am going to try with the animations or playing with the factions.

Cheers for the pointers,

PJ

#5
M. Rieder

M. Rieder
  • Members
  • 2 530 messages

PJ156 wrote...

I may be being dim but I can't get this to work.

In a cut scene I want an NPC to attack another one. I have a script which goes something like this:

void main()
{

object oPC = GetPCSpeaker();

objectoTarget;
oTarget = GetObjectByTag("et");

AssignCommand(oTarget,ActionAttack(GetObjectByTag("tt")));

}

I just typed this so if the issue is syntax, it is correct in the script (I assume since Lilac soul wrote it)

I want et to attack tt but it does not happen in the cut scene and I dont know why.

Thanks,

PJ



Is the problem that the NPC does not attack at all, or that the NPC attacks, but the cutscene ends when the NPC attacks?

If it is the second one, then check to see if either of the NPCs is the owner of the conversation.  If so, the fighting may cause the cutscene to end.  A potential solution is to give the conversation to an ipoint or similar nearby object.

#6
Shallina

Shallina
  • Members
  • 1 011 messages
How to have a fight not ending a cutscene or a convo or not causing trouble.



You need to have your 2 opposotite faction that will fight each other neutral with the player.

#7
PJ156

PJ156
  • Members
  • 2 982 messages
Thanks for the extra replies, I had not spotted them. I am not so good with this forum yet.

I tried to play with the factions but I could not get it to go. In the end I went with camera work and cut from looking at the NPC's to blodd splashing on the floor. Partly the reason for the I need sound advice thread.

I have compromised on this and done things another way but I may come back to it once I have progressed the mod further.

Thanks again for all your help,

PJ

#8
dethia

dethia
  • Members
  • 146 messages
I had a similar problem though under different circumstances, you need to set the npc's hostile to each other using the SetTemporaryEnemy function, you may have to write a small script that gets the source and target but that will set them hostile after which point they will tear each other up gladly.