27.06.2009, 11:45
[INC]Object Grouper
by Thanatos [Ignas1337]
I've been cycling through forums today and came up with an idea. What I have done is an object grouping system which allows all objects to move together with a slight desync on slower cpus as it needs time to cycle through objects and check if they're in a group. Now I'l explain the functions.by Thanatos [Ignas1337]
init_GroupedObjects();
This function must be put ongamemode init to reset the group count, as it starts with 1, and the minimum group id is 0, so...
CreateObjectGroup(float, float:y, float:z)
This function here creates a group with coordinates x, y and z. You might wonder why I use group coordinates but I do so because I will need offset for moving the group later.
AddObjectToObjectGroup(object_groupid, objectid)
This function simply assigns an object objectid to group object_groupid
CreateGroupObject(modelid, groupid, float:aX, float:aY, float:aZ, float:arX, float:arY, float:arZ);
The function creates an object already assigned to a groupid. I use the letter a before the floats because in the include the simbols are already defined, so it cannot repeat.
MoveObjectGroup(groupid, float:newX, float:newY, float:newZ, floatpeed);
This function moves all objects that are in groupid with the same offset to group coordinates, although the group coordinates change.
Hope you enjoy!
Downloads
Pastebin