SA-MP Forums Archive
[Include] [INC] Object Grouping - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] [INC] Object Grouping (/showthread.php?tid=83801)



[INC] Object Grouping - Ignas1337 - 27.06.2009

[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



Re: [INC] Object Grouping - [NL]Bank - 27.06.2009

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


Re: [INC] Object Grouping - Ignas1337 - 27.06.2009

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


Re: [INC] Object Grouping - yezizhu - 27.06.2009

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


Re: [INC] Object Grouping - Chaprnks - 27.06.2009

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


Re: [INC] Object Grouping - Ignas1337 - 27.06.2009

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


Re: [INC] Object Grouping - mysan - 28.06.2009

so this include allow move many objects together ?


Re: [INC] Object Grouping - NeRoSiS - 28.06.2009

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


Re: [INC] Object Grouping - Ignas1337 - 29.06.2009

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.


Re: [INC] Object Grouping - NeRoSiS - 02.07.2009

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