[Script] Bootcamp Competition |
![]() « Citoyen » 1464210120000
| 0 | ||
Hi guys, I ran a bootcamp competition once and it was relatively well received, I am sharing the script used so you can run similar in your tribehouse and adapt as you see fit for any future competitions. I utilised some data retrieval in a google doc from copy/pasting the outputs to #lua which are available here: The script is here in tabbed form, or below, unformatted: tfm.exec.disableAutoScore(true) tfm.exec.disableAutoShaman(true) tfm.exec.disableAutoNewGame(true) tfm.exec.disableAfkDeath(true) tfm.exec.disableAutoTimeLeft(true) system.disableChatCommandDisplay('map1', true) system.disableChatCommandDisplay('map2', true) system.disableChatCommandDisplay('map3', true) system.disableChatCommandDisplay('map4', true) system.disableChatCommandDisplay('map5', true) system.disableChatCommandDisplay('map6', true) system.disableChatCommandDisplay('reset',true) system.disableChatCommandDisplay('mort',true) easymaps={113156,168754,586901,306384, 204647, 4313858, 1610638, 3734996, 3737744, 393426, 783547, 2469365, 1296299, 449496, 1000006, 496886, 270924, 2693344, 167333, 3937567, 3513929, 2854813, 608368, 3820501, 212322, 3337127, 2239788, 277513} mediummaps={149451,150651,151655,152733,155480,156720,160841,651656,304861,1102513,395310,185529, 2818330, 332906, 213874, 1398609, 365061, 2636207, 2297260, 3219400 , 2817711, 2789121, 2050389, 408643, 397467, 1157281, 692650, 163596, 301610 , 185428, 2520540, 208056, 556575, 232675, 541693, 242291, 3041105, 438333, 281948, 692740, 564198, 318129 , 270924, 231137, 305820, 179807, 1066607, 515684, 225744, 684566, 467137, 220352 , 222377, 1737297, 492399, 1266330, 295630, 205506, 3008319, 376704 , 184868, 302080, 444589, 368585, 257092} hardmaps={1989803,4578236, 2819876,2877042,2999994,3200001,355336,2963166,259319,536905,3826546,4000009,2932238, 2311703, 3750360, 1004622, 2750014, 552986, 3012311, 733146, 1737800, 4093488, 3551333, 584783, 722837, 1046877, 574183, 3908151, 758595, 3988424, 1989803, 4484685, 587501, 3343092, 2395201, 3938895, 1737914, 2772507, 1301649, 203664, 721319, 2423300, 209848, 4220381, 4000007, 299983, 1494499, 4121359, 2416969, 3292308, 4000008, 1952415, 3969628, 3118161 } yikesmaps={4209243, 4532470, 5085011, 4720851, 3038589, 397478, 4948551, 4794517, 1111252, 3976766} easyno=table.getn(easymaps) mediumno=table.getn(mediummaps) hardno=table.getn(hardmaps) yikesno=table.getn(yikesmaps) bestplayer="N/A" bestplayer2="N/A" bestplayer3="N/A" playerlist={"Realounay","Cloude","Rpownz","Mcsguigf","Mezarbekcisi","Eduardomol","Bleees","Franquin","Gohoq","Ochey"} playertrue={Realounay=true,Mcsguigf=true,Cloude=true,Rpownz=true,Mezarbekcisi=true,Eduardomol=true,Bleees=true,Franquin=true,Gohoq=true,Ochey=true} scores={} x=0 e=1 for i,n in pairs(playerlist) do scores[n]=0 tfm.exec.setPlayerScore(n,scores[n],false) tfm.exec.bindKeyboard(n,8,true,true) end tfm.exec.newGame('#13') function eventNewPlayer(name) if playertrue[name] then tfm.exec.bindKeyboard(name,8,true,true) tfm.exec.respawnPlayer(name) tfm.exec.setPlayerScore(name,scores[name],true) tfm.exec.chatMessage(name .. " has joined!") end if name == "Yogiibear" then tfm.exec.respawnPlayer(name) end end function eventNewGame() print("Start") for i,n in pairs(tfm.get.room.playerList) do tfm.exec.killPlayer(i) end if bestplayer ~= "N/A" then if playertrue[bestplayer] then scores[bestplayer]=scores[bestplayer]+5 tfm.exec.chatMessage(bestplayer .. " was fastest, completing the map in " .. besttime1/100 .. "s, earning 5 bonus points!") end end if bestplayer2 ~= "N/A" then if playertrue[bestplayer2] then scores[bestplayer2]=scores[bestplayer2]+3 tfm.exec.chatMessage(bestplayer2 .. " was second fastest, completing the map in " .. besttime2/100 .. "s, earning 3 bonus points!") end end if bestplayer3 ~= "N/A" then if playertrue[bestplayer3] then scores[bestplayer3]=scores[bestplayer3]+1 tfm.exec.chatMessage(bestplayer3 .. " was third fastest, completing the map in " .. besttime3/100 .. "s, earning 1 bonus point") end end for i,n in pairs(playerlist) do if playertrue[n] then tfm.exec.setPlayerScore(n,scores[n],false) tfm.exec.respawnPlayer(n) end end tfm.exec.setGameTime(360) x=x+1 y=x%3 pointsremaining=5 besttime1=1000000 besttime2=1000001 besttime3=1000002 bestplayer="" bestplayer2="" bestplayer3="" tfm.exec.setUIShamanName("Fastest: N/A | Time: N/A s") tfm.exec.setUIMapName("") e=1 end function eventKeyboard(name, key, down, xPlayerPosition, yPlayerPosition) if key==8 then tfm.exec.killPlayer(name) tfm.exec.respawnPlayer(name) end end function eventChatCommand(name, cmd) local cmd_args={} for arg in cmd:gmatch("[^%s]+") do table.insert(cmd_args, arg) end if cmd=="mort" then if playertrue[name] then tfm.exec.killPlayer(name) tfm.exec.respawnPlayer(name) end end if name=="Yogiibear" then if cmd_args[1]=="map" then tfm.exec.newGame(cmd_args[2]) end if cmd=="end" then tfm.exec.newGame(0) end if cmd=="easymap" then tfm.exec.newGame(easymaps[math.random(easyno)]) end if cmd=="mediummap" then medrn=math.random(mediumno) print(medrn) tfm.exec.newGame(mediummaps[medrn]) end if cmd=="hardmap" then tfm.exec.newGame(hardmaps[math.random(hardno)]) end if cmd=="vhardmap" then tfm.exec.newGame(yikesmaps[math.random(yikesno)]) end if cmd=="reset" then tfm.exec.newGame(0) x=0 bestplayer="" bestplayer2="" bestplayer3="" for i,n in pairs(playerlist) do scores[n]=0 tfm.exec.respawnPlayer(i) tfm.exec.bindKeyboard(n,8,true,true) tfm.exec.setPlayerScore(n,0,false) end end if cmd=="win" then tfm.exec.giveCheese(name) tfm.exec.playerVictory(name) end if cmd=="top3" then tfm.exec.chatMessage(bestplayer .. " " .. besttime1/100 .. "s | " .. bestplayer2 .. " " .. besttime2/100 .. "s | " .. bestplayer3 .. " " .. besttime3/100 .. "s") end if cmd=="scores" then print(scores[name]) end end end function eventPlayerWon(name,time,time2) if e==1 then if playertrue[name] then print(time/100 .. " " .. name .. " " .. time2/100) tfm.exec.chatMessage(name .. " completed the map in " .. time2/100 .. "s earning ".. pointsremaining .. " points") scores[name]=scores[name]+pointsremaining tfm.exec.setPlayerScore(name,pointsremaining,true) if pointsremaining>1 then pointsremaining=pointsremaining-1 end if time2 < besttime1 then besttime3=besttime2 bestplayer3=bestplayer2 besttime2=besttime1 bestplayer2=bestplayer besttime1=time2 bestplayer=name tfm.exec.setUIShamanName(bestplayer .. " " .. besttime1/100 .. "s | " .. bestplayer2 .. " " .. besttime2/100 .. "s | " .. bestplayer3 .. " " .. besttime3/100 .. "s") elseif time2 < besttime2 then besttime3=besttime2 bestplayer3=bestplayer2 besttime2=time2 bestplayer2=name tfm.exec.setUIShamanName(bestplayer .. " " .. besttime1/100 .. "s | " .. bestplayer2 .. " " .. besttime2/100 .. "s | " .. bestplayer3 .. " " .. besttime3/100 .. "s") elseif time2 < besttime3 then besttime3=time2 bestplayer3=name tfm.exec.setUIShamanName(bestplayer .. " " .. besttime1/100 .. "s | " .. bestplayer2 .. " " .. besttime2/100 .. "s | " .. bestplayer3 .. " " .. besttime3/100 .. "s") end end end tfm.exec.respawnPlayer(name) end function eventPlayerDied(name) if playertrue[name] then tfm.exec.respawnPlayer(name) end if name== "Yogiibear" then tfm.exec.respawnPlayer(name) end end function eventLoop(a,b) if b<=0 then if e==1 then tfm.exec.chatMessage("Time is up!") e=e-1 end end end It is by no means a perfect script and requires you to edit the "Yogiibear" part to whoever is hosting and editing the playerlists and maplists as you see fit, you can edit it so all available players are in the playerlist and one can easily edit the maplists. I designed this script as a solution to a particular problem so it is not fully ready to use without work for all circumstances, but can be adapted easily enough. I won't be here for troubleshooting but please enjoy the template. Thanks, Yogi Dernière modification le 1464210300000 |
![]() ![]() « Citoyen » 1464212340000
| 0 | ||
Thanks |
![]() ![]() « Citoyen » 1464214260000
| 0 | ||
Nice Idea, But the only problem is #records is a little similar :p |