As the topic.How do you pick up a book for example ?
In MotB you can click on srolls that sit on tables and you pick them in your inventory.When I checked it out, they have a "pick and destroy" kind of script on their OnClick properties, and the description of the script seems to be this thing.But when I use it on my module it doesn't work...
Pickable Placeables
Débuté par
andysks
, juin 08 2013 07:48
#1
Posté 08 juin 2013 - 07:48
#2
Posté 08 juin 2013 - 08:12
This is the sort of script i'll run, onUsed, when picking up a bottle_placeable from a table
hth
ps, here's the simple version:
void main()
{
object oPC = GetLastUsedBy();
if (GetTag(OBJECT_SELF) == "kg_ot_bottle1")
CreateItemOnObject("NW_IT_MPOTION014", oPC); //pot.catsgrace
else if (GetTag(OBJECT_SELF) == "kg_ot_bottle2")
CreateItemOnObject("NW_IT_MPOTION015", oPC); //pot.bullstr
else if (GetTag(OBJECT_SELF) == "kg_ot_bottle3")
CreateItemOnObject("NW_IT_MPOTION013", oPC); //pot.bearsend
else if (GetTag(OBJECT_SELF) == "kg_ot_bottle4")
CreateItemOnObject("NW_IT_MPOTION009", oPC); //pot.bless
else if (GetTag(OBJECT_SELF) == "kg_ot_bottle5")
CreateItemOnObject("NW_IT_MPOTION016", oPC); //pot.aid
DestroyObject(OBJECT_SELF, 0.1f);
}hth
ps, here's the simple version:
void main()
{
object oPC = GetLastUsedBy();
CreateItemOnObject("item_resref", oPC);
DestroyObject(OBJECT_SELF, 0.1f);
}
Modifié par kevL, 08 juin 2013 - 09:43 .
#3
Posté 08 juin 2013 - 11:28
I got it from the complicated one but thanks nonetheless.Seems to be working.Thanks
#4
Posté 08 juin 2013 - 01:17
y, i sorta like the simplicity of the simple one tho
It led me to an idea: put a string_var on the placeable with the resref of the item to create, then pass that in for "item_resref" ... generic script bingo
It led me to an idea: put a string_var on the placeable with the resref of the item to create, then pass that in for "item_resref" ... generic script bingo
#5
Posté 08 juin 2013 - 04:31
For my pick up placeable script, I also add an animation of the PC getting the item, using either "getground", "gettable", or "gethigh" depending on a variable on the placeable, and another variable tells it which resref to create. There are a few more variables for other things, but that's all that's needed for this particular purpose.
#6
Posté 08 juin 2013 - 04:35
Could you post the portion that does the animation please Tchos.
I am interested in if you have to set facing on the pc or is that covered by their orientation when they use the object.
PJ
I am interested in if you have to set facing on the pc or is that covered by their orientation when they use the object.
PJ
#7
Posté 08 juin 2013 - 05:24
You might wanna have a look at Tero Kivinen's item placeables: nwvault.ign.com/View.php It covers both, picking up items and dropping them.
#8
Posté 08 juin 2013 - 08:56
I'm not at home right now, but when I get home I'll post my script. There's a bit more to it that what I covered here, since I like general-purpose scripts, but you can strip things out.
#9
Posté 08 juin 2013 - 09:11
Thanks, I remember the OC scripts do something for pick off the ground.
I can look at that too.
PJ
I can look at that too.
PJ
#10
Posté 09 juin 2013 - 07:05
Okay, here's what I have for mine. If this loses the tabs, as it probably will, I'll also post it on the Pastebin.
// gp_pick_up_placeable, by Tchos
//
// Put this in the placeable's On Used slot.
//
// Parameters can be specified in the local variables on the placeable.
// CreateResRef: String. If this is not blank, then an item with the specified template resref will be created in the player's inventory.
// DestroyPlaceable: Integer. If this is 1 (true), then the placeable will disappear when interacted with. Leave blank for objects that refresh themselves, like water basins or fruit trees.
// JournalTag, JournalStage, JournalHigher: These are if you want to update your journal when interacting with the placeable.
// PickUpRunScript: String. If there is a name of a script here, then it will run it, to do anything not mentioned here.
// Animation: String. From Play Custom Animation list. Default is "getground".
// PickUpSound: String. Name of sound file to play when item is acquired. Default is "it_materialhard".
void main()
{
object oPlaceable = OBJECT_SELF;
object oPC = GetLastUsedBy();
// Create item on PC, if Resref is specified
string sResRef = GetLocalString(oPlaceable, "CreateResRef");
if( sResRef!= "")
{
object oItem = CreateItemOnObject(sResRef, oPC);
}
// Play animation of interacting with the placeable
string sAnimation = GetLocalString(OBJECT_SELF,"Animation");
if (sAnimation == "") { sAnimation = "getground"; }
PlayCustomAnimation(oPC, sAnimation, 0);
// Get Rid of the Placeable, if specified
int iDestroy = GetLocalInt(oPlaceable, "DestroyPlaceable");
if( iDestroy == 1)
{
DestroyObject(oPlaceable);
}
// Play sound of picking something up
string sSound = GetLocalString(OBJECT_SELF, "PickUpSound");
if (sSound == "") { sSound = "it_materialhard"; }
AssignCommand(oPC, ActionDoCommand(PlaySound(sSound, TRUE)));
// Update journal
string sJournal = GetLocalString(oPlaceable, "JournalTag");
int iEntry = GetLocalInt(oPlaceable, "JournalStage");
// Will not override higher journal entries, unless iOverride is "TRUE"
int iOverride = GetLocalInt(oPlaceable, "JournalHigher");
if( sJournal!= "")
{
AddJournalQuestEntry(sJournal, iEntry, oPC, TRUE, FALSE, iOverride);
}
// Run any other script specified on placeable
string sRunScript = GetLocalString(OBJECT_SELF, "PickUpRunScript");
if( sRunScript!= "")
{
ExecuteScript(sRunScript, OBJECT_SELF);
}
}
Modifié par Tchos, 09 juin 2013 - 05:30 .
#11
Posté 09 juin 2013 - 11:38
Thanks Tchos, that is pretty comprehensive.
There is no need to set facing then.
I am going to use this if you don't mind (with credit of course), though I Have not done this too may time in my modules.
PJ
There is no need to set facing then.
I am going to use this if you don't mind (with credit of course), though I Have not done this too may time in my modules.
PJ
#12
Posté 09 juin 2013 - 05:27
Use it by all means. That's what I posted it for.





Retour en haut







