Hello, Im haveing trouble geting my code to work. these is for homework so im not giveing all of the problum so im still the one solveing the problum. The question i need asnerd is “is these code checking to see if IsLevelStart true if yes, set all actors of these class to fails then set these actor to true.” these is only ment to be run when you click the IsLevelStart True box to un mark all the other actors boxes if needed.
a few things:
is this firing at all? put a print string
at the start of your function, maybe printing out the current value of the isLevelStart
the first check you do an absolute compare against arbitrary true, but then in the for-each-loop you feed the bool directly into the branch/if these are interchangable, and doing the same thing, but consistency (even if the reader doesn’t like the convention) is easier to read, so please ‘pick one’
the logic you have posted:
*check if( this.isLevelStart == true)
- obtain all actors of type BP_Check_Point
- foreach(Actor)
-
- set this.isLevelStart = false
- set this.isLevelStart = true
*return
so lets say there are 3 of these BP_Check_Points in the level when this is fired off
- we will test
if(this.isLevelStart == true
(I will presume that the default value is true otherwise there is another issue we will get to later) - we grab all 3 of the instanced blueprints from the
World
- we set this.isLevelStart to false 3 times
- we exit the loop, and set this.isLevelStart to true
- we return
if you are going to have a return node in a function all exit paths of the functions should have a return node, or link into an existing one.
as this is homework what part of my above descriptions of this function do not match what you want to have happen.
continue reading for a hint
if unless the origin of a variable is specified (and all possibilities could be the same name) in programming the order goes like this:
- local variable to the current scope (in the function/event)
- member variable to the current object (often specified as
this.
orthis->
)- variable in global-scope (in Object Oriented Programming these should be avoided if possible)
most compilers will raise at least a warning if not an error if there are 2 variables with the same name, and others will assume based on the above order which ever comes first.
if you want to access a member variable of a specific object you need to specifically access that member variable from that object.
in your foreach the ArrayElement are these objects.
Thank you for the hind i will be back if i need another hint.