Aller au contenu

Photo

DM wand?


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

#1
El Condoro

El Condoro
  • Members
  • 148 messages
I want to use an item equipped on an entering DM to fire a campaign conversation that has useful tasks scripted in it. I have used an item called dm_wand with Cast Spell: Unique power [-unlimited uses] as its properties. I then have a tag based script, i_dm_wand_ac that I thought would fire upon activating the wand - not so.
When I activate the wand the message, [PC] uses item's powers, or something like that, but nothing happens.
I thought it would be easy to put an ActionStartConversation script into the tag based script but not so.
Is what I am aiming to do possible?
The reason I want to do it is to add functionality to my MP campaign as it progresses - I had hoped an item that fired a campaign conversation would allow this.
Cheers

#2
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
Can you post the script you have so far? When asking about non-functional scripts, you should always post the script you have so far, otherwise we will just be guessing at solutions.

#3
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
As Knightmare posted, I will just be guessing. Does the tag of the item match the name of the script? In the script are you assigning the target to start a conversation with itself? Do you have the proper checks in the script(ie ItemEventNumber, GetIsPC(oPC), etc...)?

What you are asking for can be done.

#4
El Condoro

El Condoro
  • Members
  • 148 messages
There's not much in the script and that's probably the problem. Glad it is possible.
I am using the standard template for Item Activate:

void main()
{
object oDM = GetItemActivator();
object oItem = GetItemActivated();
object oTarget = GetItemActivatedTarget();
location lTarget = GetItemActivatedTargetLocation();

// Start the conv_dm_wand conversation
ActionStartConversation(oDM,"conv_dm_wand",TRUE,FALSE,TRUE,TRUE);
}
The item tag is dm_wand and the script is i_dm_wand_ac.
The item is created on a DM (only) that starts the campaign so there is no check for GetIsDM() in the one above. The creation of the item works successfully so I haven't posted the script here.
I have never used ItemEventNumber so I'm sure there will be some new things for me to learn there, too.

Edit: the event is called by the module's activate scripts so I am guessing I need to specify somehow who or what is starting the conversation. I assume DMs in visible or invisible mode can have private conversations (with themselves)?

Thanks for the help.
Cheers

Modifié par El Condoro, 06 février 2011 - 08:12 .


#5
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
Try changing this line:

ActionStartConversation(oDM,"conv_dm_wand",TRUE,FALSE,TRUE,TRUE);

To this:

AssignCommand(oDM, ActionStartConversation(oDM,"conv_dm_wand",TRUE,FALSE,TRUE,TRUE));

Without assigning the command to oDM to begin the convo with themselves, they are trying to have a convo with the wand item (or rather to be more specific, in your original line the wand is being told to converse with oDM).

Modifié par _Knightmare_, 06 février 2011 - 09:08 .


#6
El Condoro

El Condoro
  • Members
  • 148 messages
This script did not work:



void main()

{

object oPC = GetItemActivator();

object oItem = GetItemActivated();

object oTarget = GetItemActivatedTarget();

location lTarget = GetItemActivatedTargetLocation();



// Start the conv_dm_wand conversation

AssignCommand(oPC, ClearAllActions(TRUE));

AssignCommand(oPC, ActionStartConversation(oPC, "conv_dm_wand", TRUE, FALSE, FALSE, FALSE));

}

I saw on another thread a reference to a flag to set on the module properties to allow tag-based scripts. What is that flag? - I can't see it in the module properties.

#7
Mad.Hatter

Mad.Hatter
  • Members
  • 165 messages
This was an issue I had when I first started doing tag based scripting. I couldn't figure out for the life of me why they wouldn't work:

This is from Jassper's Noob Corner.

The script name MUST be prefixed with “i_” AND suffixed (postfixed) with “_ac” for activate. So in the example in NWN1, our script would need to be named “i_test_item_ac”. The prefix and suffix is in place to provide a sense of security for on line modules that allow local vault players.Each event has a different suffix (postfix) as follows;
For the OnHit Cast Spell: Unique
power       Postfix = “_hc”
For the OnItemEquip Event                           Postfix = “_eq”
For the OnItemUnequip Event                       Postfix = “_ue”
For the OnAquire Event                                 Postfix = “_aq”
For the OnUnAquire Event                            Postfix = “_ua”
For the OnActivate Event                              Postfix = “_ac”
For casting a spell on the item                        Postfix = “_ci”


Modifié par Mad.Hatter, 07 février 2011 - 08:36 .


#8
El Condoro

El Condoro
  • Members
  • 148 messages
Yep, got that - the script name is given above: i_dm_wand_ac. There must be something incredibly simple that I'm missing. To confirm, to use the wand (an item that is in the player/DM's inventory) I right-click, Activate Item, it becomes a (purple?) icon that I then click on the PC/DM to activate the script, right? At that point it says [PC] has used item's powers but nothing happens.

#9
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
And you made sure the tag of the item is "i_dm_wand_ac", so that it matches exactly the name of the script? Double check that the blueprint has the correct tag and/or the item on the ground that you are testing has the correct tag, etc...

If you've already done that, are you using a custom or altered OnModuleLoad script?

#10
El Condoro

El Condoro
  • Members
  • 148 messages
I figured it out and have fixed it but yes, the OnModuleLoad script was not the default "x2_mod_def_load", which has the flags such as for tag-based scripting. I appended the line ExecuteScript("x2_mod_def_load",OBJECT_SELF) to the modified OnModuleLoad script and now, voila, the conversation fires when the item is activated. Man, what a process!



Thanks to everyone for your help. Cheers