How do I use families correctly

Just started using Construct 2? Post your questions here

Post » Mon Oct 10, 2016 7:54 pm

Wow, better and better...

Now I need the entire week to understand all, and apply it to my project. Or should I start again from beginning ? I have succeeded in doing interesting things, like adding operational live bars for each active character, behaviors and animations not repeated, etc.

Anyway, thanks again for all your work, I'm pretty sure it will be usefull not only for me but for anyone.
B
7
S
2
G
1
Posts: 14
Reputation: 533

Post » Mon Oct 10, 2016 8:39 pm

ralf5543 wrote:Wow, better and better...

Now I need the entire week to understand all, and apply it to my project. Or should I start again from beginning ? I have succeeded in doing interesting things, like adding operational live bars for each active character, behaviors and animations not repeated, etc.

Anyway, thanks again for all your work, I'm pretty sure it will be usefull not only for me but for anyone.


The more the merrier. I figured you might have to restart your project but if you've already restarted once know that you can copy paste chunks of script form one project to another if you open them both. The key is to first copy the Variables, Families and Objects the chunks of script use, otherwise it won't work. Functions, token strings and arrays may be a bit difficult at first but believe me they are worth learning as soon as possible.
ImageImageImage
B
14
S
5
G
2
Posts: 22
Reputation: 2,048

Post » Tue Oct 11, 2016 2:16 pm

While I am at it, what would be the best solution to select from alernative images (like portraits) in the menu page, and not directly the characters ? Share some variables between chars and portraits ? Give a new animation for chars (a static one with a portrait) ? Someting else ?
B
7
S
2
G
1
Posts: 14
Reputation: 533

Post » Tue Oct 11, 2016 4:09 pm

Yes, something like that. Basically either make the portraits new objects but add them to the player family and name their Class variable the same as their corresponding actual players, or simply add new animations to each player to use only in the selection menu. The most correct way to do it would be to make a new portrait object that doesn't share the Player family and give it multiple animations for each class portrait. An object that really doesn't function at all like the Players but with the same variables and family may cause some head aches further on.

Then you can give it a text variable that stores the class just like the Player objects have. It can even be named Class as well. Then you replace the references to Player in this here segment with references to the new object like, instead of "On Click on Player", "On Click on Portrait" and then setting the second Array value to Portrait.Class instead of Player.Class.

Image
ImageImageImage
B
14
S
5
G
2
Posts: 22
Reputation: 2,048

Post » Wed Oct 12, 2016 8:04 pm

HI again,
I'm stuck at this point :
Image

If I add quotes to remove the error, of course it doesn't work :/
B
7
S
2
G
1
Posts: 14
Reputation: 533

Post » Tue Oct 18, 2016 11:47 am

Sorry, was away for a few days. This seems strange. You could do this:
Code: Select all
tokencount(str(Player.PressedKeys), " | ") - 1
The "str" turns whatever is in brackets into a text string but it's weird to have to use it because Player.PressedKeys is already a text string. Make sure you didn't accidentally set Player.PressedKeys to a number type variable but I think that's impossible. The problem may be that I set the default values of Player.PressedKeys to "-1", so maybe the event sees it as a number. You can also try changing that value to "a" or "start" by selecting the Player family and editing the variable. That way it starts with text.
ImageImageImage
B
14
S
5
G
2
Posts: 22
Reputation: 2,048

Post » Wed Oct 19, 2016 12:05 pm

You don't have to be sorry, you were already so helpfull.
I'll try this tonight.
B
7
S
2
G
1
Posts: 14
Reputation: 533

Post » Thu Oct 20, 2016 8:51 pm

RageByte wrote:Make sure you didn't accidentally set Player.PressedKeys to a number type variable

I did :/
Feel so stupid :)
B
7
S
2
G
1
Posts: 14
Reputation: 533

Post » Fri Oct 21, 2016 10:52 am

ralf5543 wrote:
RageByte wrote:Make sure you didn't accidentally set Player.PressedKeys to a number type variable

I did :/
Feel so stupid :)


Hehehe coding can do that to you. I was thinking it's impossible within my script because the variable was already assigned some text values and that makes Construct forbid you to change it's type but I forgot you were replicating a custom version of my script.
ImageImageImage
B
14
S
5
G
2
Posts: 22
Reputation: 2,048

Previous

Return to Beginner's Questions

Who is online

Users browsing this forum: brunopalermo and 3 guests