Printable Version of Topic

Click here to view this topic in its original format

SWR Productions Forum _ Generals/Zerohour Modding _ Prerequisites

Posted by: 3rdShockArmy 6 Jul 2018, 14:53

So, I've been messing around with the code a bit and after doing great for quite some time I hit a wall.

CODE
  Prerequisites
    Object = ChinaWarFactory
    Object = ChinaBreederReactor
    Science = SCIENCE_TacticalNukes SCIENCE_ICBMClearance
  End


I've been trying to give Russia and China the abiity to unlock each other's nukes. So I saw that object Prerequisites works fine when you put them next to each other, but the science just gets ignored. It only counts the first science Prerequisite.

Is there a way around this?

Posted by: RedDeadSmeg 6 Jul 2018, 17:05

QUOTE (3rdShockArmy @ 6 Jul 2018, 14:53) *
So, I've been messing around with the code a bit and after doing great for quite some time I hit a wall.

CODE
  Prerequisites
    Object = ChinaWarFactory
    Object = ChinaBreederReactor
    Science = SCIENCE_TacticalNukes SCIENCE_ICBMClearance
  End


I've been trying to give Russia and China the abiity to unlock each other's nukes. So I saw that object Prerequisites works fine when you put them next to each other, but the science just gets ignored. It only counts the first science Prerequisite.

Is there a way around this?



I haven't tried it myself, but I'm interested to see if this is possible.

I'm guessing the only way this would work is with the 'or' logic, much like how some USA units can be built with either the Detention Centre or Drone Control Centre.
Whether this logic would work with Science I don't know.

If you managed to get it to work with both sciences granted, the next issue you would have is having to create a script where you would grant Russia with 'SCIENCE_TacticalNukes' (as it's a Chinese Science) and grant China 'SCIENCE_ICBMClearance' (as it's a Russian Science) as soon as the match begins. On Single Player missions it's very easy but on Skirmish I don't know how that would work.

I may experiment at some point, but if you have any results please let me know as I'd like to use this logic in a future mission wink.gif

Posted by: 3rdShockArmy 6 Jul 2018, 18:34

I did it already, but it doesn't work.

If I do it with objects it works. You don't need the "or" at all. You just place the objects next to each other:

CODE
  Prerequisites
    Object = ChinaWarFactory ChinaBreederReactor
  End


But if I do it with sciences, the second science gets ignored completely:
CODE
  Prerequisites
    Science = SCIENCE_TacticalNukes SCIENCE_ICBMClearance
  End


This also doesn't work. The second science gets ignored in this case as well:
CODE
  Prerequisites
    Science = SCIENCE_TacticalNukes or SCIENCE_ICBMClearance
  End


The same with this:
CODE
  Prerequisites
    Science = SCIENCE_TacticalNukes or Science = SCIENCE_ICBMClearance
  End


If I do this, the requirement is doubled, meaning I need both SCIENCE_TacticalNukes and SCIENCE_ICBMClearance, rendering the GP purchase useless and permanently blocking it's benefits:
CODE
  Prerequisites
    Science = SCIENCE_TacticalNukes
    Science = SCIENCE_ICBMClearance
  End

Posted by: Zeke 7 Jul 2018, 4:26

"or" simply doesn't work for sciences it seems

perhaps you can just merge the 2 sciences into 1, and just give them different buttons

Posted by: Shiro 7 Jul 2018, 12:50

But then you have the same description on the buttons IIRC.

Posted by: 3rdShockArmy 7 Jul 2018, 18:53

Thanks, Zeke! It's the closest thing to what I wanted, but unfortunately, as Shiro said, the tooltips are inseparable. It shows only one title and the description for both. I tried putting the "displayname" in command_buttons, but it crashes.

Posted by: Zeke 8 Jul 2018, 6:37

You can just create a common name and description for both buttons then, if it doesn't bother you that much

Posted by: 3rdShockArmy 8 Jul 2018, 11:21

I did so. No, it doesn't bother me. In fact, I would have to change the tooltip anyway, because it would benefit both factions.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)