Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Troop Formations

Author
Message
ChozoMufin
20
Years of Service
User Offline
Joined: 19th Apr 2005
Location: Columbus, OH
Posted: 18th Jul 2005 06:12 Edited at: 18th Jul 2005 06:13
I have a problem. In my rts, when i tell my soldiers to go to somewhere, they all have the same obvective location so they all clump together because they're all trying to get to the same spot. now i have tried to make them go into little formations(or lines, rows, whatever) when they move but my attempt has failed (see snippit). if anyone knows how to do this, please help.



yeah just so you know, the array called select's second level of data is the particular troop's x, y, and z location orders. if you have no idea what i just said just say so and i'll try to exsplain it more.

Your Head A-Splode
HWT
20
Years of Service
User Offline
Joined: 1st Apr 2005
Location: Earth
Posted: 19th Jul 2005 05:50
Hi there

I haven't really understood your code but tried to develop something myself - hope this helps


Hope this helps

HelloWorld Tommorrow
ChozoMufin
20
Years of Service
User Offline
Joined: 19th Apr 2005
Location: Columbus, OH
Posted: 19th Jul 2005 06:27
yeah thats' not exactly what i wanted, but thanks anyway.

i'll explain my code a bit: object 500 is the 3d mouse cursor that i made, so when you right click, whatever soldiers are selected get orders to move to the location of the cursor at the time of the click.

the select array is for determining wether a soldier is selected or not and for each soldier what his position orders are. as i said before, in the selection array, the second level of data (select(selection, 1 2 or 3) is each soldiers x, y, and z position orders, wich are declared when you right-click on a location.

rhold is just a holding variable that makes sure that when you right-click, the orders are only given once (so that the soldier won't follow your cursor if you hold it down).

soldiercount is the number of troops there are presently. right now it's 10, but i made my program in such a way so that if i increase the number of soldiers, everything still works.

now the number variable finds how many soldiers are selected in this for next statement:

i have only made formations for 3 amounts of selected soldiers(1,2,and 3) but will make more later.

soldier1, soldier2, and soldier3 are assigned the value of whatever units are selected, with soldier1 being the soldier with the least object number, soldier2 being the soldier with the next greatest object number, and so on.

so now that i have explained all that i can without giving you my entire code, somebody please help!

Your Head A-Splode
ChozoMufin
20
Years of Service
User Offline
Joined: 19th Apr 2005
Location: Columbus, OH
Posted: 19th Jul 2005 06:38
I fixed it! i just had one for next loop too many, so i took one of them out and now it works.

Your Head A-Splode

Login to post a reply

Server time is: 2025-05-22 22:39:49
Your offset time is: 2025-05-22 22:39:50