Aller au contenu

Photo

NO GOLD NAME,TAG,RES


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

#1
Greyfort

Greyfort
  • Members
  • 234 messages
voidmain()
{
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
420

420
  • Members
  • 190 messages
Worked fine for me once I put a space between void and main(). (Otherwise it doesn't even compile.)

-420

#3
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
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.

Modifié par Lightfoot8, 15 mars 2011 - 12:11 .


#4
Shadooow

Shadooow
  • Members
  • 4 471 messages

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

yes but you will get valid GetModuleItemAcquiredStackSize(), so

if(GetModuleItemAcquired() == OBJECT_INVALID && GetModuleItemAcquiredStackSize() > 0)

then you catched gold

Modifié par ShaDoOoW, 15 mars 2011 - 12:16 .


#5
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

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. Image IPB

#6
420

420
  • Members
  • 190 messages
Whoops, I should have read more closely. Very interesting information about the "gold" item.

-420

#7
Greyfort

Greyfort
  • Members
  • 234 messages
ok... 1 I tried what you said shadow and it worked to aquire gold Thanks, but now issue with unaquir Gold any Ideas there?

#8
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
There you may have a problem. Gold does not fire the event when you drop it.

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
Greyfort

Greyfort
  • Members
  • 234 messages
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

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
Shadooow

Shadooow
  • Members
  • 4 471 messages

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

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.

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
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
There are other problems with tring to track all gold gained via OnAquire. The conversation is easie to get around. Like shadoOow stated you just add it to you scripts to modify what you need in the script. But you will also have to script something for gold aquired from shops. When the PC sells something to a shop he it will not fire the OnAquire Event, simply because an item never exsisted to aquire. all that happens is that the players gold gets updated. To compound the problem with shops, if the shop has the item sold as unlimited Get Item Lost will return an invalid item. But if he Unaquires an item to a shop at least you know that the gold amount changed.


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
Greyfort

Greyfort
  • Members
  • 234 messages
yeah i like your idea Light foot. What I did was make A item that when player uses.. it adjust and acuratly creating the effect I wanted. It was for gold encumbrance problem solved. I will post a link to the vault ware all others can use it. The only down side but not to bad really is if you loose gold you have to rem to use the item so you wont be encumbered ie:[ if you have alot of gold and then none ]
Other wise it creates the effect of gold being heavy and wieghting your char down.

#13
Greyfort

Greyfort
  • Members
  • 234 messages
I was hoping if anyone can think of anything else that might unaquire or aquire gold. This would help me to finalize script.