nimos100 just tell the game to wait 1*dt seconds or 0.016 seconds, both are just 1 (ONE) tick worth of waiting. Don't know any human on this planet that can be bothered of having to wait 1/60 of a second for something. do you? xD
Yes me
Just kidding , I agree the problem is not really the wait in it self even if you use a wait of 0.1 its equal to 6 ticks if im not mistaken, so its hardly noticeable, so its not really a problem. The problem is that wait in it self even If it only have a duration of 1 tick can cause problems that can screw up things.
Here is an example:
[quote:2lh8k2e3]Repeat 10 times
------- Call function("Spawn enemy")
Function Spawn enemy
Create enemy()
Call function ("initialize enemy")
Function Initialize enemy
Call function ("Create enemy weapon")
Function Create enemy weapon
Create Enemy_weapon
Then suddenly things starts to go wrong as I see it.
Because now there are actually two objects that doesn't exist yet, The Enemy and the Weapon that you want it to use. So if you throw in a Wait different places to solve it, It might work. However at the very start we are actually repeating this 10 times, to create 10 enemies which will then create 10 different weapons, so suddenly you might have 20 objects that actually doesn't exist, and then it seems to go wrong. Whether that's completely true im not 100% sure about, but it seems that a function doesn't count as a top level, which I find to be logic if its the case, but I haven't seen anything saying that it ain't which is why im not certain.
I solved this by implementing an object handler which I use every time you would otherwise use a wait. This completely replaces the need for using waits, except for this problem with behaviours because it runs after all "Events" so in that case it cant solve it. But since I didn't knew that was how C2 handles behaviours, I thought my object handler could just fix it as well, but now that I know how C2 handles behaviours it makes perfect sense that it doesn't work with them. But since I made a work around for that as well, I can or should just be able to do that if I have problems with behaviours again, but I haven't actually had any problems with them except for the pin one, so doubt it will be a huge problem.