Timelimit?

Talk about your new mod or map here

Moderators: jelco, bert_the_turtle

User avatar
Testrie
level3
level3
Posts: 486
Joined: Thu Aug 17, 2006 8:02 pm
Location: CA, United States
Contact:

Timelimit?

Postby Testrie » Wed Aug 23, 2006 7:11 pm

How exactly do you set up a time limit for a level?

If you have a script just wait then say a message, then won't it say the message even if they finish the level and start playing a new level?

Tes
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Re: Timelimit?

Postby xander » Wed Aug 23, 2006 7:41 pm

Testrie wrote:How exactly do you set up a time limit for a level?

If you have a script just wait then say a message, then won't it say the message even if they finish the level and start playing a new level?

Tes

1) I strongly suggest against using scripts with long delays. I ran into a lot of trouble with that in my mod. People may leave the level (which can cause problems) or leave the game (which will cause the script to terminate without doing whatever it is supposed to do). Don't use long delays in any script where mission critical events happen at the end. It is bad mojo.

2) IV did not create any way to set up a time limit through normal means (i.e. you have 10 minutes to complete this mission, counting down now...). However, it is possible to fake it. In your level, out in the middle of the ocean, create an AISpawnPoint. Have that AISpawnPoint create virii that are on any team but team 1 (say, green virii, or yellow virii). They will be invisible. (NB: you could you team 1 virii if you wanted, or any other type of unit (except DGs), but using non-team 1 virii hides what you are doing). Then, place a SafeArea over the AISpawnPoint. Here is how it works -- the AISpawnPoint will spawn units at whatever rate you set (I suggest a rate of 10 or 15, which is about 4-6 per minute). When X number of units have been spawned (X being the capacity of the SafeArea), the SafeArea will come onlline. You can use that online status to trigger a script in game.txt. The time limits are not exact, as the rate of spawning does not seem to be exactly what it says it is (if you set it to 10, you should have one unit created every 10 seconds -- however, this rate seems to be at least partially related to framerates and CPU load).

There are a couple of problems with this scheme:
A) The SafeArea must be global or this will not work.
B) Because the SafeArea is global, however, there will be an entry for it in game.txt . Once it is brought online, you can never un-bring-it-online. If your time limit is a mission objective (i.e. keep your units alive until time runs out), then this is not a problem. However, if it is a constraint, it is a problem. The solution is to do something like this:

First, let us assume that your level is named "level_name" and that your mission is "mission_000.txt". In mission_000.txt, we will assume that buildingID 100 is the SafeArea described above. In game.txt, you should have an event trigger that looks like this:

Code: Select all

Event BuildingOnline:level_name,100
     Action RunScript script_000.txt
     End


script_000.txt will be the script that says "YOU ARE TEH FAIL" or whatever you want it to say. The last three lines of script_000.txt should read:

Code: Select all

ExitLocation # this assumes that the script hasn't already exited the location
SetMission level_name mission_001.txt
 # this line intentionally left blank


mission_001.txt will be identical to mission_000.txt, except that it will not have building ID 100. Instead, it will have an identical building with ID 101 (i.e. a SafeArea set up just like the other one, but with its ID incremented by 1). In game.txt, you will need another event trigger, identical to the first, but with all of those IDs incremented by 1 as well.

What this does:
When the SafeArea comes online, the mission is "failed". However, the SafeArea cannot be brought offline (i.e. building ID 100 cannot be brought offline). Therefore, we remove building ID 100, and replace it with building ID 101, by swapping mission files.

By the way, you probably want to have more than two mission files. I recommend using 25 or more, in case a person messes up more than once :) This means a lot of cutting and pasting, and incrementing numbers. I also would suggest that such a method is not for the faint of heart.

xander
User avatar
Testrie
level3
level3
Posts: 486
Joined: Thu Aug 17, 2006 8:02 pm
Location: CA, United States
Contact:

Re: Timelimit?

Postby Testrie » Wed Aug 23, 2006 8:14 pm

Thanks, thats very helpful.

xander wrote:By the way, you probably want to have more than two mission files. I recommend using 25 or more, in case a person messes up more than once

xander


Wow... you are mean (not to me, but to people who play your mods) assuming that somone should fail 25 times. Actually, i thought that it was pretty funny :D

Tes

Thanks again.
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Re: Timelimit?

Postby xander » Wed Aug 23, 2006 8:51 pm

Testrie wrote:Thanks, thats very helpful.

xander wrote:By the way, you probably want to have more than two mission files. I recommend using 25 or more, in case a person messes up more than once

xander


Wow... you are mean (not to me, but to people who play your mods) assuming that somone should fail 25 times. Actually, i thought that it was pretty funny :D

Tes

Thanks again.

Actually, in my mod it is not because people fail. There is one level that gets played, and all of the objectives are completed. Then, they have to come back through that level, and play with different objectives. The problem is that once all of the objectives have been completed for a given map, you can't assign new objectives. So, in order to have everything work properly, I needed the first level to shuffle the player off to the second version of the level after they completed it. It need to work every time. Thus, I have something like 100 script triggers that fire when a person enters the first level. The way that script triggers work is as follows:
The trigger with the lowest ID is executed.
The trigger with the next lowest ID is executed.
...
The trigger with the highest ID is executed.

However, if you leave the level while the script lowest ID is being executed, the following scripts are not executed. Thus, the first level passes them to the second, and the remaining scripts are not executed. Every time they leave the second level, and try to reenter the level, another script trigger is "used up." I hope that no one ever uses them all, though I know it is possible, and that it is a minor bug in Insurrection. However, I couldn't come up with a better way around the problem, there ya go.

xander
User avatar
Testrie
level3
level3
Posts: 486
Joined: Thu Aug 17, 2006 8:02 pm
Location: CA, United States
Contact:

Re: Timelimit?

Postby Testrie » Wed Aug 23, 2006 9:03 pm

I just realized somthing... AISpawnPoints hate me... I can never get them to work properly.

xander wrote:So, in order to have everything work properly, I needed the first level to shuffle the player off to the second version of the level after they completed it. It need to work every time. Thus, I have something like 100 script triggers that fire when a person enters the first level. The way that script triggers work is as follows:
The trigger with the lowest ID is executed.
The trigger with the next lowest ID is executed.
...
The trigger with the highest ID is executed.

However, if you leave the level while the script lowest ID is being executed, the following scripts are not executed. Thus, the first level passes them to the second, and the remaining scripts are not executed. Every time they leave the second level, and try to reenter the level, another script trigger is "used up." I hope that no one ever uses them all, though I know it is possible, and that it is a minor bug in Insurrection. However, I couldn't come up with a better way around the problem, there ya go.

xander


I didn't really understand that... clearify? (note: i will not accept somthing along the lines as "don't worry about it" as an anwser :))

Tes
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Re: Timelimit?

Postby xander » Wed Aug 23, 2006 9:31 pm

Testrie wrote:--==<snip>==--

Don't worry about it.

xander
User avatar
Testrie
level3
level3
Posts: 486
Joined: Thu Aug 17, 2006 8:02 pm
Location: CA, United States
Contact:

Re: Timelimit?

Postby Testrie » Wed Aug 23, 2006 9:52 pm

xander wrote:
Testrie wrote:--==<snip>==--

Don't worry about it.

xander


what happened to "I just realized somthing... AISpawnPoints hate me... I can never get them to work properly." ? any advice?

Tes
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Re: Timelimit?

Postby xander » Wed Aug 23, 2006 10:55 pm

Testrie wrote:
xander wrote:
Testrie wrote:--==<snip>==--

Don't worry about it.

xander


what happened to "I just realized somthing... AISpawnPoints hate me... I can never get them to work properly." ? any advice?

Tes

You didn't really explain your problem...

xander
User avatar
Testrie
level3
level3
Posts: 486
Joined: Thu Aug 17, 2006 8:02 pm
Location: CA, United States
Contact:

Re: Timelimit?

Postby Testrie » Wed Aug 23, 2006 11:10 pm

xander wrote:
Testrie wrote:
xander wrote:
Testrie wrote:--==<snip>==--

Don't worry about it.

xander


what happened to "I just realized somthing... AISpawnPoints hate me... I can never get them to work properly." ? any advice?

Tes

You didn't really explain your problem...

xander


They just dont work... Nothing spawns from them. (I even chose a creature that was hard to miss)
User avatar
Lowell
level3
level3
Posts: 428
Joined: Mon Jan 02, 2006 8:03 pm
Location: Atlanta, Georgia
Contact:

Re: Timelimit?

Postby Lowell » Thu Aug 24, 2006 7:36 pm

Testrie wrote:They just don’t work... Nothing spawns from them. (I even chose a creature that was hard to miss)

Hmm that's weird. They should go online and start spawning when you enter a level if they are not linked to a building. If linked to a building it will spawn when the building goes online.

I had a pop lock kick in once that paused the spawning on one till I realized that I had too many units in the area, then adjusted the pop lock numbers to allow more units in the area...spawning started. Maybe that is the trouble?
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Re: Timelimit?

Postby xander » Thu Aug 24, 2006 7:45 pm

Lowell wrote:If linked to a building it will spawn when the building goes online.

Minor quibble: AISpawnPoints do not go online when the linked building goes online. They go online when the building goes active. There is a difference. A building's online status can be used for mission objectives. A building's active status is wether or not it is doing anything. For instance, a Mine will never come online, but it is active as soon as it is being run by DGs. A Refinery can come online (when it refines 20 primatives), but it can also become active (when it is being run by DGs).

xander
User avatar
trickfred
level5
level5
Posts: 1691
Joined: Sat Jul 24, 2004 5:01 am
Location: The Great White North, Eh?
Contact:

Postby trickfred » Thu Aug 24, 2006 7:55 pm

...Or if you link them to nothing, they will start spawning upon entering a level without the need for a building to go online, and automatically stop generating enemies once all of the level's objectives are complete.
User avatar
xander
level5
level5
Posts: 16869
Joined: Thu Oct 21, 2004 11:41 pm
Location: Highland, CA, USA
Contact:

Postby xander » Thu Aug 24, 2006 7:57 pm

trickfred wrote:...Or if you link them to nothing, they will start spawning upon entering a level without the need for a building to go online, and automatically stop generating enemies once all of the level's objectives are complete.

Lowell already said that...

xander
User avatar
trickfred
level5
level5
Posts: 1691
Joined: Sat Jul 24, 2004 5:01 am
Location: The Great White North, Eh?
Contact:

Postby trickfred » Thu Aug 24, 2006 8:16 pm

xander wrote:
trickfred wrote:...Or if you link them to nothing, they will start spawning upon entering a level without the need for a building to go online, and automatically stop generating enemies once all of the level's objectives are complete.

Lowell already said that...

xander


*smacks head*

I think I just pointed out that he did that to one of my posts in another thread, too...

I humbly apologize, Lowell. Please forgive me (though the point of my post there was more to do with script triggers than the repeated part...)

*prostrates himself before Lowell for all to see*
User avatar
Testrie
level3
level3
Posts: 486
Joined: Thu Aug 17, 2006 8:02 pm
Location: CA, United States
Contact:

Postby Testrie » Thu Aug 24, 2006 9:11 pm

trickfred wrote:...Or if you link them to nothing, they will start spawning upon entering a level without the need for a building to go online, and automatically stop generating enemies once all of the level's objectives are complete.


I seem to find reading some posts easier to read than others... strange.

How did i miss lowell's post about completing objectives... hmm, it seems that he didn't.

Tes

Return to “Mod Projects”

Who is online

Users browsing this forum: No registered users and 3 guests