Small Script Request...
#1
Posté 31 août 2011 - 03:13
Basically I want to, when a PC clicks on a NPC (to talk to them), that the NPC speks a line, and then attacks the PC after X seconds (Probably 3.0 seconds).
I need the default even scripting as part of the script too, so I know where to place it in my script, again don't know which event script to place it in, sorry.
#2
Posté 31 août 2011 - 03:27
#3
Posté 31 août 2011 - 11:18
and then ActionAttack oPC previously defined as GetPCSpeaker or just use that. Slap a delay command in front of that action attack. That is if you want the PC to get a slight warning, i.e. the Npc will turn red just before they attack. Of course you could also give a hint by having the Npc say something insulting to the PC. Like 'Why the heck are you bothering me, hey you're the guy/gal who killed my brother.'
#4
Posté 01 septembre 2011 - 12:48
Is that possible?
#5
Posté 01 septembre 2011 - 01:21
_Guile wrote...
That's the way I set it up, but I want the NPC to just speak the line... not start a conversation..
Is that possible?
NoBody said anything about startibg a conversation. You asked what event fires when a PC clicks on an NPC, The answer was given. The OnConversation event fires. That is not a conversation, It is the event on the NPC that fires.
#6
Posté 01 septembre 2011 - 02:34
Lightfoot8 wrote...
NoBody said anything about starting a conversation. You asked what event fires when a PC clicks on an NPC, The answer was given. The OnConversation event fires. That is not a conversation, It is the event on the NPC that fires.
Let me restate the question for you then...
How do I script the NPC to speak a line and then attack the PC, from that event (OnConversation)?
This was my original request...
_Guile wrote...
Basically
I want to, when a PC clicks on a NPC (to talk to them), that the
NPC speks a line, and then attacks the PC after X seconds (Probably 3.0
seconds).
I need the default even scripting as part of the script
too, so I know where to place it in my script, again don't know which
event script to place it in, sorry.
In case you missed that part...
Modifié par _Guile, 01 septembre 2011 - 02:36 .
#7
Posté 01 septembre 2011 - 03:12
#include "nw_i0_generic"
void main()
{
object oPC = GetLastSpeaker();
ActionSpeakString("Who do you think you're talking to punk!?");
DelayCommand(3.0, DetermineCombatRound(oPC));
}
And then probably just throw in an ExecuteScript line somewhere in there to execute the default converersation script if you need it to.
Modifié par GhostOfGod, 01 septembre 2011 - 03:17 .
#8
Posté 01 septembre 2011 - 03:40
#9
Posté 01 septembre 2011 - 08:09
Lightfoot's suggested way around this, which should help:
Lightfoot8 wrote...
You neeed to filter what runs in the script using Function - GetListenPatternNumber .
If the event is ran by clicking on the npc the function will return a
value of -1. If it is ran by hearing someone speak it will return a
valid listening pattern number.
So, this at the start of your script would allow only a click on an NPC to initiate the rest of your script:
// if the conversation is not via a Click to start a conversation (ie it's just overheard), exit script
int nMatch = GetListenPatternNumber();
if(nMatch != -1)
{ return; }
Modifié par aradankir, 01 septembre 2011 - 08:11 .
#10
Posté 01 septembre 2011 - 09:19
aradankir wrote...
As I recently discovered, you'll need to put something at the start of your script that gets called OnConversation, else any speech anywhere near the NPC that it hears (ie two PCs speaking, or even just one PC talking to themselves) will fire the OnConversation event, and the NPC will attack. Which is perhaps not what you want.
Lightfoot's suggested way around this, which should help:Lightfoot8 wrote...
You neeed to filter what runs in the script using Function - GetListenPatternNumber .
If the event is ran by clicking on the npc the function will return a
value of -1. If it is ran by hearing someone speak it will return a
valid listening pattern number.
So, this at the start of your script would allow only a click on an NPC to initiate the rest of your script:
// if the conversation is not via a Click to start a conversation (ie it's just overheard), exit script
int nMatch = GetListenPatternNumber();
if(nMatch != -1)
{ return; }
Are you sure this isn't only when using the listening patern functions. I just tested with above script by walking around the npc and chatting up a storm. He just stood there...until I clicked on him. I even added the ExecuteScript line with the default conversation script and then started chit chatn with myself and nothing.
Modifié par GhostOfGod, 01 septembre 2011 - 09:27 .
#11
Posté 01 septembre 2011 - 06:31
I would think GetListeningPatter() would actually tell the NPC to listen, which I spoke with the NPC nearby, nothing happened, but the moment I click on her, she spoke and then attacked me.
Modifié par _Guile, 01 septembre 2011 - 06:33 .
#12
Posté 01 septembre 2011 - 07:58
Interesting ... will need to check that out
#13
Posté 01 septembre 2011 - 08:30
aradankir wrote...
Could be that the NPCs I was edited are set to listen, so causing the issue. Guess if they're not then you don't need to check for it and code against it.
Interesting ... will need to check that out
You may want to read the last post I made in your other thread. OnConversation event queries
#14
Posté 02 septembre 2011 - 03:38
aradankir wrote...
Could be that the NPCs I was edited are set to listen, so causing the issue. Guess if they're not then you don't need to check for it and code against it.
Interesting ... will need to check that out
Well if you SetListeningPatter() then yeah, the NPC will be listening, but I don't remember on hand which event you do that in (maybe OnSpawn?)





Retour en haut






