Recent Posts

Pages: 1 [2] 3 4 ... 10
11
Help section / Re: Difficulties setting the price of Items/cargo for my market mod!
« Last post by ai_enabled on December 25, 2017, 01:25:43 am »
I verified the C# code and can definitely say that it calling Station.js file, methods CalculateBuyPriceOfCargo and CalculateSellPriceOfCargo, to calculate the prices. Have you tried to add the console logging to these two methods?
The game calculates the prices for a player during docking, when the items are added/removed from the shop items list (such as during stock items regeneration) and when a player tries to buy/sell to calculate the current price.

"args.cargo_price" is the price of cargo/resource from the XML file.
It seems there is no API for getting the price by cargo/resource XML ID so you're stuck with this for now, alas.
12
Help section / Re: Difficulties setting the price of Items/cargo for my market mod!
« Last post by ninekorn on December 25, 2017, 01:08:23 am »
Yeah AI,

It's pretty much only the cargo_price that I needed. I debugged that price in the console inside the station.js script and its beeing calculated internally with c# script I believe because NO javascripts are making the call to the station.js so it must come from internal c# calculations. Even worse is that it's already calculated the moment that it enters the function of the station.js and then some more modifiers are calculated inside that station.js script. I was thinking of a workaround, like when accessing a station from the market script that it would regenerate/update the stations stock and debug me something from the station.js file but the thing is my market mod is not updating the whole station itself and it seems that even the update on the stations stock is beeing called internally because when I enter a station or click on the shop UI button once inside a station i can see messages in the console like "regenerated stock items for station blablabla" and that debug is not called from any js script so even that debug is beeing called internally in c#. I'm gonna have to think of something else.
13
Help section / Re: Difficulties setting the price of Items/cargo for my market mod!
« Last post by ai_enabled on December 24, 2017, 10:09:21 pm »
Hi,

The price is adjusted for every player as you think. It's not clear from the scripting as this code is called from C#.
Here are methods which we're calling:
Station.js - CalculateBuyPriceOfItemModifi er and CalculateSellPriceOfItemModif ier - for calculation of item price.
Station.js - CalculateBuyPriceOfCargo and CalculateSellPriceOfCargo - for calculation of cargo price.

Unfortunately, these methods require quite a complex argument structure. For items:
Code: [Select]
int base_id;
int faction_relation; // this is a pre-calculated relation between the player's ship and the station faction
int item_id;
int ship_id;

For cargo it's more complicated:
Code: [Select]

[code]
string base_faction; // station faction ID
int base_id; // station ID
string cargo_id; // XML ID of the cargo
double cargo_price; // base price of cargo (from XML, I'm very unsure if this can be get from scripting API now - we might need an update to the game server for this API)
int faction_relation; // relation between the player's ship and the station faction
string ship_faction; // player ship faction ID
int ship_id; // player ship
int status; // cargo status

Alas, it's really complicated. Maybe a better approach would be to implement new scripting API methods accepting ship ID, station ID and item ID or cargo XML ID and returning the calculated price (by reusing the C# code).

Regards!
14
Help section / Difficulties setting the price of Items/cargo for my market mod!
« Last post by ninekorn on December 24, 2017, 12:48:15 pm »
Hey,

So I have been working on my market mod for Void Expanse and the good news is I was able to fix the HUGE hang / lag when accessing the market. So right now there is no lag or anything and that is due to how I rewrote the script. Basically, instead of having the whole 2500 lines of code in the same script, I was able to cut out every pieces of it to make 17 different scripts for every different market sections and different weapon types. Every time a step is taken for instance choosing the system to access the market than BAM a new dialogue opens with a hiddenInStationNPC that basically starts from where the other NPC left off right at choosing the stations for the system that was chosen with the first NPC.... So what I have created is a chain of NPCs that just do EXACTLY what the first script did but because there were so much variables and topics in the first 2500 lines script it was hanging the whole server. With this new system it fixes this... But there are issues... Right now spawning 15 NPC hiddenInStation doesnt seem to cause a lag issue with Void Expanse even IF I spawn them in every stations of the whole server. In the future I might reduce the number to 1 market terminal in each station and just 1 station contains the other HiddenInStationNPCs. We will see. But right now I am unable to fix the right prices for the items for the sell or buying functions. I have found pieces of code in the Trading.js and also the Stations.js but it doesn't seem to work properly because I am not getting the right prices unless I am not using them correctly? Here are the functions that I have tried:

Code: [Select]
function CalculateBuyPriceOfCargo(args)
{
var min = 1;
var max = 1.05;
var trade_margin = -ship.GetFinalCacheValue(args, "trade_margin");

var stationInfo = station.GetBaseByID(systemBases);
var fact = relations.GetFactionDispositionToShip(stationInfo.faction, args);
var relation_coef = 0.2 * GetFactionRelationCoef(fact);

var coef = min - (trade_margin + relation_coef) * 0.05;
coef = Clamp(min, coef, max);
return coef;
}


function CalculateBuyPriceOfItemModifier(args) {
var min = 1;
var max = 1.25;
var trade_margin = -ship.GetFinalCacheValue(args, "trade_margin");
var stationInfo = station.GetBaseByID(systemBases);

var fact = relations.GetFactionDispositionToShip(stationInfo.faction, args);
var relation_coef = 0.1 * GetFactionRelationCoef(fact);
var coef = max - trade_margin - relation_coef;
coef = Clamp(min, coef, max);
return coef;
}



function CalculateSellPriceOfItemModifier(args, min, max)
{
var min = 0.4;
var max = 0.9;
var stationInfo = station.GetBaseByID(systemBases);
var fact = relations.GetFactionDispositionToShip(stationInfo.faction, args);

var trade_margin = -ship.GetFinalCacheValue(args, "trade_margin");

var relation_coef = 0.2 * GetFactionRelationCoef(fact);
var coef = min + trade_margin + relation_coef;
coef = Clamp(min, coef, max);
return coef;
}

function GetFactionRelationCoef(relation) {
relation = Clamp(-150.0, relation, 150.0);
return relation / 150.0;
}


function Clamp(min, current, max) {
if (current < min) {
return min;
}
if (current > max) {
return max;
}
return current;
}

I thought that the CalculateBuyPriceOfCargo function was going to work but it doesn't really give me the right price of the cargo. The thing is for all of those function I am just sending the player Ship Id for the "args".

Before the function was

Code: [Select]
var relation_coef = 0.1 * GetFactionRelationCoef(args.faction_relation);

and I replaced it with the following code because the args which was only the player ship ID didn't contain the faction_relation stuff... So I went in the Scripting API Wiki page and found the relations.getfactionDispositi ontoShip but it doesn't give the right price:

Code: [Select]
var stationInfo = station.GetBaseByID(systemBases);
var fact = relations.GetFactionDispositionToShip(stationInfo.faction, args);
var relation_coef = 0.1 * GetFactionRelationCoef(fact);

Do you guys have any ideas how I could go and fetch the real prices of the items/cargo that show on the market page? And that would be with buying and selling stuff. I know you guys must be busy with Cryofall but if you've got a couple minutes to look into this i'd really appreciate it. If I can I will try to release this mod before new years day!

Oh and just trying to fetch the price with:
Code: [Select]
var price = generator.GetItemPrice(item.xml_id);
doesn't really give the price that the market shows... It seems to be the default price before all other modifiers are applied for instance the player level and player relation to faction of the station and whatnot!

Thank you!
nine
15
Development discussion / Re: CryoFall - new screenshots & news
« Last post by Lurler on December 21, 2017, 02:48:23 am »
16
Servers / Re: [EU][kG]kunix.org -PVE- / community server
« Last post by kyokei on December 05, 2017, 11:22:16 pm »
Link to savegame:

https://cloud.ion-box.org/s/2nPpoQRtXKZOsfT

pw: $ve$h1

You have until 31st of Dec to fetch it :)

And you are most welcome
17
Game discussion / Re: Future development of VoidExpanse
« Last post by AmadoHar on December 04, 2017, 08:20:17 am »
Yes, it is possible. But it has to be prepared to the exactly same level of quality and standards used in the base game.
I haven't yet looked at your mods, but when you are done - if everything is good and up to standard I will be more than happy to include it in the base game :)

Great to see you're open to including mods into the base game like that, Lurler. Way to go!
18
Servers / Re: [EU][kG]kunix.org -PVE- / community server
« Last post by p0ki on December 03, 2017, 06:57:47 am »
I'm ready to decommission the server totally, is there anyone who would still want the savegame?
Hi Kyokei,
thanks from my side as well for hosting this server for what feels like an eternety.
Can you still provide the savegame on a dropbox link or something like that?
19
Servers / Re: [EU][kG]kunix.org -PVE- / community server
« Last post by kyokei on November 07, 2017, 06:07:44 am »
I'm ready to decommission the server totally, is there anyone who would still want the savegame?
20
Modding info / Re: Problem with script
« Last post by ai_enabled on October 29, 2017, 10:09:01 pm »
@Teerawut, ok, post it here and we will try to help!
Pages: 1 [2] 3 4 ... 10