Aller au contenu

Photo

Script to make NPC attack when nearby door is bludgeoned??


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

#1
Groove Widdit

Groove Widdit
  • Members
  • 391 messages
Hello. I am trying to get an NPC to attack the PC when you try to bludgeon through a door nearby. My guess is that it wold be a script in the door's OnAttacked script - an object to find nearest NPC named so and so, or some such. But I don't know how to do it. Any help regarding this is manifestly appreciated! Thanx.

#2
Squatting Monk

Squatting Monk
  • Members
  • 446 messages
This is an incredibly basic draft. You may want to do a lot more than this, but it gets the job done.

void main()
{
    object oPC    = GetLastAttacker();
    object oGuard = GetNearestObjectByTag("Guard");

    AssignCommand(oGuard, ClearAllActions());
    AssignCommand(oGuard, ActionSpeakString("You asked for it!"));
    AssignCommand(oGuard, ActionAttack(oPC));
}

Modifié par Squatting Monk, 14 juin 2013 - 11:21 .


#3
Groove Widdit

Groove Widdit
  • Members
  • 391 messages
It worked! The line of dialogue is awesome. Your kung fu is the baddest, monk.

#4
Groove Widdit

Groove Widdit
  • Members
  • 391 messages
double post

Modifié par Groove Widdit, 15 juin 2013 - 12:20 .


#5
Tarot Redhand

Tarot Redhand
  • Members
  • 2 700 messages
<Blatant Self-Promotion Warning>

I have a whole bunch of scripts that I posted some time ago that handles this and a whole bunch of other solutions to the pc bashing door problem. I called it "Fun Doors" and if you try the demo module (but read the read me first) you'll see why. I also included a table of what script does what and what resources each uses, so you can grab just the scripts you need. As the download is less than 112kb it is no great wait to get it. Just follow the link on its name to get it from the new vault.

TR

#6
Groove Widdit

Groove Widdit
  • Members
  • 391 messages
Okay.