[Include] [INC] Object Grouping
#1

[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.

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
Reply
#2

Nice, I can't wait.
And DestroyGroupObject is a nice idea.
Reply
#3

Well, there's no point I do not check if object group is already created, it simply sets the coordinates.

I would like some help with next version of this which should include the function ObjectGroupRotate
Reply
#4

Something like this has been made by someone(forgot) before.
Anyway, nice job.
Reply
#5

Quote:
Originally Posted by yezizhu
Something like this has been made by someone(forgot) before.
Anyway, nice job.
Westie
http://www.westie-cat.co.uk/sa-mp/in...roupObject.inc
Reply
#6

hmm, ok wasn't that useful, howerver I didn't have anything else good to do, so.. y_more? :rofl:
Reply
#7

so this include allow move many objects together ?
Reply
#8

One thing to make yours better is to be able to rotate groups, when thats done I think the outcome will be amazing.
Reply
#9

Thank you, but I think I would need help tho.. I ain't that much into geometry/.. what's that name for the geometry in a 3-d space? That would take a whole bunch of time to learn for me ;/

I will try howerver. Thank you.
Reply
#10

Quote:
Originally Posted by Izanagi
Thank you, but I think I would need help tho.. I ain't that much into geometry/.. what's that name for the geometry in a 3-d space? That would take a whole bunch of time to learn for me ;/

I will try howerver. Thank you.
SHll I tell you a nerdy trick, I got my maths teacher to help me with a MOvePlayerAlongAngle function, seriously though, maths teachers are useful, I might ask her again if I feel like standing there for a 20 minute explanation
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)