SmileyCat Posted November 12, 2010 Share Posted November 12, 2010 I am creating a Enclave Commander for personal use because I want it my way :) Now, when requesting more units through the hamradio, you can pick one unit, but when you press it, an loop of messages saying "Unit is sent now." until the 7 unit limit is reached, then it will loop "All Unit slots used." Here is the code;scn EnclaveSquadRadioScript int Button int countSoldiers begin onActivate showMessage EnclaveSquadCallTrooperMsg end begin GameMode set Button to getButtonPressed if button == 0 if countSoldiers < 7 Player.PlaceleveledActoratme enclavesquadenergyweaponsCANNON showmessage enclavesquadsoldiercalled set countSoldiers to (countSoldiers + 1) else showmessage enclavesquadsoldierenough endif elseif button == 1 if countSoldiers < 7 Player.PlaceleveledActoratme enclavesquadenergyweaponsHEAVY showmessage enclavesquadsoldiercalled set countSoldiers to (countSoldiers + 1) else showmessage enclavesquadsoldierenough endif elseif button == 2 if countSoldiers < 7 Player.PlaceleveledActoratme enclavesquadenergyweaponsSMALL showmessage enclavesquadsoldiercalled set countSoldiers to (countSoldiers + 1) else showmessage enclavesquadsoldierenough endif elseif button == 3 if countSoldiers < 7 Player.PlaceleveledActoratme enclavesquadenergyweaponsINCINERATOR showmessage enclavesquadsoldiercalled set countSoldiers to (countSoldiers + 1) else showmessage enclavesquadsoldierenough endif elseif button == 4 if countSoldiers < 7 Player.PlaceleveledActoratme enclavesquadenergyweaponsTeslaCANNON showmessage enclavesquadsoldiercalled set countSoldiers to (countSoldiers + 1) else showmessage enclavesquadsoldierenough endif elseif button == 5 if countSoldiers < 7 Player.PlaceleveledActoratme enclavesquadenergyweaponsTeslaHEAVY showmessage enclavesquadsoldiercalled set countSoldiers to (countSoldiers + 1) else showmessage enclavesquadsoldierenough endif elseif button == 6 if countSoldiers < 7 Player.PlaceleveledActoratme enclavesquadenergyweaponsTeslaSMALL showmessage enclavesquadsoldiercalled set countSoldiers to (countSoldiers + 1) else showmessage enclavesquadsoldierenough endif elseif button == 7 if countSoldiers < 7 Player.PlaceleveledActoratme enclavesquadenergyweaponsTeslaINCINERATOR showmessage enclavesquadsoldiercalled set countSoldiers to (countSoldiers + 1) else showmessage enclavesquadsoldierenough endif elseif button == 8 if countSoldiers < 7 Player.PlaceleveledActoratme enclavesquadspecializedstealthsniper showmessage enclavesquadsoldiercalled set countSoldiers to (countSoldiers + 1) else showmessage enclavesquadsoldierenough endif endif end I know, I dont do things so great with scripts. Its probably something simple, anyway, HELP ME! *EDIT* I removed the limit wich fixed the bug, but if you find a solution then you are MORE THAN WELCOME TO POST. Link to comment Share on other sites More sharing options...
Quaix Posted November 13, 2010 Share Posted November 13, 2010 It looks like you need a control variable of some kind to prevent the GameMode block from executing more than once. Something like this: scn EnclaveSquadRadioScript int Button int countSoldiers int radioState begin onActivate showMessage EnclaveSquadCallTrooperMsg set radioState to 1 end BEGIN GameMode If radioState != 1 return EndIf ... (Put the rest of your stuff here) ... set radioState to 0 END Link to comment Share on other sites More sharing options...
SmileyCat Posted November 13, 2010 Author Share Posted November 13, 2010 Yes.. That might do the trick.. But hey, I got it working as I want it. The mod is finished. Link to comment Share on other sites More sharing options...
SmileyCat Posted November 14, 2010 Author Share Posted November 14, 2010 I created my original mod from scratch and used that script, worked like a charm. Link to comment Share on other sites More sharing options...
Recommended Posts