- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Elixir Consignment Register for Basegame
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Elixir Consignment Register for Basegame
Replies: 16 (Who?), Viewed: 1245 times.
#1
1st Jul 2015 at 8:22 AM
Posts: 35
Elixir Consignment Register for Basegame
I extract the elixir shop from EP7 Supernatural for Basegame. It almost done. I can consign items from inventory. But the shop just sell Potions, nothing else.How can I make it sells items which defines from Register XML. I modify it as below but none show up in shopping list
Thanks for help.
Advertisement
Field Researcher
#2
1st Jul 2015 at 9:52 AM
Posts: 338
Thanks: 28681 in 186 Posts
According to the code the PotionShopConsignment data in the Register XML is read into the game ONLY if you have a Supernatural installed and is completely ignored if you don't.
#3
1st Jul 2015 at 2:07 PM
Posts: 35
Quote: Originally posted by icarus_allsorts
According to the code the PotionShopConsignment data in the Register XML is read into the game ONLY if you have a Supernatural installed and is completely ignored if you don't. |
I don't know how data is read into the game.
why it still ignore the XML tag
<ProductVersion>BaseGame</ProductVersion>
<RequiredProductVersion>BaseGame</RequiredProductVersion>
Field Researcher
#4
1st Jul 2015 at 3:59 PM
Posts: 338
Thanks: 28681 in 186 Posts
It's just how the developers coded the game, if you don't have Supernatural installed, the game code is written such that anything in between any of the <PotionShopConsignment> and </PotionShopConsignment> in that XML is automatically skipped no matter what is written there. You'd need a script mod to manually load that data into the game without Supernatural installed.
#5
2nd Jul 2015 at 2:51 AM
Posts: 35
Quote: Originally posted by icarus_allsorts
It's just how the developers coded the game, if you don't have Supernatural installed, the game code is written such that anything in between any of the <PotionShopConsignment> and </PotionShopConsignment> in that XML is automatically skipped no matter what is written there. You'd need a script mod to manually load that data into the game without Supernatural installed. |
Is that the code that read PotionShopConsignmentRegisterData?
I don't know C# but as far as my PHP knowledge, that if function will let read <RequiredProductVersion>.
Please correct me if I'm wrong.
Field Researcher
#6
2nd Jul 2015 at 7:21 AM
Posts: 338
Thanks: 28681 in 186 Posts
You're right that that is the code that reads the data labelled as PotionShopConsignment in the Register XML. The problem is where this code is called to run which can be seen in the ShoppingRegister class:
So the ParseData in your screenshot is only run if EP7, i.e. Supernatural is installed.
Code:
// Sims3.Gameplay.Objects.Register.ShoppingRegister public static void ParseData() { XmlDbData xmlDbData = XmlDbData.ReadData("Register"); ... if (GameUtils.IsInstalled(ProductVersion.EP7) && xmlDbData.Tables.TryGetValue("PotionShopConsignment", out xmlDbTable)) { PotionShopConsignmentRegister.ParseData(xmlDbTable); <- If the underlined code above is not true, this line of code is not run } ... }
So the ParseData in your screenshot is only run if EP7, i.e. Supernatural is installed.
#7
2nd Jul 2015 at 1:21 PM
Posts: 35
thanks for your help.
#8
4th Jul 2015 at 9:06 AM
Posts: 35
for testing purpose, I rewrite the code but it doesn't read data from Register XML
so. where does developers get data from?
Code:
// Sims3.Gameplay.Objects.Register.MyShoppingRegister public static void ParseData() { XmlDbData data = XmlDbData.ReadData("Register"); if (data != null) { Dictionary<string, XmlDbTable> tables = data.Tables; } XmlDbTable table = null; data.Tables.TryGetValue("PotionShopConsignment", out table); MyPotionShopConsignmentRegister.ParseData(table); }
Code:
// Sims3.Gameplay.Objects.Register.MyPotionShopConsignmentRegister public static void ParseData(XmlDbTable shopListData) { foreach (XmlDbRow row in shopListData.Rows) { sData.Add(new PotionShopRegisterData(row)); } InitializeData(); }
so. where does developers get data from?
Field Researcher
#9
4th Jul 2015 at 12:13 PM
Posts: 338
Thanks: 28681 in 186 Posts
The data has to be added to "PotionShopConsignmentRegister.sData" at the start of the game (it's not obvious from what you've written what your "sData" refers to).
#10
4th Jul 2015 at 12:35 PM
Posts: 35
Quote: Originally posted by icarus_allsorts
The data has to be added to "PotionShopConsignmentRegister.sData" at the start of the game (it's not obvious from what you've written what your "sData" refers to). |
sData prefer to variable of my class PotionShopConsignmentRegister
private static List<PotionShopRegisterData> sData = new List<PotionShopRegisterData>();
still inside a scope of class so I don't need to write it down. but for sure, i prefer to classname => still not work
thank you for your help
by the way, how do i debug C# code from Visual Studio? it's hard time to code then run game to test :-(
Field Researcher
#11
4th Jul 2015 at 1:30 PM
Posts: 338
Thanks: 28681 in 186 Posts
That's the thing, you're adding the data to your own variable in your own class, but the game only reads the sData static variable from the original PotionShopConsignmentRegister class so just add the data there.
#12
4th Jul 2015 at 1:55 PM
Last edited by tenmang : 4th Jul 2015 at 2:08 PM.
Posts: 35
Quote: Originally posted by icarus_allsorts
That's the thing, you're adding the data to your own variable in your own class, but the game only reads the sData static variable from the original PotionShopConsignmentRegister class so just add the data there. |
ah i just rewrite the 2 new class that doesn't relate to original PotionShopConsignmentRegister or ShoppingRegister. Then edit OBJK to my script.
so i dont understand why the game only reads sData from the original class?
thank you for taking your time to help me out.
Field Researcher
#13
4th Jul 2015 at 5:26 PM
Posts: 338
Thanks: 28681 in 186 Posts
When you're buying from the potion register like in your screenshot, the game reads PotionShopConsignmentRegister.sData for the information of what to display. Whatever you're doing has not changed this behavior in any way. Instead of going through the trouble of changing this to try and get it to read your sData, it's simply more straightforward to add the information you want to PotionShopConsignmentRegister.sData directly. i.e.
and assuming you get the game to run your script correctly, that should be enough.
Code:
// Sims3.Gameplay.Objects.Register.MyPotionShopConsignmentRegister public static void ParseData(XmlDbTable shopListData) { foreach (XmlDbRow row in shopListData.Rows) { PotionShopConsignmentRegister.sData.Add(new PotionShopRegisterData(row)); } PotionShopConsignmentRegister.InitializeData(); }
and assuming you get the game to run your script correctly, that should be enough.
#14
5th Jul 2015 at 3:12 AM
Last edited by tenmang : 5th Jul 2015 at 3:43 AM.
Posts: 35
Quote: Originally posted by icarus_allsorts
When you're buying from the potion register like in your screenshot, the game reads PotionShopConsignmentRegister.sData for the information of what to display. Whatever you're doing has not changed this behavior in any way. Instead of going through the trouble of changing this to try and get it to read your sData, it's simply more straightforward to add the information you want to PotionShopConsignmentRegister.sData directly. i.e. and assuming you get the game to run your script correctly, that should be enough. |
ah thanks for this idea. but it's cruel that sData is a
Code:
private static List<PotionShopConsignmentRegisterData> sData;
of PotionShopConsignmentRegister. is there any way to use it in my class?
Field Researcher
#15
5th Jul 2015 at 6:47 AM
Posts: 338
Thanks: 28681 in 186 Posts
Did you unprotect the game dlls for your project? http://www.simlogical.com/ContentUp...e/uploads/1689/
That would make sData a public static variable instead of a private one so that you can have access to it from your class.
That would make sData a public static variable instead of a private one so that you can have access to it from your class.
#16
5th Jul 2015 at 8:24 AM
Posts: 35
Quote: Originally posted by icarus_allsorts
Did you unprotect the game dlls for your project? http://www.simlogical.com/ContentUp...e/uploads/1689/ That would make sData a public static variable instead of a private one so that you can have access to it from your class. |
great !!!
but when i drop game dlls into it says
Quote:
Could not find ildasm installation. Press the 'ANY' key to continue... |
i use VS C# 2008 portable version so it doesn't come with sdk / ildasm install
would you please upload the unprotected of those dlls, if it isn't illegal here :=D
#17
16th Jul 2015 at 9:47 PM
Posts: 997
Thanks: 22099 in 95 Posts
Can I suggest to override the OnStartup method of your class and add there
(in a block of code executed only the very first time and not each time OnStartup
is called, aka every time you select the object from the catalog - but might not be
limited to that case) a call to the parsing method using as parameter your custom
"shopping list" xml resource.
Also remember that those kind of registers can only sell items with a NGMP entry
that maps the (FNV64 hash of the) name you put in the xml for the object to the
InstanceId of its OBJD.
Take a look at my Ice Cream Stand if you need a reference. GL with your project.
(in a block of code executed only the very first time and not each time OnStartup
is called, aka every time you select the object from the catalog - but might not be
limited to that case) a call to the parsing method using as parameter your custom
"shopping list" xml resource.
Also remember that those kind of registers can only sell items with a NGMP entry
that maps the (FNV64 hash of the) name you put in the xml for the object to the
InstanceId of its OBJD.
Take a look at my Ice Cream Stand if you need a reference. GL with your project.
Who Posted
|