News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu

Simple moving platform script...

Started by douglas quaid, December 17, 2015, 09:16:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

The Happy Friar

Looks like that loop is stopping the game from going to the platform_2 function.

I changed them to threads (add "thread" before "platform_1" & 2) and then it works.

You can remove that sys.wait(0.001).  That's so small it won't matter.

Phrozo

EDIT: THF beat me to it ;P

The main thread for the map script is still running platform_1 (), but it never stops because it contains a while loop that runs forever. This means platform_2() will never get called.

The solution is to thread those functions so they can continue looping without locking the main thread. All you have to do is change the main function to this:

void main ()
{
// Call Moving Platform 1 to function
thread platform_1 ();

// Call Moving Platform 2 to function
thread platform_2 ();
}

The Happy Friar

Using an in game trigger would also be another way to solve this.

douglas quaid

Ah that's great guys, thanks. Working well now. Thanks again.
TOTAL RECALL - Singleplayer mod for Doom 3 starring Arnold Schwarzenegger
BLACKOUT - Free indie horror game based on the id Tech 4 engine