Deinon
  • Deinon
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago
All I want is to make a supply center in a certain part of the map construct more gatherers if the area containing both it and the supply dock it collects from doesn't contain any gatherers. I've tried using the CommandButton in scripting, but while it does show the briefing string I included as a test, it doesn't build a new supply truck when that particular script is run.

This supply center is isolated from the rest of the enemy base (it's at the shipyards with a few guard towers for protection), so I don't want the enemy base to just pump out another gatherer from its own supply center.
Sponsor
AdrianeMapMaker
8 years ago
One question is this a mission map?
A part of ZH worldbuilders map making community
https://discord.gg/tJ6zyGb 

UserPostedImage




Deinon
  • Deinon
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago

One question is this a mission map?

Originally Posted by: adrianemapmaker 



Generals' Challenge
acidbrain
8 years ago
What about this...
Lets say that the player is USA and the AI is China.
There is an area called 'Supply Area' with a USA SupplyCenter named 'SupplyCenter' and a supplydock in it.

Here are some scripts...

// Method 1_Use an object list
// Scripts location: 
//  -Player/Area/Player has (comparison) unit type in an area.
//  -Unit/CommandButton/Use commandbutton ability.

[ns A D][E N H]Build Supply Gatherer in area
*** IF ***
     Player 'China' has Less Than or Equal  0  unit or structure of type 'Supply Gatherers' in the  area 'Supply Area'
*** THEN ***
   Unit 'SupplyCenter' use Ability 'Command_ConstructAmericaVehicleChinook'.

// Object list
// Script location: 
//  -Scripting/ObjectTypeList/Add Object Type

[ns A D][E N H]Object List_Supply Gatherers
*** IF ***
    True.
*** THEN ***
   'Supply Gatherers' : add 'AmericaVehicleChinook'
   'Supply Gatherers' : add 'ChinaVehicleSupplyTruck'

// Method 2_Use a kindof
// Script location:
//  -Player/Owns/Player has (comparison) kind of unit or structure in an area.
//  -Unit/CommandButton/Use commandbutton ability.

*** IF ***
     Player 'China' has Less Than or Equal  0  unit or structure with Kind is 'HARVESTER' in the  area 'Supply Area'
*** THEN ***
   Unit 'SupplyCenter' use Ability 'Command_ConstructAmericaVehicleChinook'.

Cheers
Panem et kirkinses
Deinon
  • Deinon
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago

What about this...
Lets say that the player is USA and the AI is China.
There is an area called 'Supply Area' with a USA SupplyCenter named 'SupplyCenter' and a supplydock in it.

Here are some scripts...


// Method 1_Use an object list
// Scripts location: 
//  -Player/Area/Player has (comparison) unit type in an area.
//  -Unit/CommandButton/Use commandbutton ability.

[ns A D][E N H]Build Supply Gatherer in area
*** IF ***
     Player 'China' has Less Than or Equal  0  unit or structure of type 'Supply Gatherers' in the  area 'Supply Area'
*** THEN ***
   Unit 'SupplyCenter' use Ability 'Command_ConstructAmericaVehicleChinook'.

// Object list
// Script location: 
//  -Scripting/ObjectTypeList/Add Object Type

[ns A D][E N H]Object List_Supply Gatherers
*** IF ***
    True.
*** THEN ***
   'Supply Gatherers' : add 'AmericaVehicleChinook'
   'Supply Gatherers' : add 'ChinaVehicleSupplyTruck'

// Method 2_Use a kindof
// Script location:
//  -Player/Owns/Player has (comparison) kind of unit or structure in an area.
//  -Unit/CommandButton/Use commandbutton ability.

*** IF ***
     Player 'China' has Less Than or Equal  0  unit or structure with Kind is 'HARVESTER' in the  area 'Supply Area'
*** THEN ***
   Unit 'SupplyCenter' use Ability 'Command_ConstructAmericaVehicleChinook'.

Cheers

Originally Posted by: acidbrain 



That was the method I had attempted. The problem I'm encountering is that the command:

Unit 'SupplyCenter' use Ability 'Command_ConstructAmericaVehicleChinook'.

...isn't doing anything. I know the code is being executed because I have a military briefing string being triggered at the same time.
SkyMix_RMT
8 years ago

All I want is to make a supply center in a certain part of the map construct more gatherers if the area containing both it and the supply dock it collects from doesn't contain any gatherers. I've tried using the CommandButton in scripting, but while it does show the briefing string I included as a test, it doesn't build a new supply truck when that particular script is run.

Originally Posted by: Deinon 



This problably happens because of an invisible character that is in front of the commandbutton name, check this post I did a few weeks ago when a guy asked how to remove a commandbutton, it should work for you but instead of removing you make the AI use it.


Script:
Scripting > Remove a command button from an object type.

Script should look like:
True.
*** THEN ***
[???] Command button: 'Command_UpgradeGLAScorpionRocket' is removed from all objects of type 'GLAArmsDealer'.

!IMPORTANT!
After selecting the command button you want to remove, YOU MUST delete an invisible character that's at the end of the command button. To verify that this character is removed, please check if the world builder recognizes the command button.
UserPostedImage
If it recognizes the command button exists, then the character is still there, select the end of the text and press backspace.

This is how it should look like after you deleted the invisible character:
UserPostedImage

Originally Posted by: SkyMix_RMT 



After you do this the script should work normally and the AI will use the commandbutton.
Check out:
My Music  (Techno/House/Experimental)
My Website  (GeneralsCentral)
My Youtube Channel  (Inactive)
World Builder Community Discord 
Deinon
  • Deinon
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago
Doesn't look like there's a spacing issue. I've tried doing this with multiple structures now - airfield, supply depot, it looks like CommandButton simply can't be used to make a structure build a unit. It can be used to build upgrades, but it won't put anything in a build queue and construct it. Either there's a step missing here or it's disabled by design. Hope there's some other way of doing this, otherwise I'm not sure how to get an AI team to replace destroyed supply gatherers - I don't see anything in the teams so far for other Generals Challenges for resource gatherers.

EDIT:

Never mind, I found the problem. I needed to run the script "Player 'player' is able to build units"
Unknown Editor
8 years ago
Thanks , I've forgotten this too 😁
Asking is Not a Problem , Problem is Not to Know Something .
Operation : Dark Angel
Static : Launch Delayed
Reason : Uncool Terrain - Old Logic in use - Lack of Performance
Status : Applying new Terrain - Applying new Logic - Increasing Performance by 300%
acidbrain
8 years ago
Lol, had this too in the past and thats why it is the second sriptfolder i make when i start a new map...
1st_Vision, unshroud the map for the player
2nd_Enable build, able to build buildings and units

Cheers
Panem et kirkinses
Unknown Editor
8 years ago
Mine :
1st = unshroud the whole map (Just the Intro Parts if there are many particles in the whole map)
2nd = Intro
3rd = Others
4th = Anything instead of Build Availability
5th = Wondering why Structures won't Build Units ?
Asking is Not a Problem , Problem is Not to Know Something .
Operation : Dark Angel
Static : Launch Delayed
Reason : Uncool Terrain - Old Logic in use - Lack of Performance
Status : Applying new Terrain - Applying new Logic - Increasing Performance by 300%
AdrianeMapMaker
8 years ago
Unknown editor ... we have the same step
A part of ZH worldbuilders map making community
https://discord.gg/tJ6zyGb 

UserPostedImage