aliens

Author Topic: Questions on ruleset modification  (Read 6354 times)

Offline clownagent

  • Colonel
  • ****
  • Posts: 380
    • View Profile
Questions on ruleset modification
« on: October 02, 2013, 09:02:26 am »
Maybe somebody can help we with the following questions

1. In the standard ruleset xcom1ruleset there is an entry for the rocket launcher ufopaedia page (line 7907-7910). In line 7920 exactly the same entry is written again. Does such a duplication serve a special purpose or is it just an "accident"?


2. I can define more than 3 compatible ammo types for one weapon. But when I try to open the the Ufopaedia ingame for this weapon it always chrashs. Is there a hard-coded 3-ammotypes limit in openXcom?


3. Usually I first load the standard ruleset and then a smaller ruleset, which modifies or adds content. I expected that all variables, which are not changed by the 2nd ruleset are taken from the standard one, but this is not always the case. For example when I add a ruleset with the following code
Code: [Select]
items:
  - type: STR_PISTOL
    weight: 4
    accuracySnap: 30
    accuracyAimed: 60
    tuSnap: 15
    tuAimed: 30
I can no longer see the shooting-sprites ingame. I also have to add the line "bulletSprite: 1" to get a visible sprite again in the battlescape. Why has the "bulletSprite" variable to be necessarily defined again in the second ruleset, but the other variables not?


4. I also want to remove some stuff of the standard ruleset, but without modifying it directly. Is it possible to remove, for example, a requirement for an ufopaedia entry with an additional ruleset?   

Code: [Select]
  - id: STR_MOTION_SCANNER
    type_id: 4
    section: STR_WEAPONS_AND_EQUIPMENT
    requires:
      - STR_MOTION_SCANNER
    text: STR_MOTION_SCANNER_UFOPEDIA

So for the above code (which is in the Xcom1ruleset) can I type anything in a second ruleset that removes the required research topic for the ufopaedia entry, maybe something like: "requires: - NOTHING"?

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Questions on ruleset modification
« Reply #1 on: October 02, 2013, 12:15:09 pm »
3) I believe that if you define a "STR" in an additional ruleset, it completely overwrites and overrules the previous "STR". so yes, if you re-define the "STR_PISTOL", the older "STR_PISTOL" information is gone. Everything inside needs to be defined again.

4) This is also answered by the above statement... if you want to redefine "STR_MOTION_SCANNER" to be something that does not need the research requirement, you simply add a new "STR_MOTION_SCANNER" into your additional ruleset file where the requirement is simply not defined.


as for 2), I think the UFOpedia screen can only handle 3 ammo types - otherwise it exceeds the screen boundary, and this has simply not been defined... perhaps a scrollbar should be added here? I don't know if that is possible, though.


EDIT: I just checked 1), I think you have found an unnecessary duplicate :P at least I don't know why it would need to be defined twice :)
« Last Edit: October 02, 2013, 12:23:57 pm by moriarty »

Offline clownagent

  • Colonel
  • ****
  • Posts: 380
    • View Profile
Re: Questions on ruleset modification
« Reply #2 on: October 02, 2013, 01:15:24 pm »
3) I believe that if you define a "STR" in an additional ruleset, it completely overwrites and overrules the previous "STR". so yes, if you re-define the "STR_PISTOL", the older "STR_PISTOL" information is gone. Everything inside needs to be defined again.

4) This is also answered by the above statement... if you want to redefine "STR_MOTION_SCANNER" to be something that does not need the research requirement, you simply add a new "STR_MOTION_SCANNER" into your additional ruleset file where the requirement is simply not defined.


In my experience, sadly, it does not work like this.
3) in the above code I do not redefine costSell, costBuy, compatibleAmmo etc. for the pistol in the second ruleset. Then this information is taken automatically from the standard ruleset (loaded first), except for the bulletSprite variable, which I MUST redefine in the second ruleset.

4) So when I define a new "STR_MOTION_SCANNER" in the second ruleset without the requirement, the program will still take the requirement from the first ruleset. At least, that is what happened when I tried it. 

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Questions on ruleset modification
« Reply #3 on: October 02, 2013, 06:28:54 pm »
Just to avoid confusion, moriarty you're wrong, and clownagent is right on what the expected behavior should be. ;)

Maybe somebody can help we with the following questions

1. In the standard ruleset xcom1ruleset there is an entry for the rocket launcher ufopaedia page (line 7907-7910). In line 7920 exactly the same entry is written again. Does such a duplication serve a special purpose or is it just an "accident"?
Looks like an accident. Nicely spotted.

2. I can define more than 3 compatible ammo types for one weapon. But when I try to open the the Ufopaedia ingame for this weapon it always chrashs. Is there a hard-coded 3-ammotypes limit in openXcom?
You can have as many ammotypes as you want, but naturally the Ufopaedia can only show 3. I can fix the crash but I can't make the screen bigger. :P

3. Usually I first load the standard ruleset and then a smaller ruleset, which modifies or adds content. I expected that all variables, which are not changed by the 2nd ruleset are taken from the standard one, but this is not always the case. For example when I add a ruleset with the following code
Code: [Select]
items:
  - type: STR_PISTOL
    weight: 4
    accuracySnap: 30
    accuracyAimed: 60
    tuSnap: 15
    tuAimed: 30
I can no longer see the shooting-sprites ingame. I also have to add the line "bulletSprite: 1" to get a visible sprite again in the battlescape. Why has the "bulletSprite" variable to be necessarily defined again in the second ruleset, but the other variables not?
This shouldn't happen, I'll investigate, it's probably a bug in the ruleset loading.

4. I also want to remove some stuff of the standard ruleset, but without modifying it directly. Is it possible to remove, for example, a requirement for an ufopaedia entry with an additional ruleset?   

Code: [Select]
  - id: STR_MOTION_SCANNER
    type_id: 4
    section: STR_WEAPONS_AND_EQUIPMENT
    requires:
      - STR_MOTION_SCANNER
    text: STR_MOTION_SCANNER_UFOPEDIA

So for the above code (which is in the Xcom1ruleset) can I type anything in a second ruleset that removes the required research topic for the ufopaedia entry, maybe something like: "requires: - NOTHING"?
Any property you specify will override the original property. In your case you can just use an empty list: "requires: []", which is interpreted as no requirements.

Currently there is no support for removing an entire entry from the original, though you can work around it by just making something impossible to unlock. I might add the feature properly, but you'd have to be careful to remove everything associated to that entry too.

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Questions on ruleset modification
« Reply #4 on: October 03, 2013, 12:13:54 am »
oh, thank you SupSuper for clearing that up... I was a bit confused about the behavior, it seems :)

soo, empty requirements are specified by "[]"? interesting. that's not on the ruleset page, maybe we should add it... oh wait, I'll just do it myself, it's a wiki after all...

done: https://www.ufopaedia.org/index.php?title=Rulesets_(OpenXcom)#Modular_Rulesets

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Questions on ruleset modification
« Reply #5 on: October 03, 2013, 05:07:05 am »
Well it's an YAML thing, [] is an empty list, applies to any list. Don't know if there's any other syntax for it.

Offline clownagent

  • Colonel
  • ****
  • Posts: 380
    • View Profile
Re: Questions on ruleset modification
« Reply #6 on: October 03, 2013, 05:51:53 am »
Thanks for the answers, that make things clearer for me.  :D