so i've been doing some thinking about how to make a script set for creating an item in a container. I need certain requirements to be met in order for the items to appear in the chest, need the same requirements for when they take the item, this will give a journal update, and need something for the OnClose to match the other two scripts. so far, this is what i have:
OnOpen:
#include "pqj_inc"
void main()
{
object oPC = GetLastOpenedBy();
if(!GetIsPC(oPC))
{
return;
}
object oNPC = OBJECT_SELF;
if(GetLocalInt(oPC,GetTag(oNPC)))
{
return;
}
int nInt = RetrieveQuestState("q_ezra",GetLastOpenedBy());
if (nInt != 10)
{
return;
}
CreateItemOnObject("ezra_book", OBJECT_SELF);
}
OnDisturbed:
#include "pqj_inc"
void main()
{
int iType = GetInventoryDisturbType();
object oPC = GetLastDisturbed();
object oItem = GetInventoryDisturbItem();
if (!GetIsPC(oPC)) return;
if(iType == INVENTORY_DISTURB_TYPE_REMOVED && GetTag(oItem) == "ezra_book")
{
FloatingTextStringOnCreature("** Your Journal Has Been Updated **", oPC);
AddPersistentJournalQuestEntry("q_ezra",20,oPC,FALSE);
}
}
and OnClosed:
**script goes here**
i have also been told this way:
place the item in the chest in the toolset, then in the OnDisturbed slot, ad this:
#include "pqj_inc"
void main()
{
int iType = GetInventoryDisturbType();
object oPC = GetLastDisturbed();
object oItem = GetInventoryDisturbItem();
if(RetrieveQuestState("q_ezra",oPC) == 10)
{
CopyItem(oItem,OBJECT_SELF);
DestroyObject(oItem);
return;
}
if(iType == INVENTORY_DISTURB_TYPE_REMOVED && GetTag(oItem) == "ezra_book")
{
FloatingTextStringOnCreature("** Your Journal Has Been Updated **", oPC);
AddPersistentJournalQuestEntry("q_ezra",10,oPC,FALSE);
DestroyObject(OBJECT_SELF,5.0);
}
}
... so if theres a better way, one that won't allow exploits, i'd appreciate the help.
thanks.
best way to do this...
Débuté par
zero-feeling
, nov. 10 2010 06:29
#1
Posté 10 novembre 2010 - 06:29
#2
Posté 10 novembre 2010 - 04:20
This may not have the kind of appeal that you would like, but a really easy way would be to have the item automatically put into the PC inventory when the PC touches the chest. Add a little SpeakString or something to notify them that it happens. That way you would only do the test once and nobody has any way of intercepting and grabbing the item. What you lose is that the player doesn't actually look into the chest, take the item and then close the chest.
#3
Posté 10 novembre 2010 - 05:56
The way I do it on my server is I create an invisible object blueprint with the portrait of the container (or you can use SetPortrait). When the PC uses the visible container I spawn the invisible object then have the PC open the invisible object's inventory. This way every PC gets their own personal container.
It's probably the best solution for any multiplayer action. Works good for forges too, the PC opens their own personal forge (invisible object) and places the item to be enhanced inside and no other PCs can come up and steal that item.
-420
It's probably the best solution for any multiplayer action. Works good for forges too, the PC opens their own personal forge (invisible object) and places the item to be enhanced inside and no other PCs can come up and steal that item.
-420
#4
Posté 10 novembre 2010 - 06:15
That's really clever!
#5
Posté 10 novembre 2010 - 07:42
Very clever indeed.
#6
Posté 11 novembre 2010 - 01:19
i like that idea (420).. how would one go about doing that.... a beginning scripter that is?
i can figure out the placeables, how to spawn a new placeable, and other such easy stuff, but the part about opening another objects inventory is whats throwing me off.
thanks
i can figure out the placeables, how to spawn a new placeable, and other such easy stuff, but the part about opening another objects inventory is whats throwing me off.
thanks
#7
Posté 11 novembre 2010 - 06:12
I can post a more detailed description when I have more time if you'd like but the function I think you're looking for is this one:
AssignCommand(oPC, ActionInteractObject(oObject));
-420
AssignCommand(oPC, ActionInteractObject(oObject));
-420
#8
Posté 12 novembre 2010 - 12:25
cool, i'll play with it and see what happens, but yes, i would appreciate something more if you could.
thanks
thanks
#9
Posté 12 novembre 2010 - 06:31
But that invisible object must be useable in order to have inventory, that is item inside. How you make it invisible then? I don't think you can spawn it under player, as player must be able to interact with it. Do you apply some invisibility VFX?420 wrote...
I can post a more detailed description when I have more time if you'd like but the function I think you're looking for is this one:
AssignCommand(oPC, ActionInteractObject(oObject));
-420
#10
Posté 12 novembre 2010 - 05:54
I use the Invisible Object placeable located under Miscellaneous. It's small enough that you can just spawn it in the same location as the visible container without the PC being able to see/select it. I just change the name/description/portrait and check the Useable and Has Inventory boxes.ShaDoOoW wrote...
But that invisible object must be useable in order to have inventory, that is item inside. How you make it invisible then? I don't think you can spawn it under player, as player must be able to interact with it. Do you apply some invisibility VFX?420 wrote...
I can post a more detailed description when I have more time if you'd like but the function I think you're looking for is this one:
AssignCommand(oPC, ActionInteractObject(oObject));
-420
-420
Modifié par 420, 12 novembre 2010 - 05:54 .





Retour en haut







