waiehustag
  • waiehustag
  • 58.25% (Neutral)
  • Private Topic Starter
15 years ago
I'm new to creating maps. I kind of picked it up as hobby for now. One thing I have been having a very hard time figuring out is how to assign buildings or units to players on a skirmish map! For example, let's say you are Player 1 and you are at a random player start location. There are units or buildings (objects?) in the area which are already built or present and I want them to be under the control of whichever player was in that area. Not necessarily in that area in particular. I guess the best example I can compare my problem to is the campaign missions. In some campaign missions there are already bases built for you to use and under the player's(gamer's/user's) control from the start. In others you are just given a worker or dozer where you have to build the bast from the ground up. I want my skirmish maps to have bases already built for the players who play on this map. PLEASE HELP IF POSSIBLE!!!!!😒
Sponsor
Drummin
15 years ago
This can be done for MultiPlayer only maps, no problem but you've got your work cut out for you. Keep in mind that AI players will sell all buildings besides defensive structures and power, which is why I said this will work for MultiPlayer maps. Might I suggest you go with spawning the buildings instead of using placed buildings so the player will have buildings of the same faction type. This will also add Much more work but If you go this route, just place waypoints where you would spawn each building and rename them something that's clear like "Position1Barracks1", Position1WarFactory1" etc where "Position1" are buildings in "StartPosition1's" base. Use room scripting to identify players . So after you've got your map setup with waypoints or buildings placed and labeled if still using that option, then start scripting in the PlyrCivilian folder.

As the tutorial points out, the players are identified as 'player0' through 'player7'.
Here's a sample of doing both the faction check and start position.
*** IF ***
    [???] Player 'player0' starting position is  1  .
    *AND* [???] Player 'player0' is Faction Name: America
*** THEN ***
  [???]Spawn Unit 'P1Barrack1' of type 'AmericaBarracks' on Team 'teamPlyrCivilian' at waypoint Waypoint 'Position1Barrack1'
  [???] Unit 'P1Barrack1' is transferred to the command of Player 'player0'
Once you have one complete script done, copy it and edit for position 2, then again for other positions in the game. I would create these scripts in a folder identified as "Player0 buildings" or something like that. Once a complete set is done for player0 (Which is you by the way) you should be able to test the map and buildings will be spawned and transferred to you whatever start position you play at.

If you are just using placed buildings then just use the start position check.
*** IF ***
    [???] Player 'player0' starting position is  1  .
*** THEN ***
  [???] Unit 'P1Barrack1' is transferred to the command of Player 'player0'
EXPORT This Folder to a location you can find it, then Import it back in, editing all script lines for 'player1'. Repeat for all possible players in the game, 'player0' through 'player7'.

NOTE: It would be a good idea to deactivate all other scripts for this player once the condition has been met on one of them. So each script would deactivate the others. For example:
Disable Script 'Position2USAPlyr0'.
  Disable Script 'Position3USAPlyr0'.
  Disable Script 'Position4USAPlyr0'.

waiehustag
  • waiehustag
  • 58.25% (Neutral)
  • Private Topic Starter
15 years ago
Thanks for your reply. I guess I have another problem now if you might also be able to help with this. Those scripts, how do I apply them to the objects/buildings? If its that bar in "object properties" that says "script", it won't let me select any script. Also, I can't find the word "***THEN***". Once again thanks for your help on the previous reply!!!!!
Drummin
15 years ago
OK, the only thing you're going to do on the Object Properties window is name the building.
Now to make scripts, go to Edit/Edit Scripts. You should see the list of folders for the Skirmish players. (IF NOT, go to Edit/Edit Player List and click the button that says, "Add Skirmish Players". Back in the script section, Click PlyrCivilian. I would create a new folder naming it something like, "BuildingsPlayer0" the inside make a script for 'player0' in position1.

Script Properties
You'll notice when you click "New Script" you open a window showing the "Script Properties" tab. This is where you name the script and set general parameters.
Script Conditions
You'll see "Script Conditions" is the next tab. By default it will say "IF True", but we want our script to check for a players start location, so click on the word "True" and then the "Edit" button. Click on the "Plus Sign" (+) by "Skirmish" and you should see "Start Position". Selecting "Start Position" will bring the actual script line into view in the window below. It should read.
Player '???' starting position is  0  .[/code]As we are working with 'player0' to start with, this is what you would type in where the three question marks are.  AND we'll check if this person is in the first start location so we will enter "1" for that parameter.  [code]Player 'player0' starting position is  1  .
Actions If True
The next tab at the top of the script editor is the Actions If True tab, meaning if the conditions have been met, then the actions listed in this section will be performed. Again, you'll see the default line saying, "Null operation. (Does nothing.)", which we definitely don't want so again, select it then click edit.

This will bring into view a similar type of menu tree with the "Plus Signs" opening folders inside. You are wanting to transfer a named building to a player so go to "Player" then "Transfer" then select the script line to "Transfer a specific unit to the control of a player." Just like for the conditions, by selecting this script, the script line is shown below where you edit the variables adding the (Unit or Building name) and the player (player0).

Now I assume you have a whole list of buildings for start position 1, so copy this script line and edit the building name and repeat until you've got all buildings listed for this position.

Once done, click OK on all the windows and save your work. You will notice that when viewing the script that the "IF", "THEN" and "ELSE" (if used) are shown on your completed script. You should be able to test your map in the start location you just scripted for.

If when testing and all buildings transferred to you as expected, great. Go back and copy this script in the same folder and edit the "Start Position" in the condition of the script, and the building names in the "Actions if true" section of the script and save and test again. Repeat.
waiehustag
  • waiehustag
  • 58.25% (Neutral)
  • Private Topic Starter
15 years ago
Thanks again for your help. I have another question. I've played on a few maps where people have modified infantry units. Some of them added the Colonel Burton's remote bomb and detonate to Black Lotus. What I was trying to do based on the things I've seen in the forums is give Colonel Burton the hack ability of Black Lotus and the vehicle snipe of Jarmen Kell. So far I've been able to have the command button show up but when I click on the button it does nothing. For example I have added the hack command button for him but I when I try to use it I have no luck.

*** IF ***
    True.
*** THEN ***
  [???] Command button: 'Command_ChinaInfantryBlackLotusCaptureHack' is added to all objects of type 'Lazr_AmericaInfantryColonelBurton' in slot number  12  (1-12).
  [???] Command button: 'Command_GLAInfantryJarmenKellSnipeVehicleAttack' is added to all objects of type 'Lazr_AmericaInfantryColonelBurton' in slot number  11  (1-12).
Annihilationzh
15 years ago
You can't do that with a script. Only with a map.ini. Basically, the button does practically nothing, it's Lotus that does the hacking, and Jarmen kell that has the vehicle snipe.

IIRC, giving the vehicle snipe to burton will make him use his knife attack.
If you need help, post in the forum. You'll get help a lot faster than if you send me a PM.

I reject all buddy requests. I don't think 'buddy' needs to be made official. It's not like you're marrying me.
waiehustag
  • waiehustag
  • 58.25% (Neutral)
  • Private Topic Starter
15 years ago
Aside from that I've had a few problems which I can't find solutions too in the forums.

1) How do I have units/structures already with pre-built upgrades? For example, I want USA tank to already have drone. Or a power plant to have the control rods already built?

2) I have a code that spawns missile defenders but on the right side of the screen it shows that there is a Missing GUI. I found in the forums that if you hide special power countdowns it will hide that. I found that it only works for the heroes such as Colonel Burton, Black Lotus, and Jarmen Kell. The only way to get rid of that was to hide every timer which I didn't want to do.

3) I have placed Jarmen Kell as an object on my map had transferred over to first player as soon as the game starts. He can do his special power which is sniping vehicles but he can't seem to kill infantry units though.

4) Is there a script so that you can create more Colonel Burtons or Jarmen Kells from one base during gameplay? Because once you make a hero the command button for it turns black and white and you can't make anymore until that hero is dead.

5) Is there another way to create units with different levels of veterancy other than placing them on the map with the object tool and then editing their veterancy in the object properties? I would like to spawn units with at least the "veteran" veterancy level.

6) I guess this would be my last question for now. On the right hand side of the screen there are buttons that you can click for whatever superweapons or reinforcements you may have. Is there a way to add other buttons there?
Annihilationzh
15 years ago
1) Can only be done with a map.ini

2) You'll have to use unit>Special Power>Special power countdown timer -- hide

3) Haven't come across this bug before.

4) Possibly with a map.ini, but map.inis are buggy in this area.

5) You can spawn teams with a specific veterancy. Edit>Edit teams>Add new teams>Reinforcement>Veterancy Level

6) Yes, but only with a map.ini.
If you need help, post in the forum. You'll get help a lot faster than if you send me a PM.

I reject all buddy requests. I don't think 'buddy' needs to be made official. It's not like you're marrying me.