Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Test Subject
Original Poster
#1 Old 18th May 2019 at 4:21 PM
Default Trying to make a mod for perfect gems
Hello there,

I've been working for days to try to make a .package mod that would allow my game to genarate only perfect gems and metals.
I mean that all metals and gems would have its max weight and its max price as described in the official guid for the one in the main game :


I searched the corresponding line in GameplayData.package to edit this with S3PE and it looks like the line is "RockGemMetal".
By editing the XML, I can change thoses values wich seems to be what I want to change:

Example for default Yellow Gem :
<MinWeight>1</MinWeight>
<MaxWeight>105</MaxWeight>
<MinPrice>35</MinPrice>
<MaxPrice>60</MaxPrice>

The logic for me would have been to set the same number in both Min and Max for the 2 fields, so I tried this :

My edit for Yellow Gem :
<MinWeight>105</MinWeight>
<MaxWeight>105</MaxWeight>
<MinPrice>60</MinPrice>
<MaxPrice>60</MaxPrice>

As a result a did get all Yellow gems with a weight of 105 , but with a price of 0$ !!!!
I absolutly don't know where that come from and I've done many try.

Would someone have an idea of how to set all gems of the same name, the same weight and the same price ?
Advertisement
Test Subject
#2 Old 12th Apr 2020 at 8:27 AM
Default hi
Quote: Originally posted by simsgaga3
Hello there,

I've been working for days to try to make a .package mod that would allow my game to genarate only perfect gems and metals.
I mean that all metals and gems would have its max weight and its max price as described in the official guid for the one in the main game :


I searched the corresponding line in GameplayData.package to edit this with S3PE and it looks like the line is "RockGemMetal".
By editing the XML, I can change thoses values wich seems to be what I want to change:

Example for default Yellow Gem :
<MinWeight>1</MinWeight>
<MaxWeight>105</MaxWeight>
<MinPrice>35</MinPrice>
<MaxPrice>60</MaxPrice>

The logic for me would have been to set the same number in both Min and Max for the 2 fields, so I tried this :

My edit for Yellow Gem :
<MinWeight>105</MinWeight>
<MaxWeight>105</MaxWeight>
<MinPrice>60</MinPrice>
<MaxPrice>60</MaxPrice>

As a result a did get all Yellow gems with a weight of 105 , but with a price of 0$ !!!!
I absolutly don't know where that come from and I've done many try.

Would someone have an idea of how to set all gems of the same name, the same weight and the same price ?



If this thread is still valid, can we discuss it with you?
https://blog.naver.com/rka9/221872067777
Virtual gardener
staff: administrator
#3 Old 12th Apr 2020 at 12:52 PM Last edited by Lyralei : 12th Apr 2020 at 12:55 PM. Reason: Editing out the non-US notation of 2k :p
Quote: Originally posted by simsgaga3
Example for default Yellow Gem :
<MinWeight>1</MinWeight>
<MaxWeight>105</MaxWeight>
<MinPrice>35</MinPrice>
<MaxPrice>60</MaxPrice>

My edit for Yellow Gem :
<MinWeight>105</MinWeight>
<MaxWeight>105</MaxWeight>
<MinPrice>60</MinPrice>
<MaxPrice>60</MaxPrice>

As a result a did get all Yellow gems with a weight of 105 , but with a price of 0$ !!!!
I absolutly don't know where that come from and I've done many try.

Would someone have an idea of how to set all gems of the same name, the same weight and the same price ?
Hrm the price here I *think* is due to the way how the costs are handled in the source code:

Code:
// Calculation PriceWeightSlope:
PriceWeightSlope = (float)(MaxPrice - MinPrice) / num;

public override int Cost
    {
        get
        {
            if (mData == null)
            {
                return 0;
            }
            if (mStoredCost == -1)
            {
                mStoredCost = (int)((mWeight - mData.MinWeight) * mData.PriceWeightSlope + (float)mData.MinPrice);
            }
            return mStoredCost;
        }
    }


So in this case, the maths it does is the following (using the original XML stuff you shared in your post as a reference.):
PriceWeightSlope is: 60 - 35 = 25.
(105 - 1) * 25 + 0.60 = 2.600,60. (further up in the code, this value is rounded up, so it's actually 2.600)

Now, your values, the maths would look like this: 

PriceWeightSlope is: 60 - 60 = 0.
(105 - 105) * 0 + 0.60 = 0.60 (Which is rounded up as 0).

Hopefully that solves the mystery behind the 0!
Virtual gardener
staff: administrator
#4 Old 12th Apr 2020 at 2:34 PM
Woops! I didn't see this was a year old. I do think that the maths here at least will hopefully help someone!
Test Subject
#5 Old 12th Apr 2020 at 3:24 PM Last edited by Kamnu : 12th Apr 2020 at 4:09 PM.
Default good job
Quote: Originally posted by Lyralei
Woops! I didn't see this was a year old. I do think that the maths here at least will hopefully help someone!


You are very smart,
I've tried two days to get to know this. The conclusion is the same for me.


The price is divided according to the weight by the difference between the maximum size and the minimum size. If the difference is zero, the price will soon become zero. So the difference between the minimum and the maximum should be very slight. I set the difference to 0.01


And there is something more important than this. Of course, it has nothing to do with this topic. The price per weight is determined when you press 'collect' and is not related to the "transfiguration, transmute, get smelted" of the next step. but I haven't investigated 'get cut' yet. I will finish my research on metals and comment.
Test Subject
#6 Old 12th Apr 2020 at 3:26 PM Last edited by Kamnu : 12th Apr 2020 at 4:00 PM.
Default 11
Quote: Originally posted by simsgaga3
Hello there,

I've been working for days to try to make a .package mod that would allow my game to genarate only perfect gems and metals.
I mean that all metals and gems would have its max weight and its max price as described in the official guid for the one in the main game :


I searched the corresponding line in GameplayData.package to edit this with S3PE and it looks like the line is "RockGemMetal".
By editing the XML, I can change thoses values wich seems to be what I want to change:

Example for default Yellow Gem :
<MinWeight>1</MinWeight>
<MaxWeight>105</MaxWeight>
<MinPrice>35</MinPrice>
<MaxPrice>60</MaxPrice>

The logic for me would have been to set the same number in both Min and Max for the 2 fields, so I tried this :

My edit for Yellow Gem :
<MinWeight>105</MinWeight>
<MaxWeight>105</MaxWeight>
<MinPrice>60</MinPrice>
<MaxPrice>60</MaxPrice>

As a result a did get all Yellow gems with a weight of 105 , but with a price of 0$ !!!!
I absolutly don't know where that come from and I've done many try.

Would someone have an idea of how to set all gems of the same name, the same weight and the same price ?



You can change like this
<MinWeight> 104.99 </ MinWeight>
<MaxWeight> 105 </ MaxWeight>
< MinPrice> 60 </ MinPrice>
<MaxPrice> 60 </ MaxPrice>
Back to top