Aller au contenu

Photo

Activate item and placeable target


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

#1
archer4217

archer4217
  • Members
  • 105 messages
Hi all,

I have this script where you activate an item and the target has to be a placeable, but the generator doesn't give an option to specify the placeable. Is it possible to say which placeable has to be targeted? As you can see, using this item on a placeable starts the conversation 'workbench'. It would be great if the item wouldn't work on anything but the workbench.

/*   Script generated by
Lilac Soul's NWN Script Generator, v. 2.3

For download info, please visit:
http://nwvault.ign.c...=4683&id=625    */

void main()
{
object oPC;

if ((GetObjectType(GetItemActivatedTarget())!=OBJECT_TYPE_PLACEABLE)
|| GetIsInCombat(GetItemActivator())
){

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, "workbench"));

}

Any help is greatly appreciated. :)

#2
ShadowM

ShadowM
  • Members
  • 768 messages
void main()
{
object oPC = GetItemActivator();;
object oTarget=GetItemActivatedTarget();
string sTargetTag =GetTag(oTarget);
int iCombat =GetIsInCombat(oPC);
//we going off that the workbench tag is workbench


if(GetObjectType(oTarget)!=OBJECT_TYPE_PLACEABLE || iCombat==TRUE || sTargetTag!="workbench")
{
SendMessageToPC(oPC, "Improper use of item!");
return;
}



//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.

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

}

Modifié par ShadowM, 09 octobre 2011 - 04:08 .


#3
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Give your WorkBench a unique tag. for an example I will assume that your workbench has the Tag "workbench" and nothing else has that tag in the game, In that case you do not even need to check if it is a placable or not. Just check to see if the tag is correct.

void main()
{
  object oPC= GetItemActivator();

  if (GetTag(GetItemActivatedTarget())!="workbench"
  || GetIsInCombat(GetItemActivator()))
  {
    SendMessageToPC(GetItemActivator(), "Improper use of item!");
    return;
  }
  //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.
  AssignCommand(oPC, ActionStartConversation(oPC, "workbench"));
}

EDIT:  If this is a TagBased Script you will also need to add a filter to make sure that it does not fire for the other events.

Modifié par Lightfoot8, 09 octobre 2011 - 04:18 .


#4
archer4217

archer4217
  • Members
  • 105 messages
Thank you sweeties! *hugs to ShadowM and Lightfoot8*