How can you set a Z axis for CreateObject?
#1
Posté 19 novembre 2009 - 06:26
I am trying for learning purposes to stack two crates but instead it just overlaps them.
Anyone have a workaround or can you not do this with CreateObject and can only do it with a new created area?
#2
Posté 19 novembre 2009 - 07:54
#3
Posté 19 novembre 2009 - 08:06
#4
Posté 19 novembre 2009 - 08:16
My guess is also to use SetPosition(...) after you spawn the object.
#5
Posté 19 novembre 2009 - 08:27
Axe_Murderer wrote...
Have you tried using SetPosition?
Can you elaborate on this.? I am not a modder..or scripting by any means..I am doing tutorials and trying to learn that way.
I currently use Vector locations and CreateObject which has a Z setting in it..but the game seems to ignore the Z setting..I can put 500.0 there or pu 0 and it always sits on the ground.
Can't find any info on use for SetPosition...is there a GOOD toolset resource that actually has good info in it? I can never find anything..which is why I use tutorials for learning instead..
Modifié par NewYears1978, 19 novembre 2009 - 08:34 .
#6
Posté 19 novembre 2009 - 08:38
void main()
{
//Check whether we've added Joblo already.
if (WR_GetPlotFlag("joblos_quest", JOBLO_ADDED_TO_TOWN) == FALSE)
{
object oTown = GetObjectByTag("lot100ar_lothering"); //An area's tag is the same as its resource name
vector vJobloLocation = Vector(126.745f,120.724f,0.460568f); // See below for how to get these coordinates
CreateObject(
OBJECT_TYPE_CREATURE,
R"joblo.utc",
Location(oTown, vJobloLocation, 180.0f) //See below for how to get the value for orientation
)
WR_SetPlotFlag("joblos_quest", JOBLO_ADDED_TO_TOWN, TRUE);
}
}
Meh, I need to learn how to post code in this forum. Anways, it shows an example of creating an object and setting a Z value.
#7
Posté 19 novembre 2009 - 08:44
object oArea = GetObjectByTag("cam100ar_camp_plains");
location lCrate1Location = Location(oArea, Vector(186.0, 118.0, 0.0), -6.120553970);
CreateObject(OBJECT_TYPE_PLACEABLE, R"genip_crate_wood_large.utp", lCrate1Location);
Here is the snippet of my code...I will try to compare and see if there is a difference.
Notice in my lCrate1Location..there is a value for X, Y, Z and orientation. All work but Z is ignored (which is why I have 0 for the Z)
Edit--So upon comparing, if I change to this, it should work:
object oArea = GetObjectByTag("cam100ar_camp_plains");
vector vCrate1Location = Vector(186.0, 118.0, 0.0);
CreateObject(OBJECT_TYPE_PLACEABLE, R"genip_crate_wood_large.utp", Location(oArea, vCrate1Location, -6.120553970)
Modifié par NewYears1978, 19 novembre 2009 - 08:51 .
#8
Posté 19 novembre 2009 - 08:46
It would go something like:NewYears1978 wrote...
Axe_Murderer wrote...
Have you tried using SetPosition?
Can you elaborate on this.? I am not a modder..or scripting by any means..I am doing tutorials and trying to learn that way.
I currently use Vector locations and CreateObject which has a Z setting in it..but the game seems to ignore the Z setting..I can put 500.0 there or pu 0 and it always sits on the ground.
Can't find any info on use for SetPosition...is there a GOOD toolset resource that actually has good info in it? I can never find anything..which is why I use tutorials for learning instead..
[dascript]
SetPosition( CreateObject( ... ), Vector( x, y, z ), FALSE );
[/dascript]
or, if you like using lots of variables:
[dascript]
float x = 186.0;
float y = 118.0;
float z = 0.0;
vector vCratePosition = Vector( x, y, z );
object oCrate = CreateObject( ... );
SetPosition( oCrate, vCratePosition, FALSE );
[/dascript]
Modifié par Axe_Murderer, 19 novembre 2009 - 08:55 .
#9
Posté 19 novembre 2009 - 08:48
Would be worth the try.
#10
Posté 19 novembre 2009 - 08:51
#11
Posté 19 novembre 2009 - 08:55
#12
Posté 19 novembre 2009 - 08:58
Modifié par Axe_Murderer, 19 novembre 2009 - 08:59 .
#13
Posté 19 novembre 2009 - 09:18
object oArea = GetObjectByTag("cam100ar_camp_plains");
vector vCrate1Location = Vector(186.0, 118.0, 5.0);
CreateObject(OBJECT_TYPE_PLACEABLE, R"genip_crate_wood_large.utp", Location(oArea, vCrate1Location, -6.120553970)
And basically, it just did the same thing as what I had (still ignoring the Z value)
So I will try Setlocation now..if I can figure it out..not quite sure how to do it..
#14
Posté 19 novembre 2009 - 09:23
object oArea = GetObjectByTag( "cam100ar_camp_plains" );
vector vCrate1Position = Vector( 186.0, 118.0, 5.0 );
location lCrate1Location = Location( oArea, vCrate1Position, -6.120553970 );
object oCrate = CreateObject( OBJECT_TYPE_PLACEABLE, R"genip_crate_wood_large.utp", lCrate1Location );
SetPosition( oCrate, vCrate1Position, FALSE );
[/dascript]
Modifié par Axe_Murderer, 19 novembre 2009 - 09:32 .
#15
Posté 19 novembre 2009 - 09:33
CreateObject(OBJECT_TYPE_PLACEABLE, R"genip_crate_wood_large.utp", lCrate3Location);
SetPosition( CreateObject(OBJECT_TYPE_PLACEABLE, R"genip_crate_wood_large.utp", lCrate3Location), Vector(184.955,117.615,100.0), FALSE);
Edit:
I saw your above post after I posted this, I was trying to do it without all the variables as you mentioned...
Modifié par NewYears1978, 19 novembre 2009 - 09:34 .
#16
Posté 19 novembre 2009 - 09:43
Axe_Murderer wrote...
[dascript]
object oArea = GetObjectByTag( "cam100ar_camp_plains" );
vector vCrate1Position = Vector( 186.0, 118.0, 5.0 );
location lCrate1Location = Location( oArea, vCrate1Position, -6.120553970 );
object oCrate = CreateObject( OBJECT_TYPE_PLACEABLE, R"genip_crate_wood_large.utp", lCrate1Location );
SetPosition( oCrate, vCrate1Position, FALSE );
[/dascript]
This worked, thanks a million
#17
Posté 19 novembre 2009 - 10:28
(not a modder, obviously)
#18
Posté 19 novembre 2009 - 11:29
#19
Posté 19 novembre 2009 - 11:44
[dascript]
object CreateObjectIn3DSpace( int nObjectType, resource rTemplate, location lLoc, string sOverrideScript = "",
int bSpawnActive = TRUE, int bNoPermDeath = FALSE )
{ object oNewObject = CreateObject( nObjectType, rTemplate, lLoc, sOverrideScript, bSpawnActive, bNoPermDeath );
if( !IsObjectValid( oNewObject ) ) return OBJECT_INVALID;
SetPosition( oNewObject, GetPositionFromLocation( lLoc), FALSE );
return oNewObject;
}
[/dascript]
Modifié par Axe_Murderer, 19 novembre 2009 - 11:48 .
#20
Posté 20 novembre 2009 - 07:00
Currently it uses only the angle...how can you use the 3 coord orientation?





Retour en haut







