Access Specific Family Member Instance Variables

Get help using Construct 2

Post » Mon Jul 29, 2013 6:30 pm



Brief summary:
NPCTalk is a global variable set at 0 default.
Talk1, Talk2, Talk3 are family instance variables that contain the text said NPC is to speak.
TalkNum is a family instance variable that contains how many times the NPC is to talk.

The idea is, player presses action key to talk to NPC.
NPC talks and NPCTalk = 1
If player presses another key, either:
1) Stop talking if NPC TalkNum is 1
2) Continue talking if NPC TalkNum is 2.

It works until Keyboard->On any key pressed
*-> If NPCs Talk Num = 1 then blah
*-> Else -> Trigger Once then type Talk2.

The NPC I'm trying to talk to has TalkNum set to 2 and is meant to talk twice. But he isn't. It will talk once and is definitely breaking into the If NPCs Talk Num = 1 branch. It never goes into the Else. Its not accessing the proper NPC family member that has TalkNum set to 2.

Any solution for this? Am I missing something? I clearly have it so NPCs is being accessed by collision. It should only be referencing the NPC with TalkNum set to 2.
B
10
S
3
G
3
Posts: 47
Reputation: 2,666

Post » Mon Jul 29, 2013 7:00 pm

Answered my own question.
Turns out that I needed to add Wait 1.0 second commands inbetween every NPCTalk add 1 event. What was happening was when you hit a key, it would execute everything at the same time, cascading down the events. I sometimes forget that these events execute in fractions of a second, and no one presses/releases keys that fast.
B
10
S
3
G
3
Posts: 47
Reputation: 2,666


Return to How do I....?

Who is online

Users browsing this forum: FabianB, Vodakman, Wolod and 11 guests