Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ninekorn

Pages: [1] 2 3 4
1
Bug reports / Re: Too many Heap sections crash!
« on: December 28, 2017, 02:03:06 am »
Yeah you're right! Well that's gonna give me time to work on my other mods! So it's perfectly fine. I don't think the market mod would work with the vanilla steam server so i'll just wait for the patch release to release my stuff.

2
Bug reports / Re: Too many Heap sections crash!
« on: December 27, 2017, 07:12:00 am »
Nevermind AI I thought it was my market mod that had caused the crash and I posted in the wrong section of the forum my reply (in the help section).

I mean I did make a mistake causing server lag because of my arrays but the "Too many heap section" crash occured also this morning even with my market array fixed... So its probably/certainly due to what you described. Except from that... I am very happy to say that my market mod is nearing release. Both Buying and Selling sections are working, now I just have to fix some text issues.

nine

3
Hi,

I have tested again this crash and found out the problem was on my market mod. I had put in the function SetResourceBasePrice that when the price was NOT defined to ALSO put the cargo items in the global arrays... So at every station shop updates in the game all the items were added again and again and again... After a couple hours there must have been thousands and more in that global array and everytime that I added something I also fetched the array to put items into it and then set back the array in the global array.... Even after 5minutes with the game running the game was skipping frames like crazy... So that's my bad. sorry

nine

4
Bug reports / Too many Heap sections crash!
« on: December 26, 2017, 06:42:18 am »
Hi guys, I have no clue what happened as I left my private server and game opened for the night. When I woke up this morning I had a Void Expanse crash. I wonder if it's due to my market mod? It worries me a bit since I have cleaned the 17 scripts that make the buy section of the market mod and got rid of every uneeded functions and variables and arrays and also I've removed all hiddenInStationNPCs from the game to just spawn a series of 15 of them in the starting station to test the market mod. The market mod was running fast but it seems that there is something that lags the server periodically... I have no clue if it's my market mod. I have put a sharable link of my google drive for the too many heap sections crash report. When you guys have the time to look at it.

Thank you!
nine

https://drive.google.com/file/d/1TpPtSUbVqBcpWf1A_Gw1Gg8KEIrr69zq/view?usp=sharing

5
Ok Yeah I just tested the  SetResourceBasePrice method at Station.js and this function runs once at the start of the server it seems so the prices are set once by that function. I work tomorrow so I gotta go sleep but Ill think about how I can use that function if I can. I was thinking of making a global array and put all those prices in it and see where that leads me. Anyway talk to you later and thank you for the help!

nine

6
Yes AI I debugged those CalculateBuyPriceOfCargo and CalculateSellPriceOfCargo cargo_price and I can totally confirm that something is done with the default price internally and then BAM it is modified and cargo_price doesnt show the default price... its already modified upon arrival inside the station.js functions CalculateBuyPriceOfCargo and CalculateSellPriceOfCargo. I'll try to find another workaround. Don't worry about it. Work on Cryofall ;)

edit: in fact i removed everything in the CalculateBuyPriceOfCargo and CalculateSellPriceOfCargo and just returned the cargo_price and it still shows the modified price and not the default price...

7
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.

8
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

9
Thank you so much! with this the drones will have a couple usefull functions Under their belt!

Im working on also fixing some stuff in the Galaxy Market Mod but for some reasons I can't find where the threading bug occurs. At least I seem to have fixed the quantities a player can buy and correct amount is transfered. I still need to test more though.

I also have a lag issue of 1-2 seconds when I first spawn my Drones. Im wondering if its just me using something i shouldnt in the code. I will investigate that.

I will check how to send a Google drive link tonight and ill then be able to send you the market mods consisting of 3 scripts for you guys at Atomic Torch to check it out before I release. I wont release it on steam workshop this week though.

10
yes exactly!

11
Hi,

So im working on drone commands "utilities" like "go pickup containers that are near". But theres one big issue. Ive tried to find a function in the Scripting API that gives me access to all the objects tags in the system or all the objects in the system or all objects in scope but theres nothing like that in the Scripting API. So i've decided to search with Notepad++ all the scripts for any functions that started with "generator." and found generator.AreThereAnyObjects(sys_idNPC, direction.x, direction.y, 25, { except_ships: true}); and that turns out to give Boolean true or false. I thought at first it could be meaningless since i dont need booleans but more the ID of the Objects... So I went ahead and found out I just could do this function. It pretty much does the same as the original function but instead i limit the range to 1 unit and just use a ForLoop with 15 radius in +x -x +y -y to get me the exact position where there are objects. I thought that would solve my problem... Lol the thing is generator.AreThereAnyObjects() doesnt take into consideration containers... so im stuck.  It does give me the position of any other objects though except containers + even IF i had the containers position there doesnt seem to be a function that gives me the gameObjectID at coordx-coordy. so Id still be stuck. I can't get the containerID without the ObjectID and i cant get the ObjectID without a function to help me find those IDs. If generator.AreThereAnyObjects() would also consider containers and also returning the ID of the object it finds then bam we would have a function that does exactly ship.ScopeObjects that isnt in the Scripting API. helllpppp.

