Difference between revisions of "Talk:OnAttachedToCell - ObjectReference"
Jump to navigation
Jump to search
imported>HawkFest m |
imported>HawkFest |
||
Line 33: | Line 33: | ||
EndEvent | EndEvent | ||
</source> | </source> | ||
::CheckGold function is called from OnDetachedFromCell and OnCellDetach events. When those events happen is a total mystery to me. However, a look at what CheckGold function does unveils a little clue : Balimund's TrainerType property is initialised to 2, which means that he'll end-up with maximum 800 gold when one of those two events happen. If he has less then he'll end up with the same amount. Personally I can't go further down the logic, since in my game I haven't seen this happen : either there's a 2 days merchant reset taking place, which does not leave the merchant with a lesser amount than the "default" one, either we can trade with whatever amount has been traded up until now, which does not remove any gold above some default value as is the case here via MaxGold function variable (set by the TrainerType property). A mystery... Could this be related to training? | ::CheckGold function is called from OnDetachedFromCell and OnCellDetach events. When those events happen is a total mystery to me. However, a look at what CheckGold function does unveils a little clue : Balimund's TrainerType property is initialised to 2, which means that he'll end-up with maximum 800 gold when one of those two events happen. If he has less then he'll end up with the same amount. Personally I can't go further down the logic, since in my game I haven't seen this happen : either there's a 2 days merchant reset taking place, which does not leave the merchant with a lesser amount than the "default" one, either we can trade with whatever amount has been traded up until now, which does not remove any gold above some default value as is the case here via MaxGold function variable (set by the TrainerType property). A mystery... Could this be related to training? Or do some specific NPC as Balimund have their gold amount processed this way, in which case it could be related to going out - coming back into the cell or some "attachment" an actor could have with the cell? | ||
::--[[User:HawkFest|HawkFest]] ([[User talk:HawkFest|talk]]) 21:49, 14 December 2012 (EST) | ::--[[User:HawkFest|HawkFest]] ([[User talk:HawkFest|talk]]) 21:49, 14 December 2012 (EST) |
Revision as of 21:58, 14 December 2012
It would be appreciated if this page would go over what "attached" and "unattached" mean as it relates to ObjectReferences, as I have no idea and I can't find information elsewhere. -- Chesko
- I second the above. This page needs to be more informative. Antares (talk) 10:21, 6 October 2012 (EDT)
- There's an example with Balimund who's a trainer and a merchant. The following script is attached to him:
Scriptname TrainerGoldScript extends Actor
int Property TrainerType Auto
miscobject Property gold001 Auto
Function CheckGold()
int MaxGold
if TrainerType==1
MaxGold=500
elseif TrainerType==2
MaxGold=800
elseif TrainerType==3
MaxGold=1500
else
MaxGold=500
endif
int GoldCount=GetItemCount(Gold001)
if GoldCount > MaxGold
RemoveItem(Gold001, (GoldCount-MaxGold))
endif
EndFunction
Event OnDetachedFromCell()
CheckGold()
EndEvent
Event OnCellDetach()
CheckGold()
EndEvent
- CheckGold function is called from OnDetachedFromCell and OnCellDetach events. When those events happen is a total mystery to me. However, a look at what CheckGold function does unveils a little clue : Balimund's TrainerType property is initialised to 2, which means that he'll end-up with maximum 800 gold when one of those two events happen. If he has less then he'll end up with the same amount. Personally I can't go further down the logic, since in my game I haven't seen this happen : either there's a 2 days merchant reset taking place, which does not leave the merchant with a lesser amount than the "default" one, either we can trade with whatever amount has been traded up until now, which does not remove any gold above some default value as is the case here via MaxGold function variable (set by the TrainerType property). A mystery... Could this be related to training? Or do some specific NPC as Balimund have their gold amount processed this way, in which case it could be related to going out - coming back into the cell or some "attachment" an actor could have with the cell?
- --HawkFest (talk) 21:49, 14 December 2012 (EST)