For some reason, one of the steps of my easter egg does not work in co-op but it works fine in solo.
This step involves hitting buttons in a certain order. Basically what it does in co-op is, when someone hits a button it acts like you activated it twice.
It comes up "Button is incorrect", or "button is correct" 2 times, thought that was just a print bug, but then when I go to activate the second button it says its incorrect, when it isnt.
It works just fine on solo. When I activate a button, it says it is incorrect or correct one time, and I can continue on from there.
This shouldn't be happening. ??? Try printing the level.number_correct after self endon("button_hit"); to see if the function is being called twice and then add some different prints inside the if's. Also, I wouldn't thread the check_for_correct_button(); function and I'm pretty sure you can simplify it to do just one check for all the numbers. Maybe having the function like this causes problems and if you simplify it, it will work. Don't know.
Also, I wouldn't thread the check_for_correct_button(); function and I'm pretty sure you can simplify it to do just one check for all the numbers. Maybe having the function like this causes problems and if you simplify it, it will work. Don't know.
Yeah, it shouldn't be threaded. Really an array should be used here as the logic is the same up until the last trigger:
Also what is the difference between threading and not threading? and how can you tell when to thread a function and when not to thread a function.
If you thread you call the function but the code continues. If you don't thread it, the code will stop there until the function ends or return something. So for example:
I think it's better not to thread unless you want something to run at the same time, like call the same function on multiple ents at the same time or when you want a function to be active during some time with a while loop (play a sound every x seconds or something), for example.
Also what is the difference between threading and not threading? and how can you tell when to thread a function and when not to thread a function.
Not sure what the big fancy definition is for it, but its basically a new independent thought process. Any function called without threading must be complete before the parent function can continue whatever it was doing. If you thread a function, the parent function can continue to do whatever it would normally had to wait for if it wasn't threaded.
Kinda hard to explain in words. Basically this:
Code Snippet
Plaintext
parent_function() { function_one();
// function two and three won't run until function one is complete.
You would never do this if you needed a function to return a value as the parent function needs whatever the child function returns. Returning a threaded function IS NOT the same as returning on a non threaded function. Returning on a threaded function will just kill the function. You also should never thread anything pre _load as there is an extremely small delay when threading each function.
Quote
Just tried it on Solo, and its doing the same thing it was doing on co-op. Activating the button twice instead of only once
I don't see how that's possible unless your hitting the use button twice. What happens if you print the current trigger, like this:
I am only hitting the use button once, and when I add that println line. It prints whatever the script_noteworthy is on the trigger. ie. If I hit button 5, it prints 5, 6 prints 6. so on and so on.
I also dont know if this will work, since they need to hit it in a specific order, that changes every game. Not completely random though, there is 5 different sets of numbers that it could be.
Because with this, no matter what order they hit it in it will still come up Correct.
Like if the order is 5 3 1 4 8. If they try and hit 4 as the first number, it will still say it is correct, when it should be 5.
I skimmed the comments and I apologize if any of this was mentioned, but I didn't notice it.
What is activate_buttons() thread or called on or from? If it were thread on each player you may see it print twice for 2 player, and 3 for three player. It would just be called though in mapname.gsc, or somewhere, and not done on each player, but I wanted to make sure.
Also ,after your waittill trigger (which would do it on single player too if it were the issue), you don't have a wait that stops it from spamming. I would recommend at least this:
self SetCursorHint("HINT_NOICON"); while(1) { self waittill("trigger",player); while(player UseButtonPressed()) wait(.1);//added to wait until they stop pressing used button self thread check_for_correct_button(); } }
I would agree that using level.number1 and so on is much more difficult to maintain and use than an array but see that you are trying to do something specific so I would still work with an array after that then, like suggested. Assuming you assign the level.number1, and so on, somewhere else before this script runs, I would recommend daedras modifications but with maybe something like this: (modified check_for_correct_button and new function to delete trigs)