User Tools

Site Tools


scripting:subgames

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
scripting:subgames [2020/02/02 21:17] mitscripting:subgames [2023/04/05 11:59] (current) mit
Line 15: Line 15:
 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): 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. Best set up using a global variable so its easy to change later.. for this example we'll use **global $kCrowDuelSubgameID = 0**.+- 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. - Now we get the two players into the subgame together e.g.
Line 22: Line 22:
  SubgameJoin( $kCrowDuelSubgameID, $player2 )  SubgameJoin( $kCrowDuelSubgameID, $player2 )
 </code> </code>
-(There are various techniques we can use to decide the two players involved, including the [[scripting::subgames:SubgameChallenge|Subgame Challenge system]].) +<note>(In this example, $player1 and $player2 are the player IDs for the two players who want to play in the subgame. There are various techniques we can use to collect the IDs of the players involved - e.g. Send out a global notification message and join the $gPlayerID of everyone who accepts the prompt.. or you could use the [[scripting::subgames:SubgameDuels|Subgame Duels system]].) 
 +</note>
 - .. next we set up the RC game state ; setting the players spawn positions and lives, and locking the weapons - .. next we set up the RC game state ; setting the players spawn positions and lives, and locking the weapons
 <code> <code>
Line 36: Line 36:
 </code> </code>
  
-- When we're ready to start (again, the [[scripting::subgames:SubgameChallenge|Subgame Challenge system]] provides helpers for controlling this), we activate the scoreboard and trigger an event for both the players in the duel..+- When we're ready to start (again, the [[scripting::subgames:SubgameDuels|Subgame Duels system]] provides helpers for controlling this), we activate the scoreboard and trigger an event for both the players in the duel..
 <code> <code>
  SubgameActivateScoreboard( $kCrowDuelSubgameID, 0 )  SubgameActivateScoreboard( $kCrowDuelSubgameID, 0 )
Line 42: Line 42:
 </code> </code>
  
-The 'DuelStart' event puts the players in RC mode, gets the players ready, unlocks their weapons and sets a timer for the end of the game, e.g:+We'll create the custom 'DuelStart' event to put the players in RC mode, get them players ready, unlock their weapons and set a timer for the end of the game, e.g:
 <code> <code>
 +Event( "Subgame", "DuelStart" )
 +{
  *gocrow %PLAYER%  *gocrow %PLAYER%
  *centraltext %PLAYER% Ready up. Round starts in 10 seconds..  *centraltext %PLAYER% Ready up. Round starts in 10 seconds..
Line 52: Line 54:
  *unlockweapons %PLAYER%  *unlockweapons %PLAYER%
  SubgameSetTimer( $kCrowDuelSubgameID, 0, 180, "CrowDuelEndTimer", 0 )  SubgameSetTimer( $kCrowDuelSubgameID, 0, 180, "CrowDuelEndTimer", 0 )
 +}
 </code> </code>
  
scripting/subgames.1580699837.txt.gz · Last modified: 2020/02/02 21:17 by mit

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki