wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > General Development
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 03-10-2018, 04:07 PM   #1
andreasaspenberg
User
 
Join Date: Jul 2007
Posts: 149

andreasaspenberg is on a distinguished road (12)

Default please help me calculate base positions

i have a map where players use their hero units to create full bases. the bases start on Level one but can be upgraded(that is under Control however). what i need help With is to spawn the buildings correctly in comparison to each others. to do that i use point With offset as that is very flexible. i just need to calculate the proper offset coordinates to accomplish that. please help me out. i tried asking on the hive workshop but there i just get trolled all the time.
andreasaspenberg is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 05-09-2018, 08:46 PM   #2
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,189

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Which building are you having trouble spawning? The level one that is placed by heroes? Or the upgraded buildings?

What are your input parameters (what information do you have available when determining the position where the building will spawn)?
__________________
Anitarf is offline   Reply With Quote
Old 05-09-2018, 10:42 PM   #3
andreasaspenberg
User
 
Join Date: Jul 2007
Posts: 149

andreasaspenberg is on a distinguished road (12)

Default

when the heroes construct the bases, all buildings gets spawned at the same time. when they are upgraded however they do not change position. the heroes place the "town hall" building only while the others spawn at points in relation to that. i need to use x or y coordinates which does work. my issue is to calculate the correct coordinates for spawning each building.
andreasaspenberg is offline   Reply With Quote
Old 05-10-2018, 04:13 PM   #4
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Then it should be a criteria to establish this coordinates (distance between points, symmetry, etc)
moyack is offline   Reply With Quote
Old 05-10-2018, 06:16 PM   #5
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,189

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

My suggestion would be to place your buildings in the editor the way you want them to be positioned around a town hall. Once you're happy with your setup, measure how far the centre of each building is from the town hall and write it down.

You can use the grid to help you measure the distances, each yellow grid square in the editor is 512 units long, each white square 128 units.

Once you have the x and y offsets of all the buildings written down, you can delete the buildings in the editor and write the script that will spawn them when the hero places the main building. In the script, simply get the x and y coordinates of the main building and then add the x and y offsets you have written down to get the coordinates of other buildings, then create those buildings at those coordinates.
__________________
Anitarf is offline   Reply With Quote
Old 05-10-2018, 09:36 PM   #6
andreasaspenberg
User
 
Join Date: Jul 2007
Posts: 149

andreasaspenberg is on a distinguished road (12)

Default

one problem with that is that i do not fully understand the trigger and as such it is hopeless. i need help with specifying the correct coordinates.
andreasaspenberg is offline   Reply With Quote
Old 05-14-2018, 06:00 PM   #7
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,189

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Can you post the trigger you have so far?
__________________
Anitarf is offline   Reply With Quote
Old 05-14-2018, 07:01 PM   #8
andreasaspenberg
User
 
Join Date: Jul 2007
Posts: 149

andreasaspenberg is on a distinguished road (12)

Default

yeah sure. construction on correct area
Events
Unit - A unit Finishes construction
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Constructed structure)) Equal to Human Town Hall level 1 (built by hero)
Then - Actions
Unit - Create 1 Barracks level 1 for (Owner of (Constructed structure)) at ((Position of (Constructed structure)) offset by (100.00, 100.00)) facing Default building facing degrees
Else - Actions
Do nothing
andreasaspenberg is offline   Reply With Quote
Old 05-16-2018, 07:04 PM   #9
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,189

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

That's good, you just need to figure out what you want your offset to be. 100,100 is really close, that's less than one medium grid square away from the main building (one medium grid square is 128x128 units). Try placing your buildings in the editor how you want them to be, then count how many grid squares are between the centres in vertical and horizontal direction. (if your grid is turned off, you can cycle through various grid resolutions by pressing the g key in the editor). Each medium grid square is 128 units.
__________________
Anitarf is offline   Reply With Quote
Old 04-14-2019, 02:31 PM   #10
andreasaspenberg
User
 
Join Date: Jul 2007
Posts: 149

andreasaspenberg is on a distinguished road (12)

Default

my problem is still that i do not understand how the coordinates is calculated, someone needs to explain it to me.

Last edited by andreasaspenberg : 04-14-2019 at 02:38 PM.
andreasaspenberg is offline   Reply With Quote
Old 04-16-2019, 04:04 PM   #11
Themerion
Brahms-fan
 
Themerion's Avatar
 
Join Date: Jan 2006
Posts: 642

Submissions (2)

Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)Themerion has a spectacular aura about (110)

Default

To build on Anitarf's answer:

The offset (0.00, 0.00) takes 2 real numbers. The FIRST controls right/left, the SECOND controls up/down.

If you click G, you should see a grid with white and yellow lines. To move 1 WHITE line:
  • RIGHT = (128, 0)
  • LEFT = (-128, 0)
  • DOWN = (0, -128)
  • UP = (0, 128)

In the attached image, to get the position of the star, we would use: ( -256, 128 ). That is two steps left ( 2 * -128 ), and one step up (1 * 128).
Attached Images
File Type: jpg example.jpg (172.1 KB, 2 views)
__________________
Submissions::
(v)JASS Tutorial
Covers how to make fast and safe coding for common tasks in vJASS/JASS.
Creep Respawn System
It has never been easier to respawn creep groups...

Last edited by Themerion : 04-16-2019 at 04:05 PM.
Themerion is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 10:12 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services