Aller au contenu

Photo

Display a warning message before attacking for the PC


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

#1
Calva64

Calva64
  • Members
  • 16 messages
Hi All,

I've been trying to display a warning message before attacking a NPC. I checked the appropriate 2da file for the PC and it says that the scripts are gb_comp_heart for the heartbeat script. Im assuming this is were you control the initial combat commands to attack. When I copy the gb_comp_heart and comment out the combat routine.  And place it in the overide directory. The PC still attacks and fights the NPC. Anyone know where and how to supress the attack command for the PC. I hoping someone out there has done it.

Thanks,

Calva64

#2
rjshae

rjshae
  • Members
  • 4 491 messages
I guess you could use a script in the creature's On Damaged Script property to trap the attack result. The player can then be presented with a warning dialog that gives the choice of either proceeding with the attack (in which case the combat continues) or not (in which case the damage is healed and the NPC is returned to its previous non-hostile state).

Seems like there should be a better approach though.

Modifié par rjshae, 26 octobre 2010 - 09:47 .


#3
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
The On Physically Attacked and On Spell Cast At script events for the NPC might be what you are wanting to use.

Do something like this (pseudo-script - note this is two scripts squished into one, see comments in script):

void main()
{
object oAttacker = GetLastAttacker(); // For On Attacked
object oCaster = GetLastSpellCaster(); // For On Spell Cast

if(some condition here - such as PC has not yet been warned)
{
// Display Warning Text Here
return;
}

else // PC has already decided to continue attacking
{
ExecuteScript("nw_c2_default5", OBJECT_SELF); // For On Attacked - Execute default script
ExecuteScript("nw_c2_defaultb", OBJECT_SELF); // For On Spell Cast At - Execute default script
}
}

#4
Calva64

Calva64
  • Members
  • 16 messages
Thank you for your responses. I guess I need to elaborate a little more I have the display box comming up when he attacks the NPC, but how do I halt the pc attacking action. The box pops up and he continues to attack.



Please Advise

#5
Morbane

Morbane
  • Members
  • 1 883 messages
AssignCommand(oPC, ClearAllActions(TRUE));



That might be somewhere to start...