View previous topic :: View next topic |
Author |
Message |
ironhorse
Joined: 02 May 2005 Posts: 13 Location: uk
|
Posted: Wed Nov 03, 2010 2:53 Post subject: Trouble with OnAcquireItem |
|
|
Hi,
I am having a little trouble with the OnAcquireItem. I have done the following script that when a player buys a key off a merchant, that it stores the info I need.
Code: | #include "aps_include"
void main()
{
object oItem = GetModuleItemAcquired();
object oPC = GetModuleItemAcquiredBy();
string sItem = GetTag(oItem);
string sHouseKey = GetStringLeft(sItem, 3);
string sName = GetName (oPC);
if ((sHouseKey) == "KEY")
{
string sHouseName = GetLocalString (oItem, "HOUSE_TAG");
SendMessageToPC(oPC, ""+sHouseName+"");
object oHouseSign = GetObjectByTag(""+sHouseName+"");
SetPersistentString (oHouseSign, "House_Owner", ""+sName+"", 0, "housing"); //Sets the house to the buyer.
SetPersistentInt (oHouseSign, "House_Rent", 500, 0, "housing"); //Sets the rent to make sure the house isnt taken.
}
} |
Now it works fine untill the player logs back in, for some reason it fires off the script in OnAcquireItem. I cannot figure out why it does it.
Can anyone help.
Thanks,
Ironhorse |
|
Back to top |
|
|
axs
Joined: 11 Feb 2005 Posts: 76
|
Posted: Wed Nov 03, 2010 3:01 Post subject: |
|
|
OnClientEnter:
Code: | SetLocalInt(oPC, "LoggedIn", TRUE); |
OnClientLeave:
Code: | SetLocalInt(oPC, "LoggedIn", FALSE); |
OnAcquireItem:
Code: | if(GetLocalInt(oPC, "LoggedIn")) { /*do something*/ } |
This workaround should solve problem. |
|
Back to top |
|
|
Fireboar
Joined: 17 Feb 2008 Posts: 323
|
Posted: Fri Nov 05, 2010 3:09 Post subject: |
|
|
Yes, OnAcquireItem fires every time someone logs in for all of their items. It's usually undesirable behaviour and a poor design decision by Bioware. (Well you've got to balance out all the good ones - like providing a complete toolset - somehow!) |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|