The Daily Click ::. Forums ::. Klik Coding Help ::. Fastoops problem with my inventory using an array
 

Post Reply  Post Oekaki 
 

Posted By Message

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
20th September, 2009 at 20:15:13 -

Hi guys, I have a weird one today. I'm trying to use 8 of the same active objects to display my game's inventory pictures and an array like this-

Array(1) = 2
Array(2) = 0
Array(3) = 1
etc.

And then I want to use fastloops to go through all 8 active objects and compare the array values and assign that active's animation to whatever it should be. Ex. if array X slot 1 = 0 then make it blank, if it's = 1 make it a dagger, if it's = 2 make it a potion, etc.

Anyhow I thought I did this correct but it doesn't work at all. I have something like this-


Always -> Spread 0 in Alt Val A "ID" in Active Object "Inventory Picture"
Always -> Start Loop "Drawstuff" 8 times

On Loop "Drawstuff"
+ LoopIndex "Drawstuff" = Active Object "Inventory Picture" Alt Val A "ID"
+ Array(LoopIndex "Drawstuff") = 0
-> Set Active Object "Inventory Picture" animation to "Blank"

On Loop "Drawstuff"
+ LoopIndex "Drawstuff" = Active Object "Inventory Picture" Alt Val A "ID"
+ Array(LoopIndex "Drawstuff") = 1
-> Set Active Object "Inventory Picture" animation to "Dagger"

On Loop "Drawstuff"
+ LoopIndex "Drawstuff" = Active Object "Inventory Picture" Alt Val A "ID"
+ Array(LoopIndex "Drawstuff") = 2
-> Set Active Object "Inventory Picture" animation to "Potion"



So if this were to work right, the array values:

Array(1) = 2
Array(2) = 0
Array(3) = 1

Should set the 1st inventory active object to a potion, the 2nd one to blank, and the 3rd should be a dagger. This was kind of hard to type out what I mean, but does anyone know what I'm doing wrong? I've tried messing around with the code but so far I haven't had any luck.

Thanks a lot!

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
20th September, 2009 at 21:10:47 -

Oh I m using for a lot of stuff this type of code.

First:
Your condition in loop must be
Compare alt value of active to loopindex. "Dont compare two generals but compare alt to value"

Its because when you compare loopindex to active it only picks one of the actives to compare with, and when u set compare alt to value, it goes throught all actives to see which one has the same id as the loop.

And i am not sure but i think always spreading value might also be messing it up.

Oh and be sure to use loop animations.

Oh and by the way, its better to use only one event for this, you just then need.

Active ID = loopindex

Active: set animation to current position of array


Edited by Don Luciano

 
Code me a sausage!

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
21st September, 2009 at 00:25:54 -

Hmmm, very interesting Don. I do have all the animations looped and I think one time I did make the alt value equal to the loopindex first but I can't remember right now. I'll take out that spread value always thing to and see what happens.

Thanks a lot, hopefully I'll have good news to report in the morning.

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!
   

Post Reply



 



Advertisement

Worth A Click