scripting:subgames
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
scripting:subgames [2020/01/29 05:55] – created mit | scripting:subgames [2023/04/05 11:59] (current) – mit | ||
---|---|---|---|
Line 13: | Line 13: | ||
=== Basic Subgame Example === | === Basic Subgame Example === | ||
- | TBD \\ | + | A general overview of an implementation of a RC duel subgame. (The full script for this as used on Lovelace will be available in the script examples sections): |
+ | |||
+ | - Firstly - we'll choose an ID number for the subgame. If you've only got one subgame on the world, just using subgame 0 is fine, but if you want to have multiple games running simultaneously you'll need to allocate them different numbers. Might be good to set that up using a global variable so its easy to change later.. for this example we'll use **global $kCrowDuelSubgameID = 0**. | ||
+ | |||
+ | - Now we get the two players into the subgame together e.g. | ||
+ | < | ||
+ | SubgameJoin( $kCrowDuelSubgameID, | ||
+ | SubgameJoin( $kCrowDuelSubgameID, | ||
+ | </ | ||
+ | < | ||
+ | </ | ||
+ | - .. next we set up the RC game state ; setting the players spawn positions and lives, and locking the weapons | ||
+ | < | ||
+ | *crowspawn $playerName1 176 75 | ||
+ | *crowspawn $playerName2 177 70 | ||
+ | |||
+ | *crowlives $playerName1 2 | ||
+ | *crowlives $playerName2 2 | ||
+ | |||
+ | *lockweapons $playerName1 | ||
+ | *lockweapons $playerName2 | ||
+ | </ | ||
+ | |||
+ | - When we're ready to start (again, the [[scripting:: | ||
+ | < | ||
+ | SubgameActivateScoreboard( $kCrowDuelSubgameID, | ||
+ | SubgameEventAll( $kCrowDuelSubgameID, | ||
+ | </ | ||
+ | |||
+ | - We'll create the custom ' | ||
+ | < | ||
+ | Event( " | ||
+ | { | ||
+ | *gocrow %PLAYER% | ||
+ | *centraltext %PLAYER% Ready up. Round starts in 10 seconds.. | ||
+ | Sleep( 70 ) | ||
+ | *countdown %PLAYER% 3 0 | ||
+ | Sleep( 30 ) | ||
+ | *onscreentimer %PLAYER%, | ||
+ | *unlockweapons %PLAYER% | ||
+ | SubgameSetTimer( $kCrowDuelSubgameID, | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | - While the players are duelling, the script listens in to **" | ||
+ | |||
+ | - When the ' | ||
+ | \\ | ||
\\ | \\ | ||
scripting/subgames.1580298909.txt.gz · Last modified: 2020/01/29 05:55 by mit