Author Topic: Several problems occured during modding  (Read 3099 times)

BeLugh

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Several problems occured during modding
« on: August 07, 2014, 05:58:43 am »
Hi :) I would really like to go on modding, but every step i want to change somethign i cant go on as i am missing information, a script which is not modable etc. etc.
I hope you guys can help out somehow

My two main problems right now:
1. i am trying to figure out how to receive the hullid of a ship. so i can ask it in the minign function to check it against the laser, if it is ok to use it in that size of the ship. maybe i need to add this later
2. I have changed all the ores, so Glepsite does not exist anymore, but i can't access the tutorial quest. What i can change is the text of the starting quest which tells you to go to one eyed joe, but i neither cant change the text, nor i cant change any event, check, requirement etc. I have searched through all the scripts. Right now people would not be able to mine glepsite, which means they are stuck in the spawn system

Now the other ones i found:
-this isnt a bug but something went bad in functions. Asteroid data lets you edit the scale, but the scale, orientation etc is totally overwritten by the script. All asteroids have a scale of 0.8 up to 1.6 and ResQ does not seem to have a working function as how it seems. I tried making it random ang giving ResQ the same double as scale, but resources are set independent of ResQ
-to fix it being able to mine asteroids while cargo is full i would like to check if the cargo is full or check cargo max against cargo. Right now after mining when no item is added it is assumed that the cargo is full
-for multipalyer games i would like to remove depleted asteroids and create new ones, but i have no idea how to remove an instance as it is does not happen in any script. I already found checking multiplayer and creation of asteroids

Thats all i found so far ;)
I would be very glad if one of you guys can help out.

-changing the scale of asteroids after mining resoruces would be great, so it would visually show the remaining content inside the asteroid

Lurler

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1174
    • View Profile
Re: Several problems occured during modding
« Reply #1 on: August 07, 2014, 06:56:49 am »
If you want to change the quest you need to edit the topic script. It is in the topics folder. You can change all contents there.

As for other things you mentioned - it is unfortunately still somewhat a mess since it is work in progress :) We will get to it eventually, as well as create a much more detailed tutorials on our wiki with all required information for modding.

BeLugh

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Several problems occured during modding
« Reply #2 on: August 07, 2014, 11:22:49 am »
Ok :) I will try whatever i can do to make it work somehow :) Or just make some temporary workarounds like requiring lvl instead of hull type :)
About the topics, i didnt know scripts can also be outside the scripts folder :D

Lurler

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1174
    • View Profile
Re: Several problems occured during modding
« Reply #3 on: August 07, 2014, 08:08:33 pm »
Well, all dialogues with NPC _are_ scripts. That's the only way to make it really free from any constraints. It allows to make pretty much anything this way.

BeLugh

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Several problems occured during modding
« Reply #4 on: August 08, 2014, 07:12:17 am »
When items are disabled in their xml they cause the store function in stations to crash. Also when you set the consumption of an item to 0.00 it crashes the shop as well (maybe it is divided by this number? i didnt check it)
« Last Edit: August 08, 2014, 02:05:23 pm by BeLugh »

Hammish

  • Sr. Member
  • ****
  • Posts: 350
    • View Profile
Re: Several problems occured during modding
« Reply #5 on: August 09, 2014, 03:10:04 am »
I think I mentioned in another thread, if you want to make it so that certain items (like a mining laser) only work on a specific hull or size of hull, you could try this:

Add a new attribute type for a qualification.  Let's call it good_mining_lasers.  You can find the list of qualifications in the Effects folder.  To the best of my knowledge, after the 0.9 updates, any effect you want to use on equipment needs to be in there.

Now you need to add that attribute to any ships you want to be able to equip the item (like good mining ships).  In the .xml for the ship, look under effects; in there you can theoretically add any value that is spelled out in the Effects lists.  So you'd want to add good_mining_lasers as an effect, and set the value to 1.

Last, you need the check on the new mining tool.  That should be as simple as loading up the .xml file for it, going to requirements, and requiring the tool to have good_mining_lasers at level 1.  It's one of the things that I love about the new system; item checks are now based on effects instead of skills, giving you a LOT more flexibility.

The only limitation that I am aware of is that someone could theoretically equip a ship eligible to use the better tool, equip then, then equip a different hull... but if I remember correctly when you swap hulls all current equipment is ejected off to make sure things like this don't happen.  The other thing I'm not sure on is if ship effects update dynamically; if someone equips a ship to give them good_mining_lasers=1, I'm not sure if removing it would revert good_mining_lasers back to zero.  To be on the safe side, you could always add in a tag so that any hull that should NOT have one of your new toys set good_mining_lasers=0.

BeLugh

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Several problems occured during modding
« Reply #6 on: August 10, 2014, 11:33:53 am »
I already got that part. But now i am stuck with using effects in triggers.
I have added "energy_consumption_mining" and tried to fix "mining_experience",
but when i read those values from cache, no matter if i take GetFinalCacheValue or GetCurrentValue, both values are always 0, so i cant use them in my functions. I tried so many possibilites but i have no idea how to use it now....
Using effects in requirements is no problem at all, but when it comes in using them i am totally stuck.

BeLugh

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Several problems occured during modding
« Reply #7 on: August 12, 2014, 11:45:19 am »
When i was doign a research which effects are also needed in scripts for calculations i got to collisiondamage on target effect... we have a skill ramming which increases collision damage on target and reduces on self.... as minign experience and my effect are like this one i thoguht i would get help in the collision script....
Until i ahd to find out that:

   if(args.object_type_1 == "ship" && args.object_type_2 == "ship")
   {
      var damage_structure = (!ship1_npc || !ship2_npc) ? 300 : 0;
      var damage_shield = (!ship1_npc || !ship2_npc) ? 300 : 100;
      var ship1 = args.object_id_1;
      var ship2 = args.object_id_2;
      var ship_1_was_alive = ship.GetCurrentValue(ship1, "structure") > 0;
      var ship_2_was_alive = ship.GetCurrentValue(ship2, "structure") > 0;
      OnShipHitSomething(ship2, damage_shield, damage_structure, args);
      OnShipHitSomething(ship1, damage_shield, damage_structure, args);

all values are fixed and ignore the ramming skill -> no help for my getcurrentvalue problem :/