Author Topic: Script: Getting level of a skill? Getting Current value of cargo  (Read 2239 times)

BeLugh

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Is it possible to get the current learned level of a skill with a function? like GetSkillLevel(args.ship_id , haggling) ?
(Instead of asking for effects)

How to request the current value of cargo? cargo_capacity works well, but cargo does not seem to be an effect, so GetCurrentValue GetFinalCacheValue does not work for "cargo", or does it have a different name?

Hammish

  • Sr. Member
  • ****
  • Posts: 350
    • View Profile
Re: Script: Getting level of a skill? Getting Current value of cargo
« Reply #1 on: August 14, 2014, 01:30:39 pm »
I haven't looked at the scripting TOO deeply yet, but from what I remember it might be easier for you to grab effect data as opposed to a skill level data.  That might serve as a stopgap depending on what you need it for, if it's an effect that only has one skill feeding it.

ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1163
    • View Profile
Re: Script: Getting level of a skill? Getting Current value of cargo
« Reply #2 on: August 14, 2014, 08:30:56 pm »
Well, we have methods:

ship.GetSkills(ship_id)
 - returns array, every item of which contains "id" and "level" properties.

ship.GetCargoAmount(ship_id, cargo_type)
 - returns number: amount of specific cargo on ship and (if ship docked) on spacestation cargo storage.

We will add in new game build (today):
ship.GetSkill(int ship_id, string skillId)
- return skill level (0 if ship don't have it).

ship.GetCargoAmount(int ship_id)
- returns total amount of cargo on ship and (if docked) plus amount of cargo on spacestation cargo storage.
« Last Edit: August 14, 2014, 09:45:07 pm by ai_enabled »

BeLugh

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Script: Getting level of a skill? Getting Current value of cargo
« Reply #3 on: August 15, 2014, 10:20:50 am »
ship.GetCargoAmount(int ship_id)
- returns total amount of cargo on ship and (if docked) plus amount of cargo on spacestation cargo storage.

It is the same function as fo rspecific cargo. It always retrieves 0

ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1163
    • View Profile
Re: Script: Getting level of a skill? Getting Current value of cargo
« Reply #4 on: August 16, 2014, 03:16:27 am »
Sorry, I made mistake: new method named "GetTotalCargoAmount", not "GetCargoAmount". As argument it accepts ship_id and returns number. It should work! Also if ship is docked it adds total cargo amount from cargo storage on the space station.
Regards!

BeLugh

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Script: Getting level of a skill? Getting Current value of cargo
« Reply #5 on: August 16, 2014, 01:01:05 pm »
Thanks, it works great now :D