NO GOLD NAME,TAG,RES
#1
Posté 14 mars 2011 - 11:41
{
object oPC = GetModuleItemAcquiredBy();
object oItem = GetModuleItemAcquired();
//DEBUG INFO
string sItemN = GetName(oItem);
string sItemT = GetTag(GetModuleItemAcquired());
string sItemR = GetResRef(oItem);
FloatingTextStringOnCreature(" you found NAME:..."+sItemN+"...",oPC,FALSE);
FloatingTextStringOnCreature(" you found TAG:..."+sItemT+"...",oPC,FALSE);
FloatingTextStringOnCreature(" you found RESREF..."+sItemR+"...",oPC,FALSE);
int iPC_Gold=GetGold(oPC);
if( ! GetIsPC(oPC) ){return;}
if(GetIsObjectValid(oItem)==FALSE){return;}
if(GetIsObjectValid(oItem)==TRUE)
{
//::----------------------------------------------------------------------------
//::---------------------------[ aquire gold ]----------------------------------
//::----------------------------------------------------------------------------
}
}
When I run this script it will not give me any info on the gold no name no tag no res ref, did I use the wrong function to get item aquired? not sure why this is happening. could some one tell me im scratchn my head at it.
this is a script ran in the module event item aquired script
Thanks all Greyfort
#2
Posté 14 mars 2011 - 11:51
-420
#3
Posté 15 mars 2011 - 12:09
EDIT: You will also get an invalid item from your check.
Modifié par Lightfoot8, 15 mars 2011 - 12:11 .
#4
Posté 15 mars 2011 - 12:15
yes but you will get valid GetModuleItemAcquiredStackSize(), soLightfoot8 wrote...
No, You did not do anything wrong. The problem is that gold in HardCoded. It is an item when it is on the ground or in a containers inventory. But as soon as you pick it up the Gold Item is destroyed before the module event fires. By the time the module Event fires the gold has been added to the players amount of gold. This is nothing more then a number on the creatures object structure. The gold item is gone, Therefore you get no name/tag/resref.
EDIT: You will also get an invalid item from your check.
if(GetModuleItemAcquired() == OBJECT_INVALID && GetModuleItemAcquiredStackSize() > 0)
then you catched gold
Modifié par ShaDoOoW, 15 mars 2011 - 12:16 .
#5
Posté 15 mars 2011 - 12:39
ShaDoOoW wrote...
yes but you will get valid GetModuleItemAcquiredStackSize(), so
if(GetModuleItemAcquired() == OBJECT_INVALID && GetModuleItemAcquiredStackSize() > 0)
then you catched gold
That is good to know, I did not know that one.
#6
Posté 15 mars 2011 - 12:41
-420
#7
Posté 15 mars 2011 - 01:00
#8
Posté 15 mars 2011 - 01:26
What are you tring to do?
EDIT: I would also guess that gold is only going to fire the onAcquire event when you get it by picking up an item. and not every time it is created on the player. I have not tested it so I my be wrong.
Modifié par Lightfoot8, 15 mars 2011 - 01:28 .
#9
Posté 15 mars 2011 - 01:47
so far No fire with other items, it works only when I pick up gold piece and it fires because the object item is invalid and stack size function:
if(GetModuleItemAcquired() == OBJECT_INVALID && GetModuleItemAcquiredStackSize() > 0)
{
//::----------------------------------------------------------------------------
//::---------------------------[ aquire gold ]----------------------------------
//::----------------------------------------------------------------------------
}
works firing my aquire gold script.
I thought about a simalr approuch for unaquire gold but I need a var that keeps track of players gold and any change of it.
ie: if( curnt_gold_amount < db_Gold amount ){ runs unaquire gold script}
I thought about doing this on heart beat but that could get laggy
Note: the shadow function will only fire on aquire. not just any change in your gold. ie if you drop etc.
Hence the need for a script on heart beat to check pc gold for loss
Modifié par Greyfort, 15 mars 2011 - 01:49 .
#10
Posté 15 mars 2011 - 02:00
its reliable, there may be cases in which the acquired object is not valid, but there is only one case where the acquired object is invalid. Its not the same.Greyfort wrote...
I dont know if it will fire with other stacked items, I think not because they often are valid Objects.
so far No fire with other items, it works only when I pick up gold piece and it fires because the object item is invalid and stack size function:
if(GetModuleItemAcquired() == OBJECT_INVALID && GetModuleItemAcquiredStackSize() > 0)
{
//::----------------------------------------------------------------------------
//::---------------------------[ aquire gold ]----------------------------------
//::----------------------------------------------------------------------------
}
works firing my aquire gold script.
I thought about a simalr approuch for unaquire gold but I need a var that keeps track of players gold and any change of it.
ie: if( curnt_gold_amount < db_Gold amount ){ runs unaquire gold script}
I thought about doing this on heart beat but that could get laggy
Unacquire do not fire however, so if you want to control the gold somehow, you must make a serious workaround.
Just an idea:
1) some pursue for gold, able to store gold with variable, using unique power for convo which will have the ability to put the gold into players inventory again (and when you use it you know how much).
2) when gold is acquired via OnAcquire, take this gold from creature and then store it into pursue.
3) all gold reewards through scripting should save the gold into pursue directly (it would work probably cos still firing OnAcquire, but would be better)
Or no convo but setting OnChat listenning immediately.:innocent:
Modifié par ShaDoOoW, 15 mars 2011 - 02:01 .
#11
Posté 15 mars 2011 - 02:16
I also do not know if gold traded between PC's will fire the event or not.
I do not really see any way to track gold lost outside of a HB. At that point you need to start asking if what you are tring to do is worth it.
If it is not critical when and where they gained/lost it. I would think about just adding it to all the OnEnter/LeaveArea events.
#12
Posté 15 mars 2011 - 03:52
Other wise it creates the effect of gold being heavy and wieghting your char down.
#13
Posté 14 avril 2011 - 07:39





Retour en haut






