why doesn't this work correctly

madd_999

New Member
Reaction score
14
i am trying to reduce the height of the ground in a region using the create carter deformation using this trigger:

Trigger:
  • Events
    • terrain
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Set Xtimes = 0.00
      • Set Ytimes = 0.00
      • -------- Set X --------
      • Set MinX = (Integer((Min X of Region 000 <gen>)))
      • Set MaxX = (Integer((Max X of Region 000 <gen>)))
      • -------- Set Y --------
      • Set MinY = (Integer((Min Y of Region 000 <gen>)))
      • Set MaxY = (Integer((Max Y of Region 000 <gen>)))
      • -------- Calculate lenght --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MaxY Less than 0
        • Then - Actions
          • Set MaxY = (MaxY x -1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MinY Less than 0
        • Then - Actions
          • Set MinY = (MinY x -1)
        • Else - Actions
      • Set Lenght = (MaxY + MinY)
      • -------- Calculaye width --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MaxX Less than 0
        • Then - Actions
          • Set MaxX = (MaxX x -1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MinX Less than 0
        • Then - Actions
          • Set MinX = (MinX x -1)
        • Else - Actions
      • Set Width = (MaxX + MinX)
      • For each (Integer A) from 1 to Lenght, do (Actions)
        • Loop - Actions
          • Set Ytimes = (Ytimes + 1.00)
          • Set PointY = ((Min Y of Region 000 <gen>) + Ytimes)
          • For each (Integer B) from 1 to Width, do (Actions)
            • Loop - Actions
              • Set Xtimes = (Xtimes + 1.00)
              • Set PointX = ((Min X of Region 000 <gen>) + Xtimes)
              • Environment - Create a 0.50 second Permanent crater deformation at (Point(PointX, PointY)) with radius 50.00 and depth 10.00

loop A should calculate Y and then run loop B which will create the crater on the right point's by increasing X by 1 every time loop B runs and creates a new crater on the new X,Y .. then Y increases one and and it should do the same... the only thing it does now is run the correct X worth and not the Y..

so i only get 1 line of lowered ground instead of a whole square.
 

Attachments

  • terrain test.w3x
    14.1 KB · Views: 74

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
Trigger:
  • Region 000 Deformation
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Environment - Create a 0.01 second Permanent crater deformation at (Center of Region 000 <gen>) with radius 512.00 and depth 256.00


Maybe try this much easier approach ^^?
 

madd_999

New Member
Reaction score
14
that will create 1 crater...

i am trying to abuse it to create a square form..

at the moment it goes fine around the X-axis but it wont do it for every Y on the Y-axis..
well it only does 1 Y and not the whole Y-axis.

if you look at the map.. i want the lower the whole region down and not only 1 point
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
Ok try this instead:

Trigger:
  • For each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions
      • Set Ytimes = (Ytimes + 50.00)
      • Set PointY = ((Min Y of Region 000 <gen>) + Ytimes)
      • Set Xtimes = 0.00
      • Game - Display to (All players) the text: (String(PointY))
      • For each (Integer B) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set Xtimes = (Xtimes + 50.00)
          • Set PointX = ((Min X of Region 000 <gen>) + Xtimes)
          • Environment - Create a 0.50 second Permanent crater deformation at (Point(PointX, PointY)) with radius 50.00 and depth 512.00
          • Game - Display to (All players) the text: (String(Xtimes))
          • Wait 0.01 seconds


you have to null the Xtimes after the first iteration of Loop B
otherwise (in your trigger when PointY = -511.0) Xtimes would be equal to 512 then 1024 and etc.

you dont need to lower the terrain for every x and y with 10
because of the radius(50 in your case) of the cratter you are making
instead you can lower like in the above 512(128 , 256 whatever you like)
with the difference of the x and y being equal to that of the radius of the cratter


hope this helps abit


Edit:

all this seams very inefficient
you should better do it with the terrain palette
 

madd_999

New Member
Reaction score
14
yes i know i can better do it with the terrain pallet tools.. but i cant use those in game...

I remade your trigger and it only shows me 1 line lower not the whole region..
checked it twice..

I also found an error in my trigger.. if the minimum X or minimum Y is bigger in a positive number then my max.. i will get negative numbers.. and you cant do something from 1 to -X and count upwards...

also found a way to shorten my code and to fix this problem..

the code i am now using:
Trigger:
  • terrain
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Set Xtimes = (Distance between (Point((Min X of Region 000 <gen>), (Min Y of Region 000 <gen>))) and (Point((Max X of Region 000 <gen>), (Min Y of Region 000 <gen>))))
      • Set Ytimes = (Distance between (Point((Min X of Region 000 <gen>), (Min Y of Region 000 <gen>))) and (Point((Min X of Region 000 <gen>), (Max Y of Region 000 <gen>))))
      • Set Width = (Integer(Xtimes))
      • Set Lenght = (Integer(Ytimes))
      • Set Xtimes = 0.00
      • Set Ytimes = 0.00
      • Set PointY = (Min Y of Region 000 <gen>)
      • Set PointX = (Min X of Region 000 <gen>)
      • For each (Integer A) from 1 to Lenght, do (Actions)
        • Loop - Actions
          • Set Ytimes = (Ytimes + 1.00)
          • Set PointY = ((Min Y of Region 000 <gen>) + Ytimes)
          • Environment - Create a 0.50 second Permanent crater deformation at (Point(PointX, PointY)) with radius 10.00 and depth 10.00
      • For each (Integer A) from 1 to Width, do (Actions)
        • Loop - Actions
          • Set Xtimes = (Xtimes + 1.00)
          • Set PointX = ((Min X of Region 000 <gen>) + Xtimes)
          • Environment - Create a 0.50 second Permanent crater deformation at (Point(PointX, PointY)) with radius 10.00 and depth 10.00


i know i am re-using variable Xtimes and Ytimes but I dint want to create new one's..

this code now gives me the following:
____X
____X
____X
XXXXX

where X is the lowered ground and _ is the ground that still needs to get lowered.

for some reason putting loop A inside loop B (or the other way around) doesnt work.. he will do 1 line.. the horizontal or the vertical one..

so it still doesn't fill the _ and still doesn't work correctly..
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
You can't make the game to run some code that much times that you would've want.

512 * 512 = 262 144 <- really big number so the game gives up running the code thinking(^^) it's in an infinite loop or something.

Try adding a message after your loops and see if it is shown(it wont..).
Not sure but I think this is called a thread crash.?


You could try this
JASS:
This is your region
 ________________
|               |
|               |
|               |
|               | length 512
|               |
|               |
|_______________|
       width 512

you can divide it to 64 (8 * 8) smaller squares with 64 width and 64 length ofc.
 _______________
|_|_|_|_|_|_|_|_| 64
|_|_|_|_|_|_|_|_| 64
|_|_|_|_|_|_|_|_| 64
|_|_|_|_|_|_|_|_| 64
|_|_|_|_|_|_|_|_| 64  512
|_|_|_|_|_|_|_|_| 64
|_|_|_|_|_|_|_|_| 64
|_|_|_|_|_|_|_|_| 64
6464646464646464
         512

You could probably use polar projection to find the each center of those 64 squares and then use the CreateCratter function with radius 64 :/


but still the terrain palette looks more promising
 

madd_999

New Member
Reaction score
14
but still the terrain palette looks more promising

i cant use that in game

Try adding a message after your loops and see if it is shown(it wont..).
Not sure but I think this is called a thread crash.?

it will just run the outer loop 5 times and the inner loop the amount of time you want it.. so yeah i think your right about the thread crash..

Code:
You could try this
well that works.. hate myself now because i dint thought of that.. thats the most simple way...

now i only need to find the magic math formula behind it so i can use it on bigger squares or even rectangle's :p..
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
Remember that changing the terrain ingame by deformation functions is likely to cause desyncs, so it should only be used in single player maps.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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