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.

Author
Message
Southside Games
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: Don\'t tell me what to do!
Posted: 2nd Mar 2013 07:26
hello.

I made a function that would create an ai for an RTS I'm working on. I Store all the Ai data in one array, to keep it simple and dynamic I made a function that would expand the array every time I made a new unit by coping the data from the main array to a place holder of equal size. I then undim and then re dim the main array plus one slot. It seems to work fine in terms of data storage. But the AI don't work right.

1: only the first unit to be made actually spawns on the map. all the others are nowhere to be seen.

2: for debug I print all the x positions of the objects just to see what it says. the first unit, prints it's location fine. But all the other units have "-1.#IND". I'm not sure what this means.

3: if I spawn a unit object but don't add it to the AI system, it works just fine. it's weird because it used to always work, but then one time when I compiled it did it like I described. and no amount of back stepping seems to fix it.

This is the code that calls the spawn unit function.



Code that makes the unit.



And this is the code that expands the array by one.



Thanks for the help.
GreenDixy
15
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 2nd Mar 2013 17:53
i may be wrong but





should it not be something like this




======================================
My software never has bugs. It just develops random features.
Southside Games
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: Don\'t tell me what to do!
Posted: 2nd Mar 2013 19:24
I see why you would think that. but no that's not what it means. Makeleader() is a funtion. not an array.

Makeleader(team_num,major)
Southside Games
14
Years of Service
User Offline
Joined: 1st Jan 2010
Location: Don\'t tell me what to do!
Posted: 3rd Mar 2013 02:35
well I got it to work. I spaced them out and they loaded just fine. I don't think dark AI knows how to handle the ai if they all are in the same spot.

Login to post a reply

Server time is: 2024-03-29 11:06:56
Your offset time is: 2024-03-29 11:06:56