[r100/101] can't pick object

Bugs will be moved here once resolved.

Post » Sun Sep 09, 2012 9:55 pm

@countofquad - your outline is correct, it will trigger 'on created' during the 'create object' action and the trigger finishes before it moves on to the next action. The 'On created' event does not affect the other event's SOL at all. Events in Construct 2 pick in isolation and it is not possible for one event to change another event's picked instances.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Mon Sep 10, 2012 1:32 am

@Ashley, thanks for clearing that up.

The problem with potentially using on OnCreated trigger is that I already have a OnCreated Family trigger that handles normal creation of Object A and Object B (both of which belong to this family). When one of those objects is created in a subevent, I need to set up specific variables up in Object A and Object B to certain values.

Okay, I have an possible solution. I could create some global variables, such as:
CreatedBy, Var1_Value, Var2_Value

Then in code:
Line 01 : EVENT 1
Line 02 : -- Sub Event A
Line 03 : -- -- CreatedBy = "SubEventA";
Line 04 : -- -- Var1_Value = "ObjA_CustomValue1";
Line 05 : -- -- Var2_Value = "ObjA_CustomValue2";
Line 06 : -- -- Create Object A
Line 07 : -- -- -- Do some stuff
Line 08 : -- -- Var1_Value = "ObjB_CustomValue1";
Line 09 : -- -- Var2_Value = "ObjB_CustomValue2";
Line 10 : -- -- Create Object B
Line 11 : -- -- -- Do some stuff
Line 12 : -- -- CreatedBy = "";

Line 100: On Family Created Trigger
Line 101: -- if CreatedBy === 'SubEventA'
Line 102: -- -- Family.Var1 == Var1_Value
Line 103: -- -- Family.Var2 == Var2_Value
Line 104: -- else
Line 105: -- -- // Normal initialization for Family properties

Does that seem like a good solution?
B
4
Posts: 10
Reputation: 320

Post » Mon Sep 10, 2012 1:56 pm

Yeah, that looks like it would work fine.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Previous

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest