[Solved] This party menu will not update

Get help using Construct 2

Post » Tue Sep 13, 2016 7:10 pm

Ok ive got a party menu where it got one base bar for each party of 6 and there a variable control check all party member 1-6

and each of the text and sprite are created on top of Partybar in the image point. My problem is that the code to loop check through all of them and update them based on overlapping to the party bar because there is only 6 different party bar object. And to check each partybar's variable is not working and yet it works for the first index of the loop but it wont continue on the rest and I cannot for the love of god figure out ive tried every different instance pick option I've tried all the system loop.

And yes it must be in a for loop because there will be times when you will have only 2 to 5 party member at a time and i want it to quickly build a battle party menu and place the proper stats to be shown on it.

Image

Image

Image

Image

All the reference for the code to pull the data from is in the array as shown. I Know that its looping through but it wont update any of the others. I am baffle to why it wont. Ive tried everything. IF you are still confuse about a part please tell me cause this is needed to work for future project such as switch party member knowing what you have currently. And such.
Last edited by Gearworkdragon on Wed Sep 14, 2016 11:30 pm, edited 1 time in total.
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Tue Sep 13, 2016 9:37 pm

First thing that i think to notice is that you try to pick newly created objects before the next top-level-event. A function does not count as a new top-level-event.

I really think that you should use containers for this kind of stuff.

This 'overlap' solution is totaly not needed when using containers.

I dont know if you have more instances of the array 'party' ?

You should destroy them all, and then create only the pokemonback in a loop. When using containers, the others get auto created and picked. Then position them as you do in the first lines. Then (still in the same event and in the same loop) give them the values from the array. Dont use the function, because in the function you will have to pick them, which is impossible on that moment.

Drop the capx if you want me to do it.
B
33
S
18
G
27
Posts: 2,441
Reputation: 20,346

Post » Wed Sep 14, 2016 12:36 am

I haven't tried container and i couldn't understand how they worked.

What is this "pokemonback" you are referring to, Are you refering to the back ground of the pokemon bar ? if so there is only one and its just purly looks and contain value for positional Y value. I dont need that to be created multiple times. lol its the smaller bar that is being recreated 6 times, and no the array party is just one for all the member, Is that wrong way to do it? and its my only source of the character party so i cant just destroy it otherwise all the gameplay would just be gone.

And the game-play ( or least the battle part) is done with Party at the X=1. So that would break that since ....you know id would have to recode every thing in the attack.

Yeah i figure that by adding in the If the loopindex is equal to 5 it would at least give the new item created a chance to be referenced to when asking for the function to run ? I thought that would solve the top level ordering event at least what function were to be believed ? as in function to be treated as a call to start rather then wait to be called ? or is it the latter.

But yeah ill look into container and get a feel on them ? question is there a limit on container ?

Btw if you see on the create i have it set up to be perfectly X aligned with the first one and then multiplied with the Y coor so that it appear to be created down ward Ill do some tinkering but will that be affected by container or will it be auto placed where the image point on each ? Just Fyi the first one is alway on the screen for positional placement on the X coor at least. I really dont want to mess with that part.
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Wed Sep 14, 2016 1:33 am

you sir are a genius I never knew how powerful container can be with one event yeah container solved all my problem and its picking problem.
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Wed Sep 14, 2016 7:47 am

I am not ! Containers are just the max.

For the future. If you need to pick newly created objects. Do this easy littlle trick.
Give them a Instance Boolean 'JustCreated'.

Right after the creation action (or spawn) set the boolean to true.

A new top-level event.
Condition ... Sprite ...Is Boolean Instance Variable Set .... 'JustCreated'
(+ all the pick conditions you need)
Actions ... set 'JustCreated' to false ... and all the other actions you need
B
33
S
18
G
27
Posts: 2,441
Reputation: 20,346

Post » Wed Sep 14, 2016 3:10 pm

Is that a way to pick it out from the rest if using container cause there already an event that does on object created trigger ?
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Wed Sep 14, 2016 3:40 pm

No, it is an easy way to mark newly created instances and to pick them out of the not newly created instances, in the next top-event on the moment that they are available to pick.

If you use containers, picking one always picks the others.
B
33
S
18
G
27
Posts: 2,441
Reputation: 20,346


Return to How do I....?

Who is online

Users browsing this forum: ramyaswetha and 3 guests