Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » linking presets  () 1 Vote
linking presets [message #486053] Thu, 13 February 2014 13:18 Go to next message
Stallion is currently offline  Stallion
Messages: 222
Registered: April 2006
Karma: 0
Recruit
I'm looking for a way of attaching a preset to another preset at a set coordinate on the preset using level editor and current scripts.

i.e. helipad with construction zone attached and a console attached at one end of it.

(a create preset xyz, facing will work too if it positions itself according to the object it's attached to)


Level edit is my play ground

[Updated on: Thu, 13 February 2014 13:22]

Report message to a moderator

Re: linking presets [message #486054 is a reply to message #486053] Thu, 13 February 2014 13:53 Go to previous messageGo to next message
Neijwiert is currently offline  Neijwiert
Messages: 124
Registered: October 2009
Karma: 0
Recruit
You mean like relative cordinates? You need to store the relative cordinates somewhere like: ChildObjPosition - ParentObjPosition and ChildObjRotation - ParentObjRotation. The child needs to be positioned when the parent is rotated with 0 degrees. Then whenever you move around/rotate the parent you need to recalculate the child position(s). The algorithms for this can be found on the internet.
Does not need to be related to c++, these problems occur at multiple places.

EDIT: with parent 0 rotation i mean like the default rotation of the thing...

EDIT #2: You can get the full translations of objects with Get_Transform, this returns a Matrix3D object which contains position and rotation. And you can apply that with Set_Transform

[Updated on: Thu, 13 February 2014 13:55]

Report message to a moderator

Re: linking presets [message #486055 is a reply to message #486053] Thu, 13 February 2014 13:55 Go to previous messageGo to next message
Ethenal is currently offline  Ethenal
Messages: 2532
Registered: January 2007
Location: US of A
Karma: 0
General (2 Stars)

He asked how to do it using the level editor and the current scripts in 4.1, but that's probably not possible. More than likely you're gonna need to do what Neijwiert said.

-TLS-DJ-EYE-K wrote on Mon, 18 March 2013 07:29

Instead of showing us that u aren't more inteligent than a Toast, maybe you should start becomming good in renegade Thumbs Up

Re: linking presets [message #486056 is a reply to message #486054] Thu, 13 February 2014 13:58 Go to previous messageGo to next message
Stallion is currently offline  Stallion
Messages: 222
Registered: April 2006
Karma: 0
Recruit
Neijwiert wrote on Thu, 13 February 2014 15:53

You mean like relative cordinates? You need to store the relative cordinates somewhere like: ChildObjPosition - ParentObjPosition and ChildObjRotation - ParentObjRotation. The child needs to be positioned when the parent is rotated with 0 degrees. Then whenever you move around/rotate the parent you need to recalculate the child position(s). The algorithms for this can be found on the internet.
Does not need to be related to c++, these problems occur at multiple places.

EDIT: with parent 0 rotation i mean like the default rotation of the thing...

EDIT #2: You can get the full translations of objects with Get_Transform, this returns a Matrix3D object which contains position and rotation. And you can apply that with Set_Transform



I thought it might end up that I need to do a custom script for it, so I'm installing the 2012 vs express, but I'm still very new to it, so is it possible for someone to give me an example script to start with?

edit: also, how would you do something like add a bandana or back packd to a soldier? (knowing this should give me an idea of my options)


Level edit is my play ground

[Updated on: Thu, 13 February 2014 14:01]

Report message to a moderator

Re: linking presets [message #486057 is a reply to message #486053] Thu, 13 February 2014 14:00 Go to previous messageGo to next message
Neijwiert is currently offline  Neijwiert
Messages: 124
Registered: October 2009
Karma: 0
Recruit
For starters: don't start with this... If you have no experience whatsoever it is far out of your how to range.

You should look into the scripts source and fine the readmexx.txt files. In there, there are several scripts documentated and what they do. Then look for that name in the actual source and see how they are scripted.

And you should take a gander in some calculus. These are common math problems and should be easially found. You just need to understand what's going on, then you can translate it to c++

EDIT: what do you need it for if I may ask?

[Updated on: Thu, 13 February 2014 14:02]

Report message to a moderator

Re: linking presets [message #486058 is a reply to message #486057] Thu, 13 February 2014 14:02 Go to previous messageGo to next message
Stallion is currently offline  Stallion
Messages: 222
Registered: April 2006
Karma: 0
Recruit
Neijwiert wrote on Thu, 13 February 2014 16:00

For starters: don't start with this... If you have no experience whatsoever it is far out of your how to range.

You should look into the scripts source and fine the readmexx.txt files. In there, there are several scripts documentated and what they do. Then look for that name in the actual source and see how they are scripted.

And you should take a gander in some calculus. These are common math problems and should be easially found. You just need to understand what's going on, then you can translate it to c++


Thanks for the tip, I'll look into it, but how would you do something like add a bandana or back packd to a soldier? (knowing this should give me an idea of my options)


Level edit is my play ground
Re: linking presets [message #486059 is a reply to message #486053] Thu, 13 February 2014 14:05 Go to previous messageGo to next message
Neijwiert is currently offline  Neijwiert
Messages: 124
Registered: October 2009
Karma: 0
Recruit
Use: Commands->Attach_Object_To_Bone (if i can remember it correctly its written like this). If you want it positioned correctly you probably need to make custom bones for models.

This is a feature in the ren engine that does what you need.

Basicly it attaches an object to a bone in the bone structure of a model. and whenever a translation is applied to that particular bone, then the object(s) attached to it will move along with the same relative translation.
Re: linking presets [message #486060 is a reply to message #486059] Thu, 13 February 2014 14:11 Go to previous messageGo to next message
Stallion is currently offline  Stallion
Messages: 222
Registered: April 2006
Karma: 0
Recruit
Neijwiert wrote on Thu, 13 February 2014 16:05

Use: Commands->Attach_Object_To_Bone (if i can remember it correctly its written like this). If you want it positioned correctly you probably need to make custom bones for models.

This is a feature in the ren engine that does what you need.

Basicly it attaches an object to a bone in the bone structure of a model. and whenever a translation is applied to that particular bone, then the object(s) attached to it will move along with the same relative translation.



Now this sounds more like what I was looking for, but is this level editor or gmax?


Level edit is my play ground

[Updated on: Thu, 13 February 2014 14:12]

Report message to a moderator

Re: linking presets [message #486061 is a reply to message #486053] Thu, 13 February 2014 14:13 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
Not sure what your trying to do but make your own leveledit script to do what you want.

Create_Preset_Object_Location, create a preset at an object's location and set facing.

void Create_Preset_Object_Location::Created(GameObject *obj)
{
	Vector3 Pos = Commands->Get_Position(obj);
	Pos.Z += 0.2f;
	const char *Preset = Get_Parameter("Preset");

	GameObject *o = Commands->Create_Object(Preset,Pos);
	Commands->Set_Facing(o,Commands->Get_Facing(obj));
}

ScriptRegistrant<Create_Preset_Object_Location> Create_Preset_Object_Location_Registrant("Create_Preset_Object_Location","Preset:string");


Manipulate the position X Y Z to move the object where you want


http://s18.postimage.org/jc6qbn4k9/bricks3.png

[Updated on: Thu, 13 February 2014 14:15]

Report message to a moderator

Re: linking presets [message #486062 is a reply to message #486061] Thu, 13 February 2014 14:19 Go to previous messageGo to next message
Stallion is currently offline  Stallion
Messages: 222
Registered: April 2006
Karma: 0
Recruit
Gen_Blacky wrote on Thu, 13 February 2014 16:13

Not sure what your trying to do but make your own leveledit script to do what you want.

Create_Preset_Object_Location, create a preset at an object's location and set facing.

void Create_Preset_Object_Location::Created(GameObject *obj)
{
	Vector3 Pos = Commands->Get_Position(obj);
	Pos.Z += 0.2f;
	const char *Preset = Get_Parameter("Preset");

	GameObject *o = Commands->Create_Object(Preset,Pos);
	Commands->Set_Facing(o,Commands->Get_Facing(obj));
}

ScriptRegistrant<Create_Preset_Object_Location> Create_Preset_Object_Location_Registrant("Create_Preset_Object_Location","Preset:string");


Manipulate the position X Y Z to move the object where you want


I didn't know you did scripts.

Can I talk to you on t.s. for a min about this?


Level edit is my play ground
Re: linking presets [message #486063 is a reply to message #486053] Thu, 13 February 2014 14:27 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
Sure ts.rencorner.com

http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: linking presets [message #486070 is a reply to message #486053] Thu, 13 February 2014 15:43 Go to previous message
Stallion is currently offline  Stallion
Messages: 222
Registered: April 2006
Karma: 0
Recruit
Thanks for the help blacky!

Level edit is my play ground
Previous Topic: Sidebar tutorial for Renegade modders
Next Topic: butterfingers crate
Goto Forum:
  


Current Time: Fri Nov 08 18:57:42 MST 2024

Total time taken to generate the page: 0.00911 seconds