Lengo
  • Lengo
  • 69.5% (Friendly)
  • Captain Topic Starter
12 years ago
I have a skirmish map. I wrote a script for it, but it doesn't work.

The script (in the PlyrCivilian folder)

if player 'SkirmishChinaNukeGeneral'starting position is 2
THEN
Spawn unit 'crate2500' of type '2500DollarCrate' on Team '<This Team>' at waypoint Waypoint 'waycrate 1'

This doesn't work, although all names are available from drop down lists. I assumed that since the ai's starting position is always player_2_Start, then the IF statement should use this number. It didn't work. So I changed the number to 1. That didn't work either.

I also assume that this crate is in the Civilian folder of MISC_MAN_MADE, so the script goes in the PlyrCivilian folder because it must be spawned by the civilian. However, in the scripts, the name of the civilian team is PlyrCivilian. But the owner of a crate is teamPlyrCivilian. Ack!

Nevertheless, I tried (the IF statement doesn't even make sense)

if Player 'SkirmishChinaNukeGeneral' is Faction Name: ChinaNukeGeneral
THEN
Spawn unit 'crate2500' of type '2500DollarCrate' on Team '<This Team>' at waypoint Waypoint 'waycrate 1'

This doesn't work either, and it's in the PlyrCivilian folder just like the first because PlyrCivilian is suppose to spawn it, right?

So back to the first format, but I changed the Team to spawn onto, to teamPlyrCivilian:

[code]
if player 'SkirmishChinaNukeGeneral'starting position is 2
THEN
Spawn unit 'crate2500' of type '2500DollarCrate' on Team 'teamPlyrCivilian' at waypoint Waypoint 'waycrate 1'

Still doesn't work! Why?

How do I do this? I want to spawn a crate near the player's base so that he has an easier time against the skirmish china nuke general when playing on Hard Difficulty. He is difficult to beat! He has tanks long before I have 'em. In game, I have only researched 'capture' and sent infantry out to capture oil derricks and turrets and he has tanks in my face! So, at first, I put down a 2500 crate, and this did the trick, but I'd rather place that crate based on who is playing from Player_2_Start.



Sponsor
i^love^mixery
12 years ago


all names are available from drop down lists.


That is meaningless.

The scripts do not work like that.

The player that you want to spawn the crate for needs to be the same as the folder you put the script into.

If you want to spawn a unit for PlyrCivilian, the script is supposed to be in PlyrCivilian scripting folder, regardless of which folder contains which object in the objects list.

It is the same if you want to check starting positions. The script needs to be in the folder of the player which you want to check.

This should work, but it will prevent the AI scripts from being executed as this script needs to be put into the Nuke Generals scripting folder:


if player 'this player'starting position is 2
THEN
Spawn unit 'crate2500' of type '2500DollarCrate' on Team 'this player' at waypoint Waypoint 'waycrate 1'

a solution that you can put into PlyrCivilian folder would be this:


*IF*
player0 has EQUAL TO 1 unit of type "Nuke Command Center"
AND
player0 has units inside area "InnerPerimeter2"
*THEN*
Spawn unit 'crate2500' of type '2500DollarCrate' on Team 'PlyrCivilian' at waypoint Waypoint 'waycrate 1'

the above code needs to be duplicated for all starting positions (inner perimeters) and all players (player0-player7), so up to 64 scripts. Consider whether its worth the effort. also all the 64 scripts need to be deactivated instantly after the game has started, or more boxes will be spawned during the game (when a nuke general enters the InnerPerimeter of another player)
Lengo
  • Lengo
  • 69.5% (Friendly)
  • Captain Topic Starter
12 years ago
It's not worth the effort. I don't want to duplicate code and undo what's already coded. I'll simply make a version of this map with the crate already in place. THis map will be used only for the China Nuke general and perhaps the vanilla USA.

Thanks anyway.