| Blockland Forums > Modification Help |
| Auto Creating A Minigame |
| << < (2/4) > >> |
| otto-san:
minigames are literally scriptobjects with a special class and set of functions, all the minigame prefs are variables in the SO. --- Code: --- new scriptObject(CityRPGMini) { class = miniGameSO; brickDamage = true; brickRespawnTime = 10000; colorIdx = -1; enableBuilding = true; enablePainting = true; enableWand = true; fallingDamage = true; inviteOnly = false; points_plantBrick = 0; points_breakBrick = 0; points_die = -1; points_killPlayer = 1; points_killSelf = -1; playerDatablock = playerNoJet; respawnTime = 0; selfDamage = true; playersUseOwnBricks = false; useAllPlayersBricks = true; useSpawnBricks = false; VehicleDamage = true; vehicleRespawnTime = 10000; weaponDamage = true; numMembers = 0; // Special: vehicleRunOverDamage = false; }; --- End code --- that bit right there makes the minigame, you can change the prefs in it |
| jes00:
--- Quote from: otto-san on August 22, 2011, 10:12:37 PM ---minigames are literally scriptobjects with a special class and set of functions, all the minigame prefs are variables in the SO. --- Code: --- new scriptObject(CityRPGMini) { class = miniGameSO; brickDamage = true; brickRespawnTime = 10000; colorIdx = -1; enableBuilding = true; enablePainting = true; enableWand = true; fallingDamage = true; inviteOnly = false; points_plantBrick = 0; points_breakBrick = 0; points_die = -1; points_killPlayer = 1; points_killSelf = -1; playerDatablock = playerNoJet; respawnTime = 0; selfDamage = true; playersUseOwnBricks = false; useAllPlayersBricks = true; useSpawnBricks = false; VehicleDamage = true; vehicleRespawnTime = 10000; weaponDamage = true; numMembers = 0; // Special: vehicleRunOverDamage = false; }; --- End code --- that bit right there makes the minigame, you can change the prefs in it --- End quote --- So if I just did --- Code: --- new scriptObject(MedievalRPGMini) { class = miniGameSO; brickDamage = false; brickRespawnTime = 10000; colorIdx = -1; enableBuilding = false; enablePainting = false; enableWand = false; fallingDamage = true; inviteOnly = false; points_plantBrick = 0; points_breakBrick = 0; points_die = 0; points_killPlayer = 1; points_killSelf = 0; playerDatablock = RPGplayer; respawnTime = 15; selfDamage = true; playersUseOwnBricks = false; useAllPlayersBricks = true; useSpawnBricks = true; VehicleDamage = true; vehicleRespawnTime = 10000; weaponDamage = true; numMembers = 0; // Special: vehicleRunOverDamage = false; }; --- End code --- Then it would create a minigame with the desired prefs when I start a server? |
| Placid:
of course, that would have to be packaged to when you start the server. |
| jes00:
--- Quote from: Placid on August 23, 2011, 08:20:47 AM ---of course, that would have to be packaged to when you start the server. --- End quote --- Like this? --- Code: --- function gameconnection::OnClientEnterGame(%this,%obj,%a,%b,%c,%d,%e) { new scriptObject(MedievalRPGMini) { class = miniGameSO; brickDamage = false; brickRespawnTime = 10000; colorIdx = -1; enableBuilding = false; enablePainting = false; enableWand = false; fallingDamage = true; inviteOnly = false; points_plantBrick = 0; points_breakBrick = 0; points_die = 0; points_killPlayer = 1; points_killSelf = 0; playerDatablock = RPGplayer; respawnTime = 15; selfDamage = true; playersUseOwnBricks = false; useAllPlayersBricks = true; useSpawnBricks = true; VehicleDamage = true; vehicleRespawnTime = 10000; weaponDamage = true; numMembers = 0; // Special: vehicleRunOverDamage = false; }; Parent::OnClientEnterGame(%this,%a,%b,%c,%d,%e); }; --- End code --- |
| Placid:
--- Quote from: jes00 on August 23, 2011, 09:19:07 AM --- --- Code: ---package myMinigame { function gameconnection::OnClientEnterGame(%this,%obj,%a,%b,%c,%d,%e) { Parent::OnClientEnterGame(%this,%a,%b,%c,%d,%e); if(isObject(MedievalRPGMini)) { //i forget how to add a player to a minigame but you should do it to %this here return; //leave the function before we create another minigame } if(%this.name == $pref::player::netName && $myMinigame $="1") { //if the minigame doesn't exist and your mod is toggled new scriptObject(MedievalRPGMini) { class = miniGameSO; brickDamage = false; brickRespawnTime = 10000; colorIdx = -1; enableBuilding = false; enablePainting = false; enableWand = false; fallingDamage = true; inviteOnly = false; points_plantBrick = 0; points_breakBrick = 0; points_die = 0; points_killPlayer = 1; points_killSelf = 0; playerDatablock = RPGplayer; respawnTime = 15; selfDamage = true; playersUseOwnBricks = false; useAllPlayersBricks = true; useSpawnBricks = true; VehicleDamage = true; vehicleRespawnTime = 10000; weaponDamage = true; numMembers = 0; // Special: vehicleRunOverDamage = false; }; } }; activatepackage(myMinigame); --- End code --- --- End quote --- should work. i'm not 100% sure that %this is the client, but i'm pretty damn sure. |
| Navigation |
| Message Index |
| Next page |
| Previous page |