I'm trying to create an item that selects two targets, a source item, and a destination. If I use the standard "Cast Spell: Unique Power" script method, I only get one target selection so I'm thinking maybe I spawn a conversation where it asks for the destination after I've selected the source item that'd do the trick but I'm not being able to find examples nor obvious looking methods. If anyone knows how to do this I'd be very appreciative!
Need help firing off item select from conversation
Débuté par
The__Dude
, déc. 18 2010 09:29
#1
Posté 18 décembre 2010 - 09:29
#2
Posté 18 décembre 2010 - 10:38
Have your item have Unique power self and Unique power target. When you target the first item put a integer on the item then in the script when you target something else it will check for the integer and save it to the second destination. Use the Unique power self to clear the targets and clear the integer. You can use debug messages to the user to check errors. Like Target one has been selected, target two has been selected. This is just off the top of my head, give it a try.
#3
Posté 19 décembre 2010 - 02:50
ok you can use shadows method unique power self to target item user, and unique power to target a creature or location. the trick is calling the right function for what you want to do I will get on tool set and then post example script for you.
#4
Posté 19 décembre 2010 - 03:10
@The_Dude It would help if we had more information on what you are tring to do. Are both source and destination items? If only the source is an item you can just have the script check to see if it wan an item targted. If they are both items, the fitst time the power is used store the ActvatedItemTarget as a local. Having the script check to see if the local you can decide if this is the first or second time the item was used, thereby scripting different actions for when it is used for both source and destination.
#5
Posté 19 décembre 2010 - 03:57
/////////////////////////////////////////////
//
// created by Greyfort
// 12.18.2010
//
// multi targeting
// ac_multarg
/////////////////////////////////////////////
// include files here
///////////////////////////////////////////////////////////////////////////////
void main()
{
int iScriptBug=0;
object oItem =GetItemActivated();
object oPC = GetItemActivator();
//get and set item target
object oTarget=GetItemActivatedTarget();
SetLocalObject(oItem,"itm_target",oTarget);
//get and set item location targeted;
location lTargLoc=GetItemActivatedTargetLocation();
SetLocalLocation(oItem,"itm_targ_loc",lTargLoc);
/////////////////////////////////////////////////////////////
// fire targeted object script here unique power
////////////////////////////////////////////////////////////
if(oTarget != oPC )//&& GetIsObjectValid(oTarget)==TRUE)
{
//
if(GetObjectType(oTarget) !=OBJECT_TYPE_CREATURE && GetObjectType(oTarget) !=OBJECT_TYPE_PLACEABLE
&& GetObjectType(oTarget) !=OBJECT_TYPE_ITEM && GetObjectType(oTarget) !=OBJECT_TYPE_DOOR )
{
// target location script fired here
SendMessageToPC(oPC,"Target location script fired");
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionJumpToLocation(lTargLoc) );
}
// preform action on target objects creatures,placeables see Lexicon object types
if(GetObjectType(oTarget) ==OBJECT_TYPE_CREATURE && GetIsObjectValid(oTarget)==TRUE )
{
// CREATURE script
SendMessageToPC(oPC,"Target CREATURE script fired");
}
if(GetObjectType(oTarget) ==OBJECT_TYPE_PLACEABLE && GetIsObjectValid(oTarget)==TRUE )
{
// PLACEABLE script
SendMessageToPC(oPC,"Target PLACEABLE script fired");
}
if(GetObjectType(oTarget) ==OBJECT_TYPE_ITEM && GetIsObjectValid(oTarget)==TRUE)
{
// ITEM script
SendMessageToPC(oPC,"Target ITEM script fired");
}
if(GetObjectType(oTarget) ==OBJECT_TYPE_DOOR && GetIsObjectValid(oTarget)==TRUE)
{
// DOOR script
SendMessageToPC(oPC,"Target DOOR script fired");
}
iScriptBug=1;
}//end of unique power
/////////////////////////////////////////////////////////////
// fire targeted object unique power self
////////////////////////////////////////////////////////////
if(oTarget == oPC && GetIsObjectValid(oTarget)==TRUE )
{
// perform action on player character usuing item
SendMessageToPC(oPC,"Target SELF script fired");
iScriptBug=1;
}//end of unique power self
/////////////////////////////////////////////////////////////
// not a valid object
// note this fires even if location is valid. so not to have
// error text apear iScriptBug=0 is needed.
// just // lines 14,60,70 to see what I'm talking about
////////////////////////////////////////////////////////////
if( GetLocation(oTarget)!= lTargLoc && GetIsObjectValid(oTarget)==FALSE && iScriptBug==0 )
{
// error text apears
SendMessageToPC(oPC,"Not a Valid object Target script fired");
}
}//end of script
here is script source useing just funtions. SetLocalObject(oItem,"itm_target",oTarget);, and SetLocalLocation(oItem,"itm_targ_loc",lTargLoc); are not used in this script they are another way to keep track of things wich could allow you to fire other scripts etc. Also the iScriptBug=1; is best after a script is fired ware I put it on line 60 was just quick to show it stoped the error message from apearing. what this means is if oTarget meets none of the if statement iScriptBug=0 which means not a valid target object.
This would be better way:
/////////////////////////////////////////////////////////////
// fire targeted object script here unique power
////////////////////////////////////////////////////////////
if(oTarget != oPC )//&& GetIsObjectValid(oTarget)==TRUE)
{
//
if(GetObjectType(oTarget) !=OBJECT_TYPE_CREATURE && GetObjectType(oTarget) !=OBJECT_TYPE_PLACEABLE
&& GetObjectType(oTarget) !=OBJECT_TYPE_ITEM && GetObjectType(oTarget) !=OBJECT_TYPE_DOOR )
{
// target location script fired here
SendMessageToPC(oPC,"Target location script fired");
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionJumpToLocation(lTargLoc) );
iScriptBug=1;
}
// preform action on target objects creatures,placeables see Lexicon object types
if(GetObjectType(oTarget) ==OBJECT_TYPE_CREATURE && GetIsObjectValid(oTarget)==TRUE )
{
// CREATURE script
SendMessageToPC(oPC,"Target CREATURE script fired");
iScriptBug=1;
}
if(GetObjectType(oTarget) ==OBJECT_TYPE_PLACEABLE && GetIsObjectValid(oTarget)==TRUE )
{
// PLACEABLE script
SendMessageToPC(oPC,"Target PLACEABLE script fired");
iScriptBug=1;
}
if(GetObjectType(oTarget) ==OBJECT_TYPE_ITEM && GetIsObjectValid(oTarget)==TRUE)
{
// ITEM script
SendMessageToPC(oPC,"Target ITEM script fired");
iScriptBug=1;
}
if(GetObjectType(oTarget) ==OBJECT_TYPE_DOOR && GetIsObjectValid(oTarget)==TRUE)
{
// DOOR script
SendMessageToPC(oPC,"Target DOOR script fired");
ActionStartConversation(oPC,"name of canversation",TRUE,FALSE);
iScriptBug=1;
}
}//end of unique power
I also forgot to add your question about spawning a conversation after abject targeted I gave example in the // DOOR script that will start the conversation with PC so they can choose what they want to do with the door.
//
// created by Greyfort
// 12.18.2010
//
// multi targeting
// ac_multarg
/////////////////////////////////////////////
// include files here
///////////////////////////////////////////////////////////////////////////////
void main()
{
int iScriptBug=0;
object oItem =GetItemActivated();
object oPC = GetItemActivator();
//get and set item target
object oTarget=GetItemActivatedTarget();
SetLocalObject(oItem,"itm_target",oTarget);
//get and set item location targeted;
location lTargLoc=GetItemActivatedTargetLocation();
SetLocalLocation(oItem,"itm_targ_loc",lTargLoc);
/////////////////////////////////////////////////////////////
// fire targeted object script here unique power
////////////////////////////////////////////////////////////
if(oTarget != oPC )//&& GetIsObjectValid(oTarget)==TRUE)
{
//
if(GetObjectType(oTarget) !=OBJECT_TYPE_CREATURE && GetObjectType(oTarget) !=OBJECT_TYPE_PLACEABLE
&& GetObjectType(oTarget) !=OBJECT_TYPE_ITEM && GetObjectType(oTarget) !=OBJECT_TYPE_DOOR )
{
// target location script fired here
SendMessageToPC(oPC,"Target location script fired");
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionJumpToLocation(lTargLoc) );
}
// preform action on target objects creatures,placeables see Lexicon object types
if(GetObjectType(oTarget) ==OBJECT_TYPE_CREATURE && GetIsObjectValid(oTarget)==TRUE )
{
// CREATURE script
SendMessageToPC(oPC,"Target CREATURE script fired");
}
if(GetObjectType(oTarget) ==OBJECT_TYPE_PLACEABLE && GetIsObjectValid(oTarget)==TRUE )
{
// PLACEABLE script
SendMessageToPC(oPC,"Target PLACEABLE script fired");
}
if(GetObjectType(oTarget) ==OBJECT_TYPE_ITEM && GetIsObjectValid(oTarget)==TRUE)
{
// ITEM script
SendMessageToPC(oPC,"Target ITEM script fired");
}
if(GetObjectType(oTarget) ==OBJECT_TYPE_DOOR && GetIsObjectValid(oTarget)==TRUE)
{
// DOOR script
SendMessageToPC(oPC,"Target DOOR script fired");
}
iScriptBug=1;
}//end of unique power
/////////////////////////////////////////////////////////////
// fire targeted object unique power self
////////////////////////////////////////////////////////////
if(oTarget == oPC && GetIsObjectValid(oTarget)==TRUE )
{
// perform action on player character usuing item
SendMessageToPC(oPC,"Target SELF script fired");
iScriptBug=1;
}//end of unique power self
/////////////////////////////////////////////////////////////
// not a valid object
// note this fires even if location is valid. so not to have
// error text apear iScriptBug=0 is needed.
// just // lines 14,60,70 to see what I'm talking about
////////////////////////////////////////////////////////////
if( GetLocation(oTarget)!= lTargLoc && GetIsObjectValid(oTarget)==FALSE && iScriptBug==0 )
{
// error text apears
SendMessageToPC(oPC,"Not a Valid object Target script fired");
}
}//end of script
here is script source useing just funtions. SetLocalObject(oItem,"itm_target",oTarget);, and SetLocalLocation(oItem,"itm_targ_loc",lTargLoc); are not used in this script they are another way to keep track of things wich could allow you to fire other scripts etc. Also the iScriptBug=1; is best after a script is fired ware I put it on line 60 was just quick to show it stoped the error message from apearing. what this means is if oTarget meets none of the if statement iScriptBug=0 which means not a valid target object.
This would be better way:
/////////////////////////////////////////////////////////////
// fire targeted object script here unique power
////////////////////////////////////////////////////////////
if(oTarget != oPC )//&& GetIsObjectValid(oTarget)==TRUE)
{
//
if(GetObjectType(oTarget) !=OBJECT_TYPE_CREATURE && GetObjectType(oTarget) !=OBJECT_TYPE_PLACEABLE
&& GetObjectType(oTarget) !=OBJECT_TYPE_ITEM && GetObjectType(oTarget) !=OBJECT_TYPE_DOOR )
{
// target location script fired here
SendMessageToPC(oPC,"Target location script fired");
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionJumpToLocation(lTargLoc) );
iScriptBug=1;
}
// preform action on target objects creatures,placeables see Lexicon object types
if(GetObjectType(oTarget) ==OBJECT_TYPE_CREATURE && GetIsObjectValid(oTarget)==TRUE )
{
// CREATURE script
SendMessageToPC(oPC,"Target CREATURE script fired");
iScriptBug=1;
}
if(GetObjectType(oTarget) ==OBJECT_TYPE_PLACEABLE && GetIsObjectValid(oTarget)==TRUE )
{
// PLACEABLE script
SendMessageToPC(oPC,"Target PLACEABLE script fired");
iScriptBug=1;
}
if(GetObjectType(oTarget) ==OBJECT_TYPE_ITEM && GetIsObjectValid(oTarget)==TRUE)
{
// ITEM script
SendMessageToPC(oPC,"Target ITEM script fired");
iScriptBug=1;
}
if(GetObjectType(oTarget) ==OBJECT_TYPE_DOOR && GetIsObjectValid(oTarget)==TRUE)
{
// DOOR script
SendMessageToPC(oPC,"Target DOOR script fired");
ActionStartConversation(oPC,"name of canversation",TRUE,FALSE);
iScriptBug=1;
}
}//end of unique power
I also forgot to add your question about spawning a conversation after abject targeted I gave example in the // DOOR script that will start the conversation with PC so they can choose what they want to do with the door.
Modifié par Greyfort, 19 décembre 2010 - 04:26 .
#6
Posté 19 décembre 2010 - 09:43
Thanks for the ideas and, wow @Greyfort, thanks for the example! That's a huge help!
Sorry about not specifying the end goal. I know that's usually more helpful than the request itself.
I'm trying to bundle items into a large box, sack, etc. that I have in my inventory or, alternatively, to transfer them into the inventory of a chest I have open. I'm working with crafting items and they can get scattered all over my inventory so once I've found one of the type of thing I care about I'd like to be able to either drop off all I have of them in one fell swoop to the shared chest or, if I'm planning to keep them myself, bundle all I have of them up into one place in my inventory: a box or bag.
So, I need to target first the item I'm moving and then the item I'm moving it to. I think you've given me plenty to work with here. Thanks again!
Sorry about not specifying the end goal. I know that's usually more helpful than the request itself.
I'm trying to bundle items into a large box, sack, etc. that I have in my inventory or, alternatively, to transfer them into the inventory of a chest I have open. I'm working with crafting items and they can get scattered all over my inventory so once I've found one of the type of thing I care about I'd like to be able to either drop off all I have of them in one fell swoop to the shared chest or, if I'm planning to keep them myself, bundle all I have of them up into one place in my inventory: a box or bag.
So, I need to target first the item I'm moving and then the item I'm moving it to. I think you've given me plenty to work with here. Thanks again!





Retour en haut







