Jump to content

Recommended Posts

Posted

Have a few unreal script questions and an assignment due soon so any help would be greatly appreciated.

First thing I am trying to do is give a vector the location of where an actor spawns and then give it a slight offset and can't for the life of me work out how. I am then using the vector to spawn another actor into the world at that location but it needs a slight offset value so its not in the excast same position. As the actor is placed in the editor It needs to work that out after it has spawned if you get what I mean and then add an offset.

Tried a few things including:


function SpawnAmmo(Vector SpawnLocation)

{

	//BoxOneLOf = SpawnLocation * BoxOneL;


	Spawn(class 'TheBlueBoxLinkgunPack',,,SpawnLocation + SpawnOfSet);

}

With out much luck. ------------------------- Second I am having a hard time working
StaticMeshComponent.SetMaterial();

change the material of a mesh when called in other words

Don't know if anyone has had experience with it but its looking for the values "int Element Index, Material Interface Material" and I can't really find any documentation explaining how to set it up .

Cheers! :P

Posted

Example, if you want to calculate a point ahead of the player :

Pawn.Location + (vector(pawn.rotation) * distance)
But in your case :
SpawnLocation = vect(0,0,0) //for example

 SpawnOfSet = vect(0,0,32)


Spawn(class 'TheBlueBoxLinkgunPack',,,SpawnLocation + SpawnOfSet);
I don't know very well the spawn command, but normaly there is no problem, do you get a specific error ? ---
var MaterialInstanceConstant matInst;


matInst = new(None) Class'MaterialInstanceConstant';

matInst.SetParent(StaticMeshComponent.GetMaterial(0));

StaticMeshComponent.SetMaterial(0, matInst);

Example with a material instance, I guess it will work in the same way for a classic material.

Posted

Example, if you want to calculate a point ahead of the player :

Pawn.Location + (vector(pawn.rotation) * distance)
But in your case :
SpawnLocation = vect(0,0,0) //for example

 SpawnOfSet = vect(0,0,32)


Spawn(class 'TheBlueBoxLinkgunPack',,,SpawnLocation + SpawnOfSet);

I don't know very well the spawn command, but normaly there is no problem, do you get a specific error ?

Example with a material instance, I guess it will work in the same way for a classic material.

cheers Froyok

What I have "works" but its getting it to know where the actor is in the world, the spawn defaults it to that location to start with but then there is no way to OfSet it. I think I am making things a bit complex for my self though. Cheers for the stuff on materials hope to get that working today.

Posted

What I have "works" but its getting it to know where the actor is in the world, the spawn defaults it to that location to start with but then there is no way to OfSet it.

I don't get it, why can't you offset it ? Since you offset his spawn location at start, you already know his true location.

Posted

What I have "works" but its getting it to know where the actor is in the world, the spawn defaults it to that location to start with but then there is no way to OfSet it.

I don't get it, why can't you offset it ? Since you offset his spawn location at start, you already know his true location.

If you leave the spawn location blank it defaults to the location of the actor that called its spawn but if you offset you also have to sent a location you are pretty much just adding to the value.

Can prob live with it as long as I get everything else sorted :lol:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...