Modme Forums

Player Has Limited time to Activate Trigger

Game Modding | Call of Duty: Black Ops 3 | Scripting


Fanatic:

I think it would have to do with "IF/ELSE" Scripting, but I am fairly new to it and don't fully know how it works.

But basically, I am looking to have the Players have a limited amount of time to Find a Part/Activate a Trigger, otherwise they will get teleported away.

(Similar to The Frozen Dawn Perkaholic Easter Egg)


Sleepy216:

I'm not a scripting expert, so my method isn't the best, but there are a few ways to do it.
I don't know how to do the block code thing on a forum so i won't just write the whole thing out.
You can make a timer that counts down/up, and put the trigger waittill(" trigger", player) in a while loop that runs only until the timer hits your time limit.
so instead of doing:
while(1)
{
your code here;
}
you can do:
while(level.timer_count <= level.yourmaxtime) //you don't have to make them "level." if you pass the same variable to this function plus to your countdown/up function.
{
your code here;
)
then make another function the just counts your level.timer_count up until it reaches level.yourmaxtime. you can add an endon to the top of the counting function that stops the function whenever the player hits the trigger before the clock finishes. also you will need to define both level.timer_count and level.yourmaxtime(these can be named anything, these are just the names I chose) in the main part of your script before threading the other two functions.
if you wanted to go the extra step you could add a switch(or another if/else) check after the loop breaks to see if the player passed or failed, and do whatever you want after each of them. You could also just add the same endon to that script so it will stop the function and not play what is after the loop breaks.


Fanatic:

I'm not a scripting expert, so my method isn't the best, but there are a few ways to do it.
I don't know how to do the block code thing on a forum so i won't just write the whole thing out.
You can make a timer that counts down/up, and put the trigger waittill(" trigger", player) in a while loop that runs only until the timer hits your time limit.
so instead of doing:
while(1)
{
your code here;
}
you can do:
while(level.timer_count <= level.yourmaxtime) //you don't have to make them "level." if you pass the same variable to this function plus to your countdown/up function.
{
your code here;
)
then make another function the just counts your level.timer_count up until it reaches level.yourmaxtime. you can add an endon to the top of the counting function that stops the function whenever the player hits the trigger before the clock finishes. also you will need to define both level.timer_count and level.yourmaxtime(these can be named anything, these are just the names I chose) in the main part of your script before threading the other two functions.
if you wanted to go the extra step you could add a switch(or another if/else) check after the loop breaks to see if the player passed or failed, and do whatever you want after each of them. You could also just add the same endon to that script so it will stop the function and not play what is after the loop breaks.


Thanks, i'll do some testing with this :)