Posted by: Turret Wars Line - Sunday, August 16, 2009 4:38:46 AM
Hi, I'm trying to figure out how to add command buttons to units and buildings, for example like a booby trap button to the GLA unit Tunnel Defender, mainly I want to do these changes, like so: USA Barracks -Advanced Training upgrade in 9th slot -Chemical Suit upgrade in 10th slot USA Supply Center -Supply Lines upgrade in 5th slot USA Command Center -Intelligence upgrade in 9th slot I use the script: "Add command button to an object type" but in the map, nothing changes. Suggestions? Any answers would be well appreciated PS: This is my first real step in Scripting in World Builder

Posted by: Annihilationzh - Sunday, August 16, 2009 4:50:26 AM
Booby trap & Intelligence require more than just a button to work. It would require a map.ini or a game mod. Adding upgrades to most buildings is possible though. The ability to add command buttons has a bug. All entries in the drop down have an additional character (invisible in some PCs, a square in others) on the end that shouldn't be there. Remove this character & the code will work.

Posted by: Turret Wars Line - Sunday, August 16, 2009 4:54:42 AM
So you mean it requires an INI file in the map? right?

Posted by: Annihilationzh - Sunday, August 16, 2009 5:05:06 AM
Yes, but you won't be able to play it online if you do that.

Posted by: Art_in_MT - Monday, August 24, 2009 12:53:06 PM
My son and I have been struggling with this all day. We have an example map (City in Terror) that adds a command button (boobytrap) but we cannot find any script that adds the command, and there is no additional ini file. We tried adding another command button using the "delete last character" trick, but had no success. I suspect we are missing the obvious here. For the benefit of a couple "noobs" could you explicitly define how a command button is added to a unit? We would GREATLY appreciate it! (We've read the tutorials, and searched the boards, but haven't found much discussion of this, so I'm betting we are missing something REALLY self evident....) Thanks for any help you can give.

Posted by: Annihilationzh - Monday, August 24, 2009 1:52:00 PM
[quote]We have an example map (City in Terror) that adds a command button (boobytrap) but we cannot find any script that adds the command, and there is no additional ini file.[/quote] That's a little odd, because booby trap requires a special ability to activate, the button won't do it by itself. To explain, the button doesn't even know that it's supposed to create a booby trap. It's the rebel that gives that data. Which unit is the booby trap added to, and are you positive that there isn't a map.ini file in with the other map files? [quote]I suspect we are missing the obvious here. For the benefit of a couple "noobs" could you explicitly define how a command button is added to a unit?[/quote] I'll have to use an example. [code]*** IF *** True. *** THEN *** Command button: 'AirF_Command_ConstructAmericaVehicleChinook' is added to all objects of type 'ChinaSupplyCenter' in slot number 3 (1-12). 'AirF_AmericaVehicleChinook' becomes Buildable (Ignore_Prerequisites)[/code] This script in the [b]Civilian[/b] folder will add the combat chinook to the China supply center.

Posted by: Art_in_MT - Thursday, August 27, 2009 4:43:27 AM
Annihilationzh: THANK YOU for the reply! You got us "un-stuck!" We've been working with the info you provided and are now starting to understand a little better how this all works. Putting the script in the CIVILIAN folder was a key piece we were missing for several pieces we were trying to do. I can't say we understand the logic behind it being in the CIVILIAN folder, it works! The map we referred to (City in Terror) didn't require an INI file because it turned on an ability that the unit already had - hence no need for the INI. Your detailed script examples and the explanation was perfect! Thanks again! PS - is there an easy way to dump the full tree of possible script selections to a file for searching? We are never sure where to look, and being able to "grep" it would be really useful.

Posted by: Annihilationzh - Thursday, August 27, 2009 5:36:21 AM
I don't think there is a list of all possible scripts - I had to learn the hard way. If you get really stuck on something specific, we're here to help.

Posted by: Aafat - Thursday, January 14, 2010 1:28:23 AM
[b]Annihilationzh[/b] I used your example but nothing happened, the command button didn't appeared in the desired factions. Is there any other possibility except editing the ini files? *** IF *** True. *** THEN *** Command button: 'Command_ConstructChinaVehicleSupplyTruck ' is added to all objects of type 'Lazr_AmericaSupplyCenter' in slot number 2 (1-12). Command button: 'Command_UpgradeAmericaMOAB ' is added to all objects of type 'Lazr_AmericaPowerPlant' in slot number 2 (1-12). Command button: 'Command_UpgradeGLAArmTheMob ' is added to all objects of type 'Lazr_AmericaPowerPlant' in slot number 2 (1-12).

Posted by: Annihilationzh - Thursday, January 14, 2010 6:46:34 AM
Have you deleted the invisible character? See post #2, the second half. Have you put it in the civilian folder? Is your script active, deactivate upon sucess and not subroutine? (If you haven't changed these, ignore this question) Also, make sure you don't put them in the same place on the same building.

Posted by: Aafat - Wednesday, January 27, 2010 12:34:41 PM
If your talking about the Scripting/Add a command button to an object type drop down list so I didn't saw any square character in it I've checked it from up to down but if it's invisible how would I locate & delete it?

Posted by: Annihilationzh - Wednesday, January 27, 2010 12:41:49 PM
Put your cursor at the end of the word and press backspace twice. Then replace any letters that you deleted.

Posted by: Aafat - Wednesday, January 27, 2010 12:50:08 PM
Sorry [sad] again but could you please help me with a screen shot?

Posted by: Annihilationzh - Wednesday, January 27, 2010 1:40:10 PM
Not really, a screenshot looks no different from posting the code. This is what it should look like: [???] Command button: 'Command_ConstructChinaVehicleSupplyTruck' is added to all objects of type 'Lazr_AmericaSupplyCenter' in slot number 2 (1-12). [???] Command button: 'Command_UpgradeAmericaMOAB' is added to all objects of type 'Lazr_AmericaPowerPlant' in slot number 2 (1-12). [???] Command button: 'Command_UpgradeGLAArmTheMob' is added to all objects of type 'Lazr_AmericaPowerPlant' in slot number 3 (1-12). NOT this: Command button: 'Command_ConstructChinaVehicleSupplyTruck ' is added to all objects of type 'Lazr_AmericaSupplyCenter' in slot number 2 (1-12). Command button: 'Command_UpgradeAmericaMOAB ' is added to all objects of type 'Lazr_AmericaPowerPlant' in slot number 2 (1-12). Command button: 'Command_UpgradeGLAArmTheMob ' is added to all objects of type 'Lazr_AmericaPowerPlant' in slot number 3 (1-12).

Posted by: Aafat - Wednesday, January 27, 2010 3:24:44 PM
Well I did what you said & the button also appeared but that was unbuildable, I want a Troop Crawler in Laser General's Warfactory. This is the command I used [b][???] Command button: 'Infa_Command_ConstructChinaVehicleTroopCrawler' is added to all objects of type 'Lazr_AmericaWarFactory' in slot number 2 (1-12)[/b]

Posted by: Annihilationzh - Wednesday, January 27, 2010 3:28:00 PM
Map>Modify>Adjust the tech tree for a specific object type 'Infa_ChinaVehicleTroopCrawler' becomes Buildable (Ignore_Prerequisites) I mentioned this script in post #6.

Posted by: Aafat - Wednesday, January 27, 2010 5:57:16 PM
Thanx [b]Annihilationzh[/b] [+1] WoW! That really works for me now

Posted by: Galacticruler - Thursday, August 5, 2010 9:39:41 AM
can someone help me add the nuke generals nuke silo to the boss general dozer and removing the original? also adding the nuke gens migs and removing the normal migs from the boss gens airfield,removing raptors and stealth fighters from sw gen,adding the crusader and paladin to sw gen war factory and lastly,removing the original power plant adding the nuke gens power plant to the boss gen dozer?,im trying to make a map and cant get this to work.

Posted by: Annihilationzh - Thursday, August 5, 2010 1:20:18 PM
Upload your map and we'll take a look at it.

Posted by: Galacticruler - Friday, August 6, 2010 5:34:47 PM
here it is [ATTACH]671[/Attach]

Posted by: Annihilationzh - Saturday, August 7, 2010 4:13:19 AM
You haven't removed the invisible character. Please read through this thread. Plus, this is redundant: [code] Command button: 'Boss_Command_ConstructAmericaPowerPlant' is removed from all objects of type 'Boss_VehicleDozer'. Command button: 'Nuke_Command_ConstructChinaPowerPlant' is added to all objects of type 'Boss_VehicleDozer' in slot number 1 (1-12).[/code] The second line will automatically remove the first. You will also need to do as post #16 says for several buildings.