playMaker

Author Topic: how to adapt a texture from a variable [SOLVED]  (Read 3279 times)

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
how to adapt a texture from a variable [SOLVED]
« on: March 11, 2013, 03:29:27 PM »
next step of my training series,

i would like to use a variable stored to make choice of texture

traditionnaly:

if variable == 1, apply texture 1
if variable == 2, apply texture 2
else apply texture 0
etc...
« Last Edit: March 12, 2013, 09:17:55 AM by blackant »

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: how to adapt a texture from a variable
« Reply #1 on: March 11, 2013, 03:53:32 PM »
try jeanfabre's ArrayMaker plugin. It supports arrays of textures. Then you can just use your variable as an index.
Other than that there's only the manual way, with one state that checks the int with some "int compare" actions and then fires a lot of different events accordingly.
A third solution (EDIT : contradicting to what I said before, I know :D) would be to write a dedicated action for this. Something like "Select random string" with textures instead of strings and a public int for the index would probably do nicest.
If you wanna do the third but somehow don't get along with PlayMaker(mind you, it's really not well documented), then just ask and I'll fix you up a version.
I just thought you might want to try such stuff on your own since writing your own actions is a very important step towards using PlayMaker to its full extend :)
Best,
Sven

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Re: how to adapt a texture from a variable
« Reply #2 on: March 11, 2013, 04:01:55 PM »
thanks for your answer,
yeah i try to find many things by myself but after many hours locked this little things i must ask, i know ...:p

other thing i successed don't need to be asked and with time i can do things that i'm not able to script !
playmaker is very very nice with some trains !

anyway i didn't understand anything about your third solution...lol
maybe my english or maybe more skills in programming...
i'll try to do this with arraymaker at first.

see you soon!

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: how to adapt a texture from a variable
« Reply #3 on: March 11, 2013, 04:10:50 PM »
All done.

There are several ways to do it. This is only one.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Re: how to adapt a texture from a variable
« Reply #4 on: March 12, 2013, 06:24:13 AM »
thanks Lane,  i didn't sse that you shared a package, i'll look it to see if it's different from what i fund.

blackant

  • Hero Member
  • *****
  • Posts: 521
  • http://blackantmaster.com
    • blackantmaster.com
Re: how to adapt a texture from a variable
« Reply #5 on: March 12, 2013, 08:39:44 AM »
finally i didn't use any Int var and i made a tutorial using arraymaker

see this post:
http://hutonggames.com/playmakerforum/index.php?topic=3364.0

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: how to adapt a texture from a variable
« Reply #6 on: March 12, 2013, 08:43:21 AM »
Awesome! I'm glad you got what you needed done, and thanks for posting up a tutorial to share your findings.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D