Barkstrings revisited
#26
Posté 03 octobre 2012 - 11:17
You can also use ActionStartConversation function and have the triggering character start a "barkstring" conversation.
The barkstring conversation can contain all your barkstrings for every character you want to use it and each barkstring can be controlled by variables set just prior to the conversation being controlled.
Such conversations only have single (red) lines of conversation that are displayed when the conversation is called. I have even used such an arrangement with random variables for random comments.
Cheers.
Lance.
#27
Posté 04 octobre 2012 - 08:54
With that function, who would the triggering character start a conversation with? Would it be an ipoint? I've had an issue with starting conversations with ipoints: If the player is in control of a companion when they trigger the conversation, the main PC gets teleported to the trigger to start the conversation instead - which is fine in a small room, but if you're scouting way ahead using the companion party rogue, it can be a tad pesky to suddenly have your squishy mage telported to within arrow range of a party of orcs!
Is there a way to avoid this?
Also - I thought I'd got it sorted with the Speakstring script - even set up coloured text for different companions so it was easier to see who said what. Worked fine in my testing module, but when I transferred the scripts over to my campaign module - no speakstrings appear to be triggered :-(
Cly.
#28
Posté 04 octobre 2012 - 12:54
I may be overstating this, but, it may be more complicated than it first looks. The reason I say this, is because it does depend on who you want to do the talking and when.
In its simplest format, (your original post) you were asking to have someone say something when they entered a trigger. As you have already discovered, using a floaty text becomes awkward to use when possessing another companion due to faction duplication .. and (in my experience), other issues, especially if you intended the player to continue the conversation for any reason (rather than the simple one liner bark string). The problem gets much more complicated if you are also trying to do this for a MP game ... for instance: Is another player possessing the companion who was about to make its one-liner comment?
I also had the some problems with SpeakString function as well ... which may be down to a timing issue, as I have it on a delay - or because I am trying to see "other speech" through a cutscene conversation at the same time. The bottom line is, however, it is not as straight forward as one might think (at least I don't think so).
Anyway, after all that rambling (and looking over what you were asking again), I believe what you are trying to do is not too dissimilar from something I have been wrestling with for some time ... the only real difference is you want a single bark string, whereas my own code starts a full conversation. Now, I believe I have achieved this (but something normally comes back to haunt me when I say that), but my own code is heavily loaded with many other checks as well, which may only serve to confuse what you actually need.
So, the bottom line ... you need to do some checking even before the event takes place.
For instance, note some (or all) the following will make the suggested conversation NOT fire:-
1) If the Main PC is too far from the speaking companion to hear it.
2) If the supposed speaking companion is incapacitated in any way (including standing back).
3) Be prepared to use SetOwnersControlledCompanion function to move Main PC back to self prior speech.
Once you have made all the checks you need to ensure the companion can speak and the Main PC is around to hear the comment, then you can start a conversation between the Main PC and the comapnion involved with either one barkstring (as you want), or a complete conversation (as I have).
With comments, my own script is 370 lines long to do something like this! BUT, my script does also cater for alternative speakers if the one selected is not present and allows for things like NPC speaking and if certain members are invisible or incapacitated in other ways.
Once you have a script that checks is everything is in place for the conversation to take place (that will bark the single line of text), then you simply make the companion start the "barkstring conversation" with the Main PC.
Perhaps you can give some circumstances when and how you want your companions to make their comments? Then, once you know how the conversation is meant to take place, you can start to write in exceptions as to when the conversation simply cannot happen.
I know this seems an exceptionally long post for something that should be very simple, but it's because it's a simple idea, but with long reaching consequences when you start to break it down.
Cheers!
Lance.
Modifié par Lance Botelle, 04 octobre 2012 - 01:07 .
#29
Posté 05 octobre 2012 - 08:08
Thanks,
Cly.
#30
Posté 05 octobre 2012 - 04:05
Do let me know what you come up with.
Lance.
#31
Posté 07 octobre 2012 - 06:12
Well, after a bit of frantic testing before work this morning, I think we have a winner in terms of which script & what trigger variables make for a working combination.
This works regardless of which character - main Character or Companion - walks into the trigger (not tested multi player though) - no annoying teleporting of the main Character to the trigger from wherever they're hiding at the back of the party.
Its also pretty simple - which in my book is the best way to do things if at all possible.
Use a regular Generic Trigger with NO variables set at all, just the following script set to run 'On Enter'
The script is:
void main()
{
object oBarker = GetObjectByTag("Put tag of character to speak here");
AssignCommand(oBarker, SpeakString("Put your text here"));
DestroyObject(OBJECT_SELF);
}
Here's an example - I love examples as the best way to explain how to do things:
void main()
{
object oBarker = GetObjectByTag("davebarby");
AssignCommand(oBarker, SpeakString("<c=OrangeRed>Hear me! - I smell the evil Sorceror Paul Daniels ahead - I'd know that wig adhesive anywhere!</c>"));
DestroyObject(OBJECT_SELF);
}
This script makes Dave the Barbarian (an old P&P character I had for years), tag = davebarby, speak the line "Hear Me! etc." in nice coloured type (I've given each companion a different colour to speak in so its easier to see who's saying what, and it adds a bit of character).
Then the thing destroys itself so it won't be triggered again - which is nice.
The text appears above the speaker's head & in the dialog box, although if they're too far away from the triggering character, nothing will be seen - which is fine - after all - they're out of earshot of the person triggering the announcement.
Hope this is useful to anyone else struggling to work out how to do this - it seems pretty reliable and is exactly what I wanted.
Many thanks to everyone who's helped me work this out - whether your suggestions worked, or not - a good team effort I thought.
Cly.
#32
Posté 07 octobre 2012 - 09:48
You can set the TALKVOLUME_ variable in SpeakString to control how far away you'll 'hear' the comment from. That way Dave the Barbarian can shout "HEY! I'VE FOUND THE BANDITS WE WERE SNEAKING UP ON!" loud enough for everyone to hear.
#33
Posté 08 octobre 2012 - 12:37
DannJ makes some good points. However, if the script works for your needs and you do not need the same thing to happen too often, then a simple system like you have it will work. As you do more scripting, you may, however, start to change some of the way you do things, just to avoid repetative coding.
Good to hear it as done!
Lance.
#34
Posté 09 octobre 2012 - 08:33
void main()
{
object oBarker = GetObjectByTag("kg_ct_Tiera");
AssignCommand(oBarker, SpeakString("BarkString"));
DestroyObject(OBJECT_SELF);
}
Setting a variable up on the trigger variables named "BarkString" & giving it a value of whatever I wanted the character tagged to say, but all the character ever said was "BarkString" - I'm probably missing the obvious - so please point it out if possible because you're right - using variables would help no end.
In the mean time, I've set up scripts for each individual barkstring, which to be fair didn't take that long - mainly because this is only a short adventure - which is odd considering how long its taking to finish!!
And to think at christmas I was originally thinking of a Feb 2012 release!
Now for some weird reason a trigger that gets a giant scorpion to walk from its lair to a waypoint in front of the party is suddenly failing!
I'm sure I've not changed anything since I set it up except maybe moving the scorp a little further over the hill from the beach so the PCs can't see it from where they get off their little boat, but I'm sure that's all.
I've checked the walkmesh & there's plenty of room for it to get between the rocks to its WP.
I've nipped up the hill & tapped it on the shoulder to get its attention & its successfully chased my testing PC to where its WP is on the beach.
I've checked its tag against the tag called in the script & all looks OK.
Anyone have any bright ideas?
Can scripts just suddenly fail to work for no good reason? My innocent logic says it can't happen, but I don't pretend to understand the vaguaries of the toolset :-)
Cly.
ps- Dann - that's just the sort of thing the P&P version of Dave the Barby would have done - not known for his subtlety.
#35
Posté 09 octobre 2012 - 08:40
Assuming you set the variable on the trigger as follows:-
Set a string value in the variable holder you are calling BARKSTRING.
E.g. The variable section on the trigger would have a string variable called BARKSTRING, in which you have placed what you want the PC to say. E.g. "A monster!"
Now, your trigger on entry script would be:-
void main()
{
object oBarker = GetObjectByTag("kg_ct_Tiera");
string SayThis = GetLocalString(OBJECT_SELF, "BARKSTRING");
AssignCommand(oBarker, SpeakString(SayThis));
DestroyObject(OBJECT_SELF);
}
Hope that helps explain it a bit. You simply place a different string value in the trigger's BARKSTRING string variable holder.
I have a easy way of thinking about this .... Think of these variable holders as boxes. You can place what you want in the box (string in string boxes and integers in integer boxes, etc) and ask for it again later.
Lance.
EDIT: "I'm sure I've not changed anything since I set it up except maybe moving the scorp a little further over the hill from the beach so the PCs can't see it from where they get off their little boat, but I'm sure that's all."
As for this problem, the chances are you have moved it far enough from its target o allow a heartbeat to occur, which may be cancelling its current action for some reason. If it is not that, then posting the script may help. It all depends what the scorpion has attached to it in the way of other scripts and what hooks it has to fire.
Modifié par Lance Botelle, 09 octobre 2012 - 08:45 .
#36
Posté 10 octobre 2012 - 11:01
Clyordes wrote...
Now for some weird reason a trigger that gets a giant scorpion to walk from its lair to a waypoint in front of the party is suddenly failing!
I've checked its tag against the tag called in the script & all looks OK.
Can scripts just suddenly fail to work for no good reason?
When I had a recent mysterious trigger script failure, the problem was that I had placed another item with the same tag as the script was referencing, and it was trying to affect the other one. Do you have more than one scorpion?
#37
Posté 12 octobre 2012 - 01:21
Tchos - Heartbeats - I hadn't thought of that. Although I'm pretty certain there's nothing relevant that might be interfering - I'll definitely take a look.
As for there being another giant scorpion lurking around - that may be it - I had problems with the appearances from the custom content vanishing every so often - it might be there's a giant invisible scorpion lost somewhere else on the island that's getting called by the script. At least that's easy to check. As an extra measure, I'm giving the scorp and its waypoint different tags - just in case.
Got to get this done soon - my shiny new copy of X-Com is in the post!
Cly.
#38
Posté 12 octobre 2012 - 02:08
#39
Posté 12 octobre 2012 - 02:32
X-Com!Clyordes wrote...
Got to get this done soon - my shiny new copy of X-Com is in the post!
the new one? ( i'm addicted to the old one )
#40
Posté 12 octobre 2012 - 05:45
Clyordes wrote...
Thanks Lance - That's what I thought I'd set up & it wasn't working correctly - maybe I missed something - I may get to play a little with it for the next mod, as its going to be a lot bigger & have a lot more of these things in it.
Tchos - Heartbeats - I hadn't thought of that. Although I'm pretty certain there's nothing relevant that might be interfering - I'll definitely take a look.
As for there being another giant scorpion lurking around - that may be it - I had problems with the appearances from the custom content vanishing every so often - it might be there's a giant invisible scorpion lost somewhere else on the island that's getting called by the script. At least that's easy to check. As an extra measure, I'm giving the scorp and its waypoint different tags - just in case.
Got to get this done soon - my shiny new copy of X-Com is in the post!
Cly.
Hi Clyordes,
Just to clarify .... I mentioned "heartbeats" and Tchos mentioned "tags" ...
I only mention it because I am interested to hear what did cause teh problem in the end.
Cheers,
Lance.
#41
Posté 15 octobre 2012 - 05:51
Tchos - the tags of the wp & scorion are definitely different. Even added a parallel trigger, script, wp & creature (zombie this time) on a different section of the same beach to see what happened. Used Lilac Soul to create the script as before - failed to work completely.
Odd - it defiintely worked fine a few weeks ago - I was really pleased with it at the time.
Cly.
ps - yep - the new X-com - my brother downloaded his from steam on friday night & played through the night - ah - what it is to be young, unmarried & not a parent! :-)
#42
Posté 15 octobre 2012 - 06:32
You may have already checked that, but another thing to check is whether there's any other object in the module, including in other areas, with that same tag. Several of the tag scripts will check the entire module for an object with a specified tag, and act on the first one it finds. I found that problem since I was using a testing area with copies of the creatures and items for testing before placing them in their actual areas.
#43
Posté 15 octobre 2012 - 09:00
I thought adding a completely seperate trigger, script & creature (a zombie) that doesn't exist anywhere else in the module would show best what was going on, but now that's failed too, I'm a bit baffled.
Still, setting that up was a bit of a rush job - I'll have more time to test properly in a couple of days - dang this real life getting in the way! :-)
Cly.
#44
Posté 19 octobre 2012 - 08:00
I have a testing module that's really just a copy of the main adventure I'm building with all the areas stripped out except a bare green field - so all module properties are the same.
(The main adventure also has a version of this field for secondary testing complex issues that aren't working properly.)
I re-created the script using the original Lilac Soul generator (in case the updated one is causing the problem) which sends a creature to a specified waypoint when a PC enters a trigger. I used a completely new creature, trigger and waypoint, all with new tags.
The event fired perfectly.
So, I did the same thing in the green testing field area of the main campaign adventure, using exactly the same creature, script, trigger and waypoint.
The event failed.
I'm a bit baffled. The only thing I can think of is that I didn't create a new trigger or waypoint - I just renamed the ones that I'd set up when I tested it last week. Maybe I used a speech trigger by mistake, or some other such blunder, although I recall creating them fresh for last week's test.
More testing soon.
Cly.
#45
Posté 19 octobre 2012 - 08:37
If you post the problematic code, either directly in here or with a link to Pastebin, it would be easier to suggest where to look for the problem. This particular address is most convenient because it colour codes for NW Script, making it easier to read than the forum. But, the disadvantage of separating content like this is that someone may want to read this example years later, and the link may be broken by then.
#46
Posté 20 octobre 2012 - 07:29
I've just tried out a very old working version of the module from March and the scorpion wanders over the hill toward the party in exactly the right way after the PC walks into the trigger - so it seems that something's changed between then and now.
With a bit of luck I'll have chance to import that version of the area into my current working version of the module later on & I'll see if its really that easy to solve!
Kinda lucky I kept that old backup buried away on the family laptop way back in the spring!
Cly.
#47
Posté 22 octobre 2012 - 03:31
The easiest way to get Mr Pinchy to walk to a waypoint would be to make him script-hidden to begin with, right-click on his instance in the toolset and create a personal waypoint for him (make sure he has a unique tag first). Move the waypoint to where you want him to end up, then have the player trigger simply make him script-unhidden. The game's walk waypoint code will kick into gear, and he'll walk to the waypoint of his own accord without any need to make him do so.
If he's hostile and he sees enemies on the way then he might get waylaid temporarily, but once he's out of combat (assuming he wins) he'll head straight for his home waypoint again.
Modifié par DannJ, 22 octobre 2012 - 03:34 .
#48
Posté 22 octobre 2012 - 05:56
This may be more obvious than I know, but how do I create a personal waypoint? Is it as simple as creating a blank waypoint and giving it the same tag as the creature who's to use it? And how to make old Scorpy script hidden/unhidden. I'm presuming you're thinking of the 'script hidden' creature property, but how do you 'unhide' it?
For what its worth, below is the script that works fine in the March backup of the adventure, but not at all in the current version, even when the March version of the area is imported into the current version (and the current corresponding area deleted).
void main()
{
object oActor;
// Get the creature who triggered this event.
object oPC = GetEnteringObject();
// Only fire for (real) PCs.
if ( !GetIsPC(oPC) || GetIsDMPossessed(oPC) )
return;
// Only fire once.
if ( GetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF)) )
return;
SetLocalInt(GetModule(), "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);
// Send a message to the player's chat window.
SendMessageToPC(oPC, "Dominating your attention here is the large wreck - what treasure awaits?");
// Have "scorpion" perform a sequence of actions.
oActor = GetObjectByTag("scorpion");
AssignCommand(oActor, ActionMoveToObject(GetNearestObjectByTag("scorp_dest")));
}
Cly.
#49
Posté 22 octobre 2012 - 11:38
#50
Posté 22 octobre 2012 - 03:39
Clyordes wrote...
... For what its worth, below is the script that works fine in the March backup of the adventure, but not at all in the current version, even when the March version of the area is imported into the current version (and the current corresponding area deleted).
Cly.
Hi Cly,
I have rewritten your code, with just one more added line to try (see below). EDIT: And made the check on itself rather than the module.
1) Assumes your scorpion tag is "scorpion" (case sensitive).
2) Assumes your waypoint tag is "scorp_dest" (case sensitive).
3) Assumes only ONE scorpion IN ENTIRE MODULE and only ONE waypoint tag IN AREA. (*)
4) Assumes you are NOT destroying the trigger on entering as well. (**)
(*) Not strictly true with waypoint tag, but the scorpion will go to the closest you have in the area.
(**) I have seen triggers destroy before code has fired sometimes. You can delay destroy in the code instead.
All my extra line does in make sure its action queue is cleared, just in case something is messing with it. EDIT: I also made the variable check on itself (the trigger) rather than the module.
Keep us updated.
Lance.
void main()
{
// Get the creature who triggered this event.
object oPC = GetEnteringObject();
// Only fire for (real) PCs.
if (!GetIsPC(oPC) || GetIsDMPossessed(oPC)){return;}
// Only fire once.
if (GetLocalInt(OBJECT_SELF, "DO_ONCE") == TRUE){return;}
SetLocalInt(OBJECT_SELF, "DO_ONCE", TRUE);
// Send a message to the player's chat window.
SendMessageToPC(oPC, "Dominating your attention here is the large wreck - what treasure awaits?");
// Have "scorpion" perform a sequence of actions.
object oActor = GetObjectByTag("scorpion"); // Assumes your scorpion tag is "scorpion"
AssignCommand(oActor, ClearAllActions(TRUE));
AssignCommand(oActor, ActionMoveToObject(GetNearestObjectByTag("scorp_dest"))); // Assumes your WP tag is "scorp_dest"
}
Modifié par Lance Botelle, 22 octobre 2012 - 03:48 .





Retour en haut






