• 🏆 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!

[Solved] Created unit placement messes up (somehow)

Status
Not open for further replies.
Level 12
Joined
Nov 3, 2013
Messages
989
Started with a new map recently. Going to use the player start location to decide where each players base will be upon initialization. im using angles between the start locations and *center of map* (x = 0, y = -256) so i can just loop the rest of the buildings up to place. Sadly it was acting up, wrong angles, found out that "center of playable map area" does not count with boundaries, so i used (x = 0, y = -256) instead and it improved slightly.

also attached map if someone want to look into it (i think it probably has something to do with the structures' pathing)

  • Player Group - Pick every player in Init_PlayerGroup_HumanPlayers and do (Actions)
    • Loop - Actions
      • Set Temp_Real[1] = (Angle from ((Picked player) start location) to Init_Point_CenterOfMap)
      • Unit - Create 1 Town Hall for (Picked player) at ((Picked player) start location) facing Default building facing degrees
      • Set Temp_Point[1] = (((Picked player) start location) offset by 576.00 towards (Temp_Real[1] + 90.00) degrees)
      • Unit - Create 1 Barracks for (Picked player) at Temp_Point[1] facing Default building facing degrees
      • Set Temp_Point[1] = (Temp_Point[1] offset by 320.00 towards Temp_Real[1] degrees)
      • Unit - Create 1 Guard Tower for (Picked player) at Temp_Point[1] facing Default building facing degrees
      • Set Temp_Point[1] = (Temp_Point[1] offset by -672.00 towards Temp_Real[1] degrees)
      • Unit - Create 1 Guard Tower for (Picked player) at Temp_Point[1] facing Default building facing degrees
      • Set Temp_Point[1] = (((Picked player) start location) offset by 576.00 towards (Temp_Real[1] - 90.00) degrees)
      • Unit - Create 1 Barracks for (Picked player) at Temp_Point[1] facing Default building facing degrees
      • Set Temp_Point[1] = (Temp_Point[1] offset by 320.00 towards Temp_Real[1] degrees)
      • Unit - Create 1 Guard Tower for (Picked player) at Temp_Point[1] facing Default building facing degrees
      • Set Temp_Point[1] = (Temp_Point[1] offset by -672.00 towards Temp_Real[1] degrees)
      • Unit - Create 1 Guard Tower for (Picked player) at Temp_Point[1] facing Default building facing degrees
Note: it *should* be negative 640 but -672 came closer because retarded pathing or somthing.

I don't really think it's a problem in the trigger but im posting it here anyway just in case i missed something, besides the -672.

Edit: Im starting to think it might have something to do with the pathing of the structures, since they don't have standard circle ones like units this might affect the 'location' even though if i were to place them in the editor it shows a square
 

Attachments

  • Need Halp thx.w3x
    57.4 KB · Views: 93
Last edited:
Level 2
Joined
Nov 21, 2010
Messages
29
Wouldn't be much easier if u preplace all buildings and remove for not existing players? :)

Less code and no pain in the *ss

This.

Why would you go through hours of perfecting this code when you can just do it the other way around in about a minute?
 
Level 13
Joined
Mar 24, 2010
Messages
950
yeah just do it the easy way and place it on the map and remove the unit if not needed later or if a player is not playing.

But if you really need it done this way for some reason.. you can use regions. and place buildings where you want them..

or you can place the units on the map already and just hide them till you want them to show.
 
Level 12
Joined
Nov 3, 2013
Messages
989
Wouldn't be much easier if u preplace all buildings and remove for not existing players? :)

Less code and no pain in the *ss

If this was ALL there was to it, ofcourse, but this is just PART of everything (obviusly) so if it's not working now it's not going to work for the rest either way. I'm going to make it proper from the start and be done with it

yeah just do it the easy way and place it on the map and remove the unit if not needed later or if a player is not playing.

But if you really need it done this way for some reason.. you can use regions. and place buildings where you want them..

or you can place the units on the map already and just hide them till you want them to show.

Regions would work but then how can what I'm not already doing work? im giving the specific coordinates for the locations with these polar offsets, why make a region every 128 pixels when just adding 128 pixels to the polar offset *Should* work?
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Try to do placement by multiples of 64, since that's the lowest margin of error for most buildings. Also, why? You're simply using the start point as a swing, not a start. I'd do like position of startpoint, posp offset 100 by 15, etc

Also, you leak like crazy
 
Level 12
Joined
Nov 3, 2013
Messages
989
Try to do placement by multiples of 64, since that's the lowest margin of error for most buildings.

Omg this might be it, i just realised I've been using 32 (the size of a gray grid square) which won't work for buildings.


Also, why? You're simply using the start point as a swing, not a start. I'd do like position of startpoint, posp offset 100 by 15, etc

I'm unsure of what this question is supposed to mean, clarify if you can/want.

Also, you leak like crazy

I would not be surprised if there are leaks, as right now I'm just confused about the locations. I did think that using the same variable to override previus values would only yeild one leak per variable though, and then you just destroy it at the end, if you care to explain where it leaks. I'm going to check 'things that leak' sticky again later on regardless.

Edit: It was indeed one that used 32 instead of 64, thanks for the help and this is solved.
 
Status
Not open for further replies.
Top