Aller au contenu

Photo

Getting an Item to fire a conversation...


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

#1
MokahTGS

MokahTGS
  • Members
  • 946 messages
This sounds like a dumb thing to ask, but I'm having trouble getting an item to fire off a conversation when used.  Is tag based scripting on by default in a mod or do I have to turn it on?  How to I check that?

I have an item that has a tag of "jw_mush_golden" and a script with the same name (see below).  The item has a property of Cast Spell: Unique Item Self Unlimited uses.  Nothing happens however when used.

void main()
{
object oPC;

if (!GetIsPC(GetItemActivatedTarget())
){

SendMessageToPC(GetItemActivator(), "Improper use of item!");
return;}

oPC = GetItemActivator();

//The PC will technically start a conversation with himself
//You should add some odd little sound to the first line in the
//conversation file, or the PC will give his normal voicegreeting.

object oTarget;
oTarget = oPC;

AssignCommand(oTarget, ActionStartConversation(oPC, "jw_mush_travel"));

}


I should also note that this module takes place across several modules via a campaign, so the above script and the conversation file are campaign resources.

Any help would be appreciated.  :unsure:

#2
c i p h e r

c i p h e r
  • Members
  • 261 messages
Yes, it's a module switch you have to enable.

#include "x2_inc_switches"
SetModuleSwitch(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);

Name your item script:

i_{itemtag}

I think that'll do it.

Modifié par ç i p h é r, 15 août 2010 - 06:57 .


#3
MokahTGS

MokahTGS
  • Members
  • 946 messages
Ok, I'm not doing this right.  It's not working.  Where do I need to call the switch?  Can I call it in the item script or does it need to be called in a script before hand?

#4
Alupinu

Alupinu
  • Members
  • 528 messages
Have you looked into your mod properties? Maybe in “On Acquire Item Script” or “Activate Item Script”? Maybe that’s what he is talking about. Just a thought... :)

#5
c i p h e r

c i p h e r
  • Members
  • 261 messages
You should set it OnModuleLoad (one of the module events which you can hook into).

Modifié par ç i p h é r, 15 août 2010 - 10:36 .


#6
MokahTGS

MokahTGS
  • Members
  • 946 messages
ok, it looks like that switch is set by default on the module load script, so I shouldn't have to do anything.

#7
MasterChanger

MasterChanger
  • Members
  • 686 messages
Yes, x2_mod_def_load does set tag-based scripting on by default, so you don't have to do that. The full script name should be i_jw_mush_golden_ac for activate.

I would stick a SendMessageToPC(...) in the second part of the script as well (the part after you've determined that the user is a PC) just to double-check which part isn't firing correctly.

Here's the best guide I've found if you need it for reference.

#8
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 585 messages
An activate script needs to be named i_tag_ac

#9
LeeMer47

LeeMer47
  • Members
  • 111 messages
The following works for me in my Swimming With Anemones module for a talking fish in your inventory using the script in OnActivateItem() or whatever it is called now:

#include "x2_inc_switches"
void main()
{
string szItem = GetTag(GetItemActivated());
object oActivator = GetItemActivator();

// * start conversation with player
if (szItem == "SWA_IT_MSMLMISC01")
{
object oFishy = GetObjectByTag("x2_plc_intwp");
DelayCommand(1.0, AssignCommand(oFishy, ActionStartConversation(oActivator, "fishy_tale", TRUE, FALSE)));
}
}

Modifié par LeeMer47, 19 août 2010 - 06:28 .