Hi folks,
I'm just looking to add a little flavour to my current project & thought it could be fun to have companions make occaisional comments - usually relevant to the current situation - triggered by a script called when entering a generic trigger.
One example is below - a comment made by a compaion tagged 'davebarby':
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
int DoOnce = GetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF));
if (DoOnce==TRUE) return;
SetLocalInt(OBJECT_SELF, GetTag(OBJECT_SELF), TRUE);
AssignCommand(GetObjectByTag("davebarby"), ActionSpeakString("What a soft lot! Call themselves Militia? - My gran's harder!"));
}
What I'm looking for is the script to generate floating text above the compaion's head (if they're in the party) when the PC enters the trigger.
Only problem is that its not working - no text appears.
Anyone know why?
Getting henchlings to make comments
Débuté par
Clyordes
, févr. 06 2011 10:30
#1
Posté 06 février 2011 - 10:30
#2
Posté 06 février 2011 - 11:26
Try using the function SpeakString() - which is speak immeadiately - instead of ActionSpeakString() - which is add it to the action que and fire when possible.
Modifié par _Knightmare_, 06 février 2011 - 11:30 .
#3
Posté 07 février 2011 - 02:15
I've solved this in my up-coming module. The trigger holds a 'Tag' variable that determines which companion speaks (a blank tag causes the text to appear on the first PC), and a 'BarkString' variable that holds the text string to display. I use the same generic script for all of my bark comments.
When you walk over the trigger, it checks to make sure the entering creature has the correct tag, triggers a FloatingTextStringOnCreature on them, and destroys the trigger (all of my bark comments are once-only).
The real challenge was figuring out why you got the text duplicated if you happened to be in control of that companion at the time. The 'Broadcast To Faction' option is set to TRUE by default, so it seems that it gets displayed to both the companion AND the first PC (who are one and the same during companion possession). I had to insert a check to see if the PC was in control of the entering object, but wasn't actually the first PC, and set 'Broadcast To Faction' to FALSE in that case.
When you walk over the trigger, it checks to make sure the entering creature has the correct tag, triggers a FloatingTextStringOnCreature on them, and destroys the trigger (all of my bark comments are once-only).
The real challenge was figuring out why you got the text duplicated if you happened to be in control of that companion at the time. The 'Broadcast To Faction' option is set to TRUE by default, so it seems that it gets displayed to both the companion AND the first PC (who are one and the same during companion possession). I had to insert a check to see if the PC was in control of the entering object, but wasn't actually the first PC, and set 'Broadcast To Faction' to FALSE in that case.
Modifié par DannJ, 07 février 2011 - 02:19 .
#4
Posté 07 février 2011 - 06:02
// bark_comments
//
// Set variables on triggers as follows:
//
// Tag = [tag of companion who speaks - leave blank for first PC]
// BarkString = [floating text to display]
void main ()
{
object oNPC;
object oTrigger = GetEnteringObject();
string sBark = GetLocalString(OBJECT_SELF, "BarkString");
string sTag = GetLocalString(OBJECT_SELF, "Tag");
int iFlag = TRUE;
if (sTag == "")
oNPC = GetFirstPC();
else
oNPC = GetObjectByTag(sTag);
if ( oTrigger != oNPC)
return;
if (GetIsPC(oNPC) && oNPC != GetFirstPC())
iFlag = FALSE;
FloatingTextStringOnCreature(sBark, oNPC, iFlag);
DestroyObject(OBJECT_SELF, 0.0, FALSE);
}
//
// Set variables on triggers as follows:
//
// Tag = [tag of companion who speaks - leave blank for first PC]
// BarkString = [floating text to display]
void main ()
{
object oNPC;
object oTrigger = GetEnteringObject();
string sBark = GetLocalString(OBJECT_SELF, "BarkString");
string sTag = GetLocalString(OBJECT_SELF, "Tag");
int iFlag = TRUE;
if (sTag == "")
oNPC = GetFirstPC();
else
oNPC = GetObjectByTag(sTag);
if ( oTrigger != oNPC)
return;
if (GetIsPC(oNPC) && oNPC != GetFirstPC())
iFlag = FALSE;
FloatingTextStringOnCreature(sBark, oNPC, iFlag);
DestroyObject(OBJECT_SELF, 0.0, FALSE);
}
Modifié par DannJ, 07 février 2011 - 06:17 .
#5
Posté 07 février 2011 - 01:52
DannJ - that's awesome - exactly what I was hoping for :-)
Should get chance to play with that on my day off tomorrow, DIY permitting!
Many thanks.
Should get chance to play with that on my day off tomorrow, DIY permitting!
Many thanks.
#6
Posté 08 février 2011 - 04:32
Henchlings?
#7
Posté 08 février 2011 - 05:20
Henchlings.
like .. like Orclings.
( wee little orcs )
:|
like .. like Orclings.
( wee little orcs )
:|
#8
Posté 08 février 2011 - 01:37
Henchlings = historical P&P reference: I Couldn't remember difference between henchman & hirelings (it was the early 80's & I was v young) & "henchlings" came out - it stuck as a term for anyone who follows the main PC round - paid or not.
Or they could be wee little NPC's :-)
Or they could be wee little NPC's :-)
#9
Posté 08 février 2011 - 02:42
Wooooooooo Hoooooooooooooooooooooo!!!
It works flawlessly - thanks DannJ - now I've just got to implement it on all the triggers I've set up throughout the adventure - and I've got 1/2hr before I need to do the chool run - what could possibly go wrong? :-)
Thanks again,
Cly.
It works flawlessly - thanks DannJ - now I've just got to implement it on all the triggers I've set up throughout the adventure - and I've got 1/2hr before I need to do the chool run - what could possibly go wrong? :-)
Thanks again,
Cly.
#10
Posté 08 février 2011 - 02:43
well, apart from my awsom yping skills - obviously.......
#11
Posté 09 février 2011 - 02:20
Well - its just about working.
Dann - I'm getting similar problems to the one you mentioned - the floating text string generated by the trigger/script is duplicated if you're not controlling your own PC.
Now sure why its happening - so is it definitely resolved in your module?
Dann - I'm getting similar problems to the one you mentioned - the floating text string generated by the trigger/script is duplicated if you're not controlling your own PC.
Now sure why its happening - so is it definitely resolved in your module?
#12
Posté 09 février 2011 - 10:30
These lines here:
if (GetIsPC(oNPC) && oNPC != GetFirstPC())
iFlag = FALSE;
...should be resolving that. Or at least it works in my own module (running under patch 1.22).
if (GetIsPC(oNPC) && oNPC != GetFirstPC())
iFlag = FALSE;
...should be resolving that. Or at least it works in my own module (running under patch 1.22).
Modifié par DannJ, 09 février 2011 - 10:35 .
#13
Posté 10 février 2011 - 12:17
I think but I am not sure that you could use an I point. Attach your bark convo to the Ipoints convo slot with the npc's tag on the node so that he/she takes the line. I believe that will give you want you want.
I have something similar but not a bark so I have not tested eaxctly what you are looking for. But it work for firering a normal convo.
I think the script then looks like this.
//Put this script OnEnter
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
object oTarget;
oTarget = GetObjectByTag("Ipoint tag");
AssignCommand(oTarget, ActionStartConversation(oPC, ""));
oTarget = OBJECT_SELF;
DestroyObject(oTarget, 0.0);
}
The script destroys the trigger but it does not need to, it wont fire if the npc is not there since they are called in the convo. It also wont fire later when the timing is not right as it is destroyed on first entry.
Is that useful I'm no scripter.
PJ
BTW Lilac soul generated the script above
I have something similar but not a bark so I have not tested eaxctly what you are looking for. But it work for firering a normal convo.
I think the script then looks like this.
//Put this script OnEnter
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
object oTarget;
oTarget = GetObjectByTag("Ipoint tag");
AssignCommand(oTarget, ActionStartConversation(oPC, ""));
oTarget = OBJECT_SELF;
DestroyObject(oTarget, 0.0);
}
The script destroys the trigger but it does not need to, it wont fire if the npc is not there since they are called in the convo. It also wont fire later when the timing is not right as it is destroyed on first entry.
Is that useful I'm no scripter.
PJ
BTW Lilac soul generated the script above
Modifié par PJ156, 10 février 2011 - 12:17 .
#14
Posté 10 février 2011 - 07:08
Thanks folks, I'll take a look when I next get chance. Good old Lilac Soul if it works - without that I'd be seriously short on scripts :-)
#15
Posté 13 février 2011 - 12:49
Lovely job - Think I've got it sorted using a load of Speak Triggers triggering one line conversations - hope that's what you were describing above. Had a look at the Risen Hero mod & it seemed to be how it works there - so shamelessley copied it.
Many thanks - another big step complete - can't be much left now, surely!
Many thanks - another big step complete - can't be much left now, surely!





Retour en haut






