Jump to content
Dusty1Actual

Help needed randomizing Textures for shooting range

Recommended Posts

Hi there, Im in the middle of making a custom shooting range.

Im using this in the init of the "One meter User Texture" and im putting that over the "Target" objects :
this setObjectTexture [0, "target.jpg"]

 

Would there possibly be a way to randomize that texture to be one of say 6 jpeg files in the mission folder? My idea is to have a trigger set so that whenever it is activated, the textures on the targets change randomly. For example, the mission file would have multiple jpegs marked out as "target1.jpeg" "target2.jpeg" "hostage.jpeg" "target3.jpeg" and when the mission starts, each target randomly selects a jpeg to show.
Help would be greatly appreciated.

  • Like 1

Share this post


Link to post
Share on other sites

_textureArray = ["target1.jpeg","target2.jpeg","target3.jpeg"];

this setObjectTexture [0, selectRandom _textureArray ];

 

^that in the init-field of your targets and a slightly modified form of that (replace 'this' with the objects varname) in your trigger.

Share this post


Link to post
Share on other sites
30 minutes ago, stanhope said:

_textureArray = ["target1.jpeg","target2.jpeg","target3.jpeg"];

this setObjectTexture [0, selectRandom _textureArray ];

 

^that in the init-field of your targets and a slightly modified form of that (replace 'this' with the objects varname) in your trigger.

Thanks a whole bunch, will be trying this as soon as i gt back on!

Share this post


Link to post
Share on other sites
48 minutes ago, stanhope said:

_textureArray = ["target1.jpeg","target2.jpeg","target3.jpeg"];

this setObjectTexture [0, selectRandom _textureArray ];

 

^that in the init-field of your targets and a slightly modified form of that (replace 'this' with the objects varname) in your trigger.

I've come up with an issue where on mission start a pop up states that "target2.jpeg" was not found, Though I am sure it is in the mission folder where all the others are, none of them seem to work with the random script.

Share this post


Link to post
Share on other sites
58 minutes ago, Dusty1Actual said:

"target1.jpeg"

 

JPEG image (.jpg)

 

Hello there guys !

 

sorry but check above the extension of the file.

 

It' s always better to use (in game) the .paa format images

textview2

https://community.bistudio.com/wiki/Arma_3_Tools_Installation

Share this post


Link to post
Share on other sites
1 minute ago, Dusty1Actual said:

"target2.jpeg" was not found,

check above

Share this post


Link to post
Share on other sites
6 minutes ago, GEORGE FLOROS GR said:

 

JPEG image (.jpg)

 

Hello there guys !

 

sorry but check above the extension of the file.

 

It' s always better to use (in game) the .paa format images

textview2

https://community.bistudio.com/wiki/Arma_3_Tools_Installation

Ahh! Brilliant, haha thank you! it works now, Will be crediting You both if i ever release this! Cheers!

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×