Useable Item with Placeable Conversations?
#1
Posté 25 septembre 2013 - 04:57
I've got the conversation on the Placeable, and I am calling it when I use the Activate Item script. Unfortunately, the conversation only fires off in the game as a one-liner so far. I want a full conversation with the object to be called when using the item based off its tag.
So far my script looks like the following:
#include "x2_inc_switches"
void main()
{
int nEvent =GetUserDefinedItemEventNumber();
if (!nEvent == X2_ITEM_EVENT_ACTIVATE) return;
object oPC = GetItemActivator();
object oItem = GetItemActivated();
object oActTarget = GetItemActivatedTarget();
if(GetObjectType(GetItemActivatedTarget())!=OBJECT_TYPE_PLACEABLE)
SetLocalInt(oPC, GetTag(OBJECT_SELF), TRUE);
object oTarget = GetObjectByTag("Table001");
AssignCommand(oTarget, ActionStartConversation(oPC, "table001conv", FALSE, FALSE));
}
Where "Table001" is the tag of the Placeable.
And "table001conv" is the conversation.
Any help would be appreciated, thanks.
#2
Posté 25 septembre 2013 - 05:19
I use this script for that:
//Put this script OnUsed
void main()
{
object oPC = GetLastUsedBy();
if (!GetIsPC(oPC)) return;
object oTarget;
oTarget = GetObjectByTag("speaker");
AssignCommand(oTarget, ActionStartConversation(oPC, ""));
}
Here the speaker is your table tag, you dont need the conversation tag, the table has that, you are simply starting it's default conversation.
It's a Lilac Soul script and works just fine.
It depends on if you are trying to do anything fancier than simply click and talk?
PJ
Modifié par PJ156, 25 septembre 2013 - 05:21 .
#3
Posté 25 septembre 2013 - 07:21
I tried several approaches to that situation some time ago. I think the method that succeeded was a roundabout method of using the item to spawn an Ipoint Speaker to fire the conversation. I'd have to review and test my scripts.
Modifié par Tchos, 25 septembre 2013 - 07:23 .
#4
Posté 26 septembre 2013 - 12:14
// i_bb_travelgem_ac
// by Brendan Bellina
// Jan 2008
// bb_travelgem OnActivate handler
// This script is executed automatically when the item is activated
// To trigger properly the name of the script MUST be "i_" + itemtag + "_ac"
// Also to make the item usable set Item Property to Cast Spell: Unique Power on Self
// Allows the party to instantly travel to a waypoint in the module
#include "ginc_debug"
#include "ginc_item_script"
void main()
{
//PrettyDebug("i_bb_travelgem_ac: debug travel gem");
object oPC = GetItemActivator();
AssignCommand(oPC, ActionStartConversation(oPC, "debug_travelgem", FALSE, FALSE, TRUE, FALSE));
}
Regards
#5
Posté 26 septembre 2013 - 02:25
Tchos wrote...
Lucan may be talking about activating an inventory item, which would fire a script to begin a conversation with a separate placeable, not using a usable placeable and starting a conversation with that.
I tried several approaches to that situation some time ago. I think the method that succeeded was a roundabout method of using the item to spawn an Ipoint Speaker to fire the conversation. I'd have to review and test my scripts.
This one.
I'm using a 'rod' in your inventory which when used should supposedly allow you to target a placeable in the gameworld and start a conversation with it.
Modifié par Lucan Silverhand, 26 septembre 2013 - 02:27 .
#6
Posté 26 septembre 2013 - 05:56
I'm not sure about the purpose of this line:
if(GetObjectType(GetItemActivatedTarget())!=OBJECT_TYPE_PLACEABLE)
SetLocalInt(oPC, GetTag(OBJECT_SELF), TRUE);
This only marks the activated inventory item with a local int when you target an object that's not a placeable. Unless there's some other script that checks the item for that local int, I'd remove it.
Also, if you're using this script as the item's tag-based activation script, then you shouldn't need the nEvent check, because there's no other situation where the script would be fired anyway.
As PJ says, you don't need to specify the name of the conversation if that conversation is assigned already on the placeable itself. The rest of the parameters can be left at their defaults, too, so no need to specify them.
So this is the edit to your original script that I propose, though I haven't tested it:
#include "x2_inc_switches"
void main()
{
object oPC = GetItemActivator();
object oItem = GetItemActivated();
object oActTarget = GetItemActivatedTarget();
AssignCommand(oActTarget, ActionStartConversation(oPC));
}
#7
Posté 27 septembre 2013 - 07:25
#include "x2_inc_switches"
void main()
{
int nEvent = GetUserDefinedItemEventNumber();
// Spells might continue to their spell scripts. All other events are
// completely handled by this script.
if ( nEvent != X2_ITEM_EVENT_SPELLCAST_AT )
SetExecutedScriptReturnValue();
case X2_ITEM_EVENT_ACTIVATE:
{
// The item's CastSpell Activate or CastSpell UniquePower was just activated.
object oItemUser = GetItemActivator();
object oItem = GetItemActivated();
object oTarget = GetItemActivatedTarget();
if( !GetIsObjectValid( oItemUser) || !GetIsObjectValid( oItem))
{
SetExecutedScriptReturnValue( X2_EXECUTE_SCRIPT_CONTINUE);
return;
}
// This is where you put your Unique power activation modifications.
if(oTarget == GetObjectByTag("your placeable tag"))
{
conv function goes here.
}
}
}
there are two naming conventions for item scripts such as this one - but i will not go into that here - but i can tell you it includes the tag of your item in both cases
look for lilac soul's script generator on the vault - within its design there is an explaination of both systems of tag based scripting
Modifié par Morbane, 27 septembre 2013 - 07:33 .
#8
Posté 04 décembre 2013 - 01:57
I've managed to get it to do exactly what I wanted it to do, thanks to the great posts above! But I am still getting the issue that the conversation is a one-liner. ActionStartConversation(oPC) only makes the first line of the conversation appear.
In my module I've set up two identical objects in the scene both with the same conversation script; the only difference between them is one is set up to be talkable (nw_g0_convplac on used) while the other needs the usable item from above to call the conversation. The talkable one brings up the whole conversation tree. The item-called one only floats the first line. Is there a way to make the item-called one show the whole tree?
#9
Posté 10 décembre 2013 - 01:42
In the conversation, give the "item-called" object the node for each of it's lined; if it's tag were "itemcalled_placeable", then under "speaker" have "itemcalled_placeable". I've found that conversations drop out when the speaker tags are wrong.
#10
Posté 12 décembre 2013 - 02:47
Edit: I changed the tags in my script and on my objects and for some reason it works now. NVM. Must not like numbers or something.
Modifié par Lucan Silverhand, 12 décembre 2013 - 05:14 .
#11
Posté 26 décembre 2013 - 05:11





Retour en haut