Code: [Select]
function goPickContainers()
{

var player_id = npc.GetTag(SHIP_ID, "ownerPlayerShipId");

var sys_idNPC = npc.GetCurrentSystemID(SHIP_ID);

var direction = ship.GetCoordinates(SHIP_ID);

for (var x = 0; x < 15; x++)
{
for (var y = 0; y < 15; y++)
{
var objectsID0 = generator.AreThereAnyObjects(sys_idNPC, direction.x+x, direction.y+y, 1, { except_ships: true});
var objectsID1 = generator.AreThereAnyObjects(sys_idNPC, direction.x-x, direction.y+y, 1, { except_ships: true});
var objectsID2 = generator.AreThereAnyObjects(sys_idNPC, direction.x+x, direction.y-y, 1, { except_ships: true});
var objectsID3 = generator.AreThereAnyObjects(sys_idNPC, direction.x-x, direction.y-y, 1, { except_ships: true});

if (objectsID0 == true)
{
npc.FaceCoord(SHIP_ID,direction.x+x,direction.y+y);
}
if (objectsID1 == true )
{
npc.FaceCoord(SHIP_ID,direction.x-x,direction.y+y);
}
if ( objectsID2 == true )
{
npc.FaceCoord(SHIP_ID,direction.x+x,direction.y-y);
}
if (objectsID3 == true)
{
npc.FaceCoord(SHIP_ID,direction.x-x,direction.y-y);
}
}
}
}




12
Help section / Trying to set a global variable without using(storage);
« on: August 02, 2017, 09:12:47 pm »
Hi,

Ive got this question about creating a global variable in VoidExpanse javascript. Again, its something super easy in Unity3d but im not sure i get it in VoidExpanse. For example i created this script called globalArrays.js to store global variables.

Code: [Select]
var globalSwitchForMining = false;


var globalArrays =
{
miningSwitch: function (args)
    {
globalSwitchForMining = args;
console.Print(globalSwitchForMining + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    },

isMiningSwitchOn: function ()
    {
console.Print(globalSwitchForMining + "?????????????????????????????????????????????????????????");
return globalSwitchForMining;
    },
};


Then from another script I use this:
Code: [Select]
globalArrays.miningSwitch(true);

if (globalArrays.isMiningSwitchOn() == true)
{
  console.Print("YOU TURNED THE SWITCH ON");
}
else
{
console.Print(" THE SWITCH IS STILL OFF");
}

And in my last script to verify the global Variable i just use:
Code: [Select]
if (globalArrays.isMiningSwitchOn() == false)
{
console.Print("isMiningSwitchOn == false");
}


if (globalArrays.isMiningSwitchOn() == true)
{
console.Print(" WHERE AM I STUCK");
goMineSomeAsteroids();
canFollowPlayer = false;
}

and bam. Houston we've got a problem. the global variable is always false from the third script. If i cant create my own global variables then ill go back to use the using(storage) to set global variables.

13
Help section / Re: How to use ship.SetEquipmentCacheValue?
« on: August 01, 2017, 11:31:55 pm »
Ok thanks for the answer. But how would I go about calling the function with "args" for example i need to include IMCache.js and CalculateShip.js. Then I call calculateShip.CalculateNpcLev eledCache(SHIP_ID?) with the ship ID as args?

14
Help section / How to use ship.SetEquipmentCacheValue?
« on: August 01, 2017, 08:15:16 pm »
Hi,
This question is for my follower/drone mod. I want to be able to modify their damage output. If I add    IMCache.AddValue("projectile_damage_energy_weap ons_instancepercent", 1000); in the calculateShip.js script my follower/drones do a lot of damage. The thing is this parameter wasnt there to start off. I added it just to try it and it works. Now i'm wondering if i can have access to that parameter through another script with ship.SetEquipmentCacheValue?. I might be going the wrong way with this but also wanted to know: is there a list of parameters that we can assign to IMCache for weapons/items and can we have that list? This parameter "projectile_damage_energy_weap ons_instancepercent" is something i found in the skills in the .XML files. With this type of parameters I have a couple ideas on how to fake Equipment changes to my follower/drone mod.

Thank you for answering.
nine

Edit: Is there also in the Scripting API a way to "ship.getequipment" for the NPCs? and like "ship.setequipment". Im asking coz it would be way easier than having to generate thousands of XML files with my xml file generator program I created especially if NPCS are generated and geared with different weapons when they have more than 1 weapon slots. I would have 10 times more drones xml files than weapons xml files.

15
Mods / Re: Upcoming unlimited weapons mod and also a Galaxy Market.
« on: July 31, 2017, 09:37:54 pm »
Showcasing the market mod. Please Watch the video to see the market features! And leave your comments here or there!

https://www.youtube.com/watch?v=Hp6zYf-7AzM

Pages: [1] 2 3 4