Secret items Part 2(sorry)

Thanks to @CodeAlpaca I learned how to do global so that secret items could work!(Thanks) But how do I make it so you have to finish the level to keep it? I did some tests and none of it works, maybe I’m a little wrong in what I did?


Some one want to tell me what’s wrong with the code?

1 Like

I’m guessing this is because the next level is triggering the “levels done” global after it is changing the level, the object is already gone and its behaviours stop.

Try adding a 0.1 second timer that triggers the next level AFTER the global has been updated.

Also, you don’t need the always, the globals auto update anyway

I gave it a 0.2 second timer but in the end nothing goes through the switch for some reason, maybe the switch is the wrong way to go?

1 Like

Still have no clue how, just won’t work, any ideas? Maybe a possible example?

can you give a game link? This is much easier for me than to make an entire example

Idk how ur doing the next level thing, but whatever is triggering that, make it update the global FIRST then next level 0.1 after.

here you go, object called Level end, it’s a blue crystal, try not to spoil too much for your self if you plan to play whole game.


the filter needed to be set to

“equal to 1”

because 1 is not greater than 1. It was the first level.

But it’s the second level, huh, ok I guess, I’ll test, if it truly works I’ll give you solution.

1 Like

It still doesn’t work

1 Like

Here, code in end of level crystal:

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":1,"name":"Collision","behaviorType":"logic.triggers.Collision","x":-360,"y":-344,"group":"","id":"8ce49390b5bcce45","targetClassId":17757175,"targetEntityId":0,"collisionFilter":15,"collideWithEntity":false,"delay":3},{"inputCount":2,"outputCount":2,"name":"LoadLevel","behaviorType":"logic.gameflow.NextLevel","x":0,"y":-384,"group":"","id":"b54d32fb88978e4b","levelId":-2},{"inputCount":1,"outputCount":0,"name":"Message","behaviorType":"logic.components.Message","x":-180,"y":-280,"group":"","id":"b54d419eb75ff940","msg":"GetHelmet","route":"SendToSelected","targetClassId":17777182},{"delay":1,"count":1,"version":2,"inputCount":3,"outputCount":1,"name":"Timer","behaviorType":"logic.triggers.Timer","x":-180,"y":-384,"group":"","id":"b54d8f258c4d7e4e"}],"links":[{"input_id":"b54d8f258c4d7e4ei0","output_id":"8ce49390b5bcce45o0"},{"input_id":"b54d419eb75ff940i0","output_id":"8ce49390b5bcce45o0"},{"input_id":"b54d32fb88978e4bi0","output_id":"b54d8f258c4d7e4eo0"},{"input_id":"b54d419eb75ff940i0","output_id":"8ce49390b5bcce45o0"},{"input_id":"b54d8f258c4d7e4ei0","output_id":"8ce49390b5bcce45o0"},{"input_id":"b54d32fb88978e4bi0","output_id":"b54d8f258c4d7e4eo0"}]}}}

Code in Helmet:

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":1,"name":"Collision","behaviorType":"logic.triggers.Collision","x":-1350,"y":-744,"group":"","id":"968edc47c3bbd949","targetClassId":17757175,"targetEntityId":0,"collisionFilter":15,"collideWithEntity":false,"delay":0},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":-810,"y":-648,"group":"","id":"a662e4fbebe17b4e","tag":"Helmet?:Number","version":2,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-990,"y":-648,"group":"","id":"a76fbf66365b2441","startVal":1,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":-1170,"y":-656,"group":"","id":"afa2095806e39b40","_startVal":0,"dataType":2},{"inputCount":0,"outputCount":1,"name":"Mailbox","behaviorType":"logic.components.Mailbox","x":-1350,"y":-616,"group":"","id":"b54edc6faf070549","msg":"GetHelmet"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-1170,"y":-752,"group":"","id":"b5562e7cfe4a2a44","startVal":0,"roundMode":1},{"inputCount":1,"outputCount":1,"name":"Alpha","behaviorType":"logic.properties.Alpha","x":-990,"y":-744,"group":"","id":"b55642b03cefd944"},{"inputCount":2,"outputCount":2,"name":"Enabled","behaviorType":"logic.properties.Enabled","x":-990,"y":-824,"group":"","id":"b5566af376de314b"}],"links":[{"input_id":"b5562e7cfe4a2a44i1","output_id":"968edc47c3bbd949o0"},{"input_id":"afa2095806e39b40i1","output_id":"968edc47c3bbd949o0"},{"input_id":"a662e4fbebe17b4ei2","output_id":"a76fbf66365b2441o0"},{"input_id":"a76fbf66365b2441i1","output_id":"afa2095806e39b40o0"},{"input_id":"a662e4fbebe17b4ei2","output_id":"a76fbf66365b2441o0"},{"input_id":"afa2095806e39b40i1","output_id":"968edc47c3bbd949o0"},{"input_id":"afa2095806e39b40i2","output_id":"b54edc6faf070549o0"},{"input_id":"a76fbf66365b2441i1","output_id":"afa2095806e39b40o0"},{"input_id":"afa2095806e39b40i2","output_id":"b54edc6faf070549o0"},{"input_id":"b5562e7cfe4a2a44i1","output_id":"968edc47c3bbd949o0"},{"input_id":"b5566af376de314bi1","output_id":"b5562e7cfe4a2a44o0"},{"input_id":"b55642b03cefd944i0","output_id":"b5562e7cfe4a2a44o0"},{"input_id":"b55642b03cefd944i0","output_id":"b5562e7cfe4a2a44o0"},{"input_id":"b5566af376de314bi1","output_id":"b5562e7cfe4a2a44o0"}]}}}

The problem was that the object was being destroyed before it could get the global or the message. I also changed the global, the global was replaced by a message, it is simpler.

1 Like

Real quick could you explain what the alpha and enabled do in the helmet code?

1 Like

yes, the alpha turns the object invisible, and the enabled turns it’s hitbox off.

This way the object is still in the game, but is not visible and doesn’t have a hitbox.

Does this work for you?

1 Like

Still putting in code and cool!

It works!!! TY!!!

1 Like

np, sorry for makin it confusing and wrong the first time

1 Like