Menu Selection, Sub-instance of Family’s (solved)

Get help using Construct 2

Post » Fri Feb 28, 2014 12:36 am

Hello, I have been working on this feature for the last week and have come a point where I do not know how to best proceed nor have I found what I need on the Forum/Manual.

The feature that I am working on is not too dissimilar to a Party Select menu where you would chose from a graphical menu the character that you wish for each slot. This case, a ship where you have a Captain, Gunner, Pilot etc. You will chose form a list who you wish where and I will also use this system for upgrades and weapon outfits.

Each character has stats such as proficiency in different fields. And in my first attempt I know I was going about it the wrong way as I was working on the Equipment and had it actually as an animation where I just selected the frame that I needed I had

[code]
Equipment Compare Frame #x & For each Equipment set to ItemX → Do action to Ship Stats
[endcode]

However that was time consuming and not really feasible as while I currently only have so many equipment items; for the crew the player will be pulling form a list of hundreds. Depending on who they have unlocked.

My next attempt was to use Instance Variables and a CSV[plugin] list to pull up the needed info. What I am going for is to get a textbox to state the information of a row by

[code]
Mouse Object Clicked “Officer Family” → Set Instance Variable “Captain” to _____
also
Every Tick Set Text to {CSV.At(str(CSV.CurRow), str(Text2.Captain))}

My CSV

NULL,NAME,STAT1,STAT2
1,Rex,10,4
2,Sue,8,6
3Ted,9,5

[endcode]

This to my understanding should set the textbox to display the row of the current value of “captain”. The trouble I am having is how to set the value by selecting the sprite portrait of the officer. Currently the sprites named Rex, Sue, and Ted are in a family called Officers. And for that _____ space I need to know what to do. I first tried using the UID and the IID (which allways returns 0) of the “Officer Family”

The UID works but the issue is that the numbers it returns are sporadic ie RexUID=3 while SueUID=12. And while I could go into my CSV file and set each instance of column one to the correct UID. With the list population potability totaling hundreds and the fact that the officers you can chose form will be imported form outside depending on who you currently have access to. I would want to try to find a more elegant solution.

I did note that in the debugger that each object in the tree under family had a UID numbering from 0+ and thought that I could use that but I cant seem to find why that will work. Also during my research I found this thread [https://www dot scirra.com/forum/viewtopic.php?t=63729&start=0]but unfortunately the solution provided does not appear to work for the current version of C2

I apologize for not including a .capx but I was having trouble finding time to make one that focused on the problem in general but I have tried to be as exact in my explanation as I could. If there is anything else I could add to help please let me know.

Thank you for your time

<><><>
Just a quick update as I managed to get this to work. My solution was to create a off screen Textbox called "MyShip" and in that I have added the instance variables of Captain, Pilot, etc. Now I am using this text object as a go between for my .csv and any textbox's that display info onscreen. for my .csv. It was essayist to use the UID for each instance of the Officers Family in my first column than having it ordered 0,1,2,etc. and now I can pick the sprite of any officer I want and have the go between Textbox MyShip{Set Captain @ CSV.At("NULL", str(Officers.UID)) } and all my boxes that reference Captain will update.

http: // i55.servimg.com/u/f55/13/83/53/12/scrria10.png

Next step is incorporating all the officers into a master list with all their art and learn how to call the url image of only the ones I want and order them. But that is a different topic for another day.
Last edited by CrazyVulcan on Tue Mar 04, 2014 1:45 am, edited 3 times in total.
"Were all mad here. I'm mad, your mad." "How do you know I'm mad?" Asked Alice. "You must be" Said the Cheshire Cat. "Or you wouldn't have come here"-Lewis Carroll: Adventures In Wonderland
B
7
S
2
Posts: 113
Reputation: 1,245

Post » Fri Feb 28, 2014 6:48 am

I'm pretty sure I have a solution for your problem since I also had problems with subfamilies etc. But unfortunately I don't understand your problem. Can you summarize what exactly you want to do? An example of the single steps would be very nice.
B
14
S
3
G
1
Posts: 255
Reputation: 2,027


Return to How do I....?

Who is online

Users browsing this forum: Syazanie Amirin and 6 guests