This site is in archival mode. A replacement is being developed. In the meantime, please use the PBW2 Forums for community discussions. The replacement software for this site will use a unified account system with PBW2, and any newly created threads will carry over.
Posted: Tue May 19, 2015 11:58 am Post subject: get_empire_specific_facility_count
Hi, I'm trying to mod facilities that there can only be one of in an empire. It's pretty easy to add impossible requirements, but the modding guide lists a way to do it properly - which has the added advantage of letting a player move the facility, or replace a destroyed one. I'm trying to use get_empire_specific_facility_count, but it doesn't seem to work...
here's the facilities.txt
Name := Homeworld Research Center
Description := High-Tech researching facility that develops new technology for a society.
Facility Group := Research
XFile Class Name := Central Computer Complex
Picture Number := 24
Maximum Level := 11
Tonnage Space Taken Formula := 1000
Tonnage Structure Formula := 10000
Cost Minerals Formula := 15000 + (([%Level%] - 1) * 1500)
Cost Organics Formula := 2500 + (([%Level%] - 1) * 250)
Cost Radioactives Formula := 2500 + (([%Level%] - 1) * 250)
Number Of Requirements := 3
Requirements Evaluation Availability := AND
Requirements Evaluation Allows Placement := TRUE
Requirements Evaluation Allows Usage := TRUE
Requirement 1 Description := Empire must have at least tech level 1 in Applied Research.
Requirement 1 Formula := Get_Empire_Tech_Level("Applied Research") >= [%Level%]
Requirement 2 Description := Empire must not have any Homeworld Research Centers.
Requirement 2 Formula := Get_Empire_Specific_Facility_Count("Homeworld Research Center") <= 0
Requirement 3 Description := Empire must not be constructing any Homeworld Research Centers.
Requirement 3 Formula := Get_Empire_Queues_Specific_Facility_Count("Homeworld Research Center") <= 0
Number of Abilities := 2
Ability 1 Type := Point Generation - Research
Ability 1 Description := Research Centers generate [%Amount1%] research points per turn.
Ability 1 Scope := Space Object
Ability 1 Range Formula := 0
Ability 1 Amount 1 Formula := (iif(Empire_Is_Human_Controlled([%PlayerNumber%]), 1, 1) * (10000 + ((Get_Empire_Tech_Level("Applied Research") - 1) * 2000)) / (Get_Empire_Specific_Facility_Count("Homeworld Research Center")))
Ability 1 Amount 2 Formula := 0
Ability 2 Type := Description Only
Ability 2 Description := Additional Homeworld Research Centers in your empire cause production to decrease proportionately.
Ability 2 Scope := Space Object
Ability 2 Range Formula := 0
Ability 2 Amount 1 Formula := 0
Ability 2 Amount 2 Formula := 0
Am I doing something wrong, or is the function broken? Person(s) denying the existence of killer robots may be killer robots themselves. Back to top
The function does work. This is how I made a one per empire facility in Skymod:
Requirement 3 Description := There is a limit of one Capitol per empire.
Requirement 3 Formula := (Get_Empire_Specific_Facility_Count("Capitol") = 0) and (Get_Empire_Queues_Specific_Facility_Count("Capitol") = 0) and ([%NumQueueItemsAdding%] = 1)
Your formula does stop more than one facility being placed, but if i scrap the facility it can't be re-placed. Also, if i take out everything but get_empire_specific_facility_count, then it doesnt appear to apply any restrictions whatsoever.
Does this match your experience? I feel like i'm messing something up.
Note, I'm modding on top of BM 1.20 Person(s) denying the existence of killer robots may be killer robots themselves. Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All logos and trademarks used on this site, all comments and stories posted for reading, all files hosted for download, and all art work hosted for viewing are property of their respective owners; all the rest copyright 2003-2010 Nolan Kelly.
Syndicate news: - Syndicate forums:
Page Generation: 0.44 Seconds