• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Spawning Trees via triggers--why is it borked?

Status
Not open for further replies.
Level 1
Joined
Sep 27, 2009
Messages
2
I've been working on this for a bit, and I've hit a wall. It quite simply doesn't work the way I expect it to, and I can't seem to figure out the problem with the script.

  • Actions
    • Set StartRegions[1] = Start1 <gen>
    • Set StartRegions[2] = Start2 <gen>
    • Set StartRegions[3] = Start3 <gen>
    • Set StartRegions[4] = Start4 <gen>
    • Set StartRegions[5] = Start5 <gen>
    • Set StartRegions[6] = Start6 <gen>
    • Set StartRegions[7] = Start7 <gen>
    • Set StartRegions[8] = Start8 <gen>
    • Set StartRegions[9] = Start9 <gen>
    • Set StartRegions[10] = Start10 <gen>
    • Set StartRegions[11] = Start11 <gen>
    • Set StartRegions[12] = Start12 <gen>
    • Set IterationVarB = 1
    • For each (Integer IterationVarB) from 1 to 12, do (Actions)
      • Loop - Actions
        • Set Angle = (Random real number between 0.00 and 360.00)
        • Set IterationVarC = 1
        • For each (Integer IterationVarC) from 1 to 180, do (Actions)
          • Loop - Actions
            • Set IterationVarC = (IterationVarC + 1)
            • Set PointOffset = (Random real number between 1250.00 and 1500.00)
            • If (Angle Greater than or equal to 360.00) then do (Set Angle = 0.00) else do (Do nothing)
            • Set Angle = (Angle + 2.00)
            • Set RandomPoint = ((Center of StartRegions[IterationVarB]) offset by PointOffset towards Angle degrees)
            • Set SecondOffset = (Random real number between 0.00 and 400.00)
            • Set RandvarA = (Random integer number between 4 and 8)
            • Set IterationVar1 = 1
            • For each (Integer IterationVar1) from 1 to RandvarA, do (Actions)
              • Loop - Actions
                • Set SecondOffset = (SecondOffset + (Random real number between 15.00 and 50.00))
                • Set IterationVar1 = (IterationVar1 + 1)
                • Destructible - Create a Summer Tree Wall at (RandomPoint offset by SecondOffset towards Angle degrees) facing (Random angle) with scale 1.00 and variation 0
                • Destructible - Set max life of (Last created destructible) to (Random real number between 20.00 and 50.00)
                • Destructible - Set life of (Last created destructible) to (Max life of (Last created destructible))
        • Set IterationVarB = (IterationVarB + 1)
In a nutshell, here's what it's supposed to do: i want to generate a circle of trees around the center of the region, but with a slightly variable width & distance from the center of each of the 12 regions. The FIRST loop essentially exists JUST to make sure each region gets trees, the SECOND loop tells it to generate a circle of trees, one degree apart, the THIRD loop generates multiple trees at the particular angle.

Here's what's happening: I get only FIVE regions to generate trees. I've tried moving the integer increments to various locations, without any success. At best it simply changes WHICH five regions get trees. Now I'd understand all this if it was generating trees in SIX regions (to a degree, anyway), but five has me all confused.

Any and all help would be much appreciated, as I'm a bit lost.

Thanks.
 
Status
Not open for further replies.
Top