This is mostly intended for the beginning AI makers, but hey it provides a decent structure. It is also pretty incomplete and untested (only tried a couple commands, but they should work okay).
What does it do?
It provides most of the commands a unit can perform, and simplifies people's lifes by having one object that does most functions a unit will need. I reccomend you simply make an array/vector of 5000 of them at startup and then assign them IDs and Update() them.
http://www.fileuniverse.com/?p=showitem&ID=2409
I gotta add a couple more commandsand test it some more when i have the time, but should work no probs :)
Please comment/critique, so i can sort it for the next version.
This isnt like the mex class, a fire and forget thing. I want comments on this so if anyones gonna start going off-topic or flaming, please would you kindly go fuck a goat instead.
UNIT Class v1
Moderators: hoijui, Moderators
Looks interesting. I might suggest a few more status commands though. Maybe something like this:
Also, for the sake of C++ pickiness, the UniDef and ID pointers should probably go into the private section and be accessed by functions to prevent them from accidentally being changed.
Otherwise, looks pretty good. I might try using it.
Code: Select all
bool BeingBuilt();
bool IsAlive();
float Health();
float PercentHealth();
float3 CurrentPosition();
command CurrentCommand();
int Group();
...
etc.
Otherwise, looks pretty good. I might try using it.
- Lindir The Green
- Posts: 815
- Joined: 04 May 2005, 15:09
most of these can be called from the callback :), reason why the def is public.Veylon wrote:Looks interesting. I might suggest a few more status commands though. Maybe something like this:Also, for the sake of C++ pickiness, the UniDef and ID pointers should probably go into the private section and be accessed by functions to prevent them from accidentally being changed.Code: Select all
bool BeingBuilt(); bool IsAlive(); float Health(); float PercentHealth(); float3 CurrentPosition(); command CurrentCommand(); int Group(); ... etc.
Otherwise, looks pretty good. I might try using it.
Update() plays the role of IsAlive(), you can use that!
Ill make ID changing a method however and keep the actual int private and also add current position/group/current health methods
Keep them coming!