Actually, I almost posted a whole bunch of stuff with the above, but decided it wasn't quite right.
If you think about objectives, the vast majority will be met by picking up / activating / running over an object. Get to location A, get device, destroy power unit.
Here's my current thinking:
For each level, a certain number of objectives (with ids) will be defined against the level. These will be primary or secondary. Some will be automatically assigned on starting the level (but not all).
Various objects around the map will then include a command along the lines of "completeobjective(id)" in their scripts. You'll also have access to a "addobjective(id)" and "deleteobjective(id)" to do funky stuff like re-assigning objectives mid-level. The game engine only needs to monitor the objectives that are assigned and see if they're all complete each game loop. The idea being that the game ends when there are no primary objectives left.
I think that works for most things, apart from a primary objective of "blow up power unit and get to exit", as the above would allow you to get to the exit, THEN blow up the power unit. So we need an equivalent to onover() of onoff() that allows us to reset stuff when you move off an object. This will also be useful for pressure pads.
An alternative is to put the level completion criteria in the objects themselves. For example, in the example above, the ondestroy() script for the power unit would include "setvar(powerdown,true)" and the object at the exit wold have an onover() trigger of "if(powerdown,true,exitlevel())". I'm not keen on this as it makes objectives harder to understand when editing and playing a level - it would be very difficult to list current objectives.
Not entirely convinced yet, but something along those lines...
If you think about objectives, the vast majority will be met by picking up / activating / running over an object. Get to location A, get device, destroy power unit.
Here's my current thinking:
For each level, a certain number of objectives (with ids) will be defined against the level. These will be primary or secondary. Some will be automatically assigned on starting the level (but not all).
Various objects around the map will then include a command along the lines of "completeobjective(id)" in their scripts. You'll also have access to a "addobjective(id)" and "deleteobjective(id)" to do funky stuff like re-assigning objectives mid-level. The game engine only needs to monitor the objectives that are assigned and see if they're all complete each game loop. The idea being that the game ends when there are no primary objectives left.
I think that works for most things, apart from a primary objective of "blow up power unit and get to exit", as the above would allow you to get to the exit, THEN blow up the power unit. So we need an equivalent to onover() of onoff() that allows us to reset stuff when you move off an object. This will also be useful for pressure pads.
An alternative is to put the level completion criteria in the objects themselves. For example, in the example above, the ondestroy() script for the power unit would include "setvar(powerdown,true)" and the object at the exit wold have an onover() trigger of "if(powerdown,true,exitlevel())". I'm not keen on this as it makes objectives harder to understand when editing and playing a level - it would be very difficult to list current objectives.
Not entirely convinced yet, but something along those lines...