Unit Creating Trigger Problem

Joccaren

You can change this now in User CP.
Reaction score
54
Could someone please help me find what I did wrong in this trigger? I want this trigger to spawn the appropriate number of units of the appropriate type of each players chosen race for each player, however, when I test the map it comes up with the error:
parameter in 'sUnitCreate' (value: 0)
Trigger Error in 'gt_Spawn_Func'.
Could not get 'unit type' from
parameter in 'sUnitCreate' (value: 0)
Thanks to anyone who helps.
Code:
Spawn
    Events
        Game - Map initialization
    Local Variables
        Spawn Number = 0 <Integer[3][3]>
        Player Race = 0 <Integer[6]>
        Spawn Type = No Game Link <Game Link - Unit[3][3]>
        Loop Integer = 0 <Integer[2]>
        Start Point = No Point <Point[6]>
    Conditions
    Actions
        Variable - Set Spawn Number[1][1] = 1
        Variable - Set Spawn Number[1][2] = 11
        Variable - Set Spawn Number[1][3] = 6
        Variable - Set Spawn Number[2][1] = 3
        Variable - Set Spawn Number[2][2] = 8
        Variable - Set Spawn Number[2][3] = 3
        Variable - Set Spawn Number[3][1] = 1
        Variable - Set Spawn Number[3][2] = 3
        Variable - Set Spawn Number[3][3] = 4
        Variable - Set Spawn Type[1][1] = Terran Battlecruiser
        Variable - Set Spawn Type[1][2] = Viking
        Variable - Set Spawn Type[1][3] = Terran Raven
        Variable - Set Spawn Type[2][1] = Zerg Leviathan
        Variable - Set Spawn Type[2][2] = Zerg Corruptor
        Variable - Set Spawn Type[2][3] = Zerg Mutalisk
        Variable - Set Spawn Type[3][1] = Protoss Mothership
        Variable - Set Spawn Type[3][2] = Protoss Pheonix
        Variable - Set Spawn Type[3][3] = Protoss Carrier
        General - For each integer Loop Integer[1] from 1 to 6 with increment 1, do (Actions)
            Actions
                Variable - Set Start Point[Loop Integer[1]] = (Random point in (Playable map area) between 200.0 and 200.0 distance from enemy units of player Loop Integer[1] (prefer points within 200.0 of an enemy building))
                General - If (Conditions) then do (Actions) else do (Actions)
                    If
                        (Race of player Loop Integer[1]) == Protoss
                    Then
                        Variable - Set Player Race[Loop Integer[1]] = 1
                    Else
                        General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                (Race of player Loop Integer[1]) == Terran
                            Then
                                Variable - Set Player Race[Loop Integer[1]] = 2
                            Else
                                General - If (Conditions) then do (Actions) else do (Actions)
                                    If
                                        (Race of player Loop Integer[1]) == Zerg
                                    Then
                                        Variable - Set Player Race[Loop Integer[1]] = 3
                                    Else
                General - For each integer Loop Integer[2] from 1 to 3 with increment 1, do (Actions)
                    Actions
                        Unit - Create Spawn Number[Player Race[Loop Integer[1]]][Loop Integer[2]] Spawn Type[Player Race[Player Race[Loop Integer[1]]]][Loop Integer[2]] for player Loop Integer[1] at Start Point[Loop Integer[1]] facing (Random angle) degrees (No Options)
 

Rusty

New Member
Reaction score
5
your spawn type variable declaration looks messed up. = No Game Link <Game Link - Unit [3] [3] >
just make it a plain unit type array, this looks weird so there might be something wrong here

you should use an if-then-else-if for your race selection instead of nested if statements


it looks like you have an error in the last line, you have Spawn type[Player Race[Payer race[Loop Integer[1]]]]
this will give you the unit type of( race number of the race number of the player number), and i have a feeling that isnt what youre going for here

i dont even know why this isnt giving you an array overflow error
 

Joccaren

You can change this now in User CP.
Reaction score
54
Hmm, what do you mean by a plain unit type array? I have just created a Unit-Type Variable and made it into an array. The 'No Game Link' was the default selection that came up when I created the variable. What do you suggest I change it to?

Thanks for the tip with the If/Then/Else/If, I've only just starting triggering with SCII and have yet to learn the new functions and such.

Thanks for pointing that out, I've fixed that now, but it still pops up with the same error.

What's an array overflow error XD?

Thanks for the help anyway
 

eXirrah

New Member
Reaction score
51
you should do it for active players only. Empty player slots doesn't have
race...

Except of looping through all the payers, loop through only the active one like this:

Player Group - Pick each player in (Active Players) and do (Actions)

@Rusty: When you create array in GUI it creates the array with 1 more element.
It basicly creates 1-based array.

EDIT: I'm not sure but maybe empty slots have race and it is neutral.
The problem with your trigger is that you loop through players 1-6, so
when you test the map only player 1 (you) is there and players 1-6
don't have races, so Player Race[2..6] = 0.
When you create the units you try to access
Spawn Number[Player Race[Loop Integer[1]]][Loop Integer[2]]
which is Spawn Number[0][Loop Integer[2]] for players 2-6 which is
No Game Link and the game must create an unit, it cannot create
nothing and pops the error.
 

Joccaren

You can change this now in User CP.
Reaction score
54
Shouldn't I get my units though? I get none and the eroor just pops up. Thanks for the tip though, I'll add that in.
 

eXirrah

New Member
Reaction score
51
Your second for loop is outside the first for loop so Loop Integer[1] = 6 and
this happens:

Unit - Create Spawn Number[Player Race[6]][Loop Integer[2]] Spawn Type[Player Race[Player Race[6]]][Loop Integer[2]] for player 6 at Start Point[6] facing (Random angle) degrees (No Options)

You try to create the units for player 6.
Bu there is more to it...
Player Race[6] = 0 --> Spawn Number[0][Loop Integer[2] = 0

Spawn Type[Player Race[Player Race[6]]][Loop Integer[2]]

Player Race[Player Race[Loop Integer[1]]] ??? why is that shouldn't it be
Player Race[Loop Integer[1]]

Player Race[Player Race[6]] = Player Race[0] = 0

Spawn Type[0][Loop Integer[2] = No Game Link

So you want the game to spawn three times this:

Unit - Create 0 (No Game Link) for player 6 at Start Point[6] facing (Random angle) degrees (No Options)

and it can't ...

you should put the second loop into the first loop , fix Player
Race[Player Race] thing, make the first loop loop through active players
only.
 

Joccaren

You can change this now in User CP.
Reaction score
54
The second loop is in the first loop, its just a bit hard to tell with the code tags. I can't wait for SCII Tags for GUI as I don't feel the WC3 tags quite fit in.

Also, I have fixed the PlayerRace(PlayerRace(LoopInteger(1))) and it still does not want to work. I'm thinking of taking out all the variables and re-arranging everything and seeing if that works.

Edit:
Yeah, Now it works. I removed all the variables (Except the loop variables and start point variable) and moved the if/then/else/if into the loop and made it spawn the specific units based directly on what the players race was without the variables. Thanks for helping everyone.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top