Jump to content
Official BF Editor Forums

Liguster

Members
  • Content count

    81
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Liguster

  • Rank
    Member
  1. Liguster

    Check If Any Human Players Are Alive.

    Yeah, I noticed that when testing it further and made the exact change you proposed
  2. Liguster

    Check If Any Human Players Are Alive.

    Alright, this does the job pretty well. I managed to find the problem by adding texts to some the "if"'s and then see which functions worked correctly. I believe everything worked as it should apart from the endminiroundtime thing. So I just used the code I had used earlier a changed it a bit to see who had more players. Bam profit! snip Only thing is: Is it possible to only make it end the round about 30 sec after the last human player has been killed. I thinking of reading the "g_sabotageElapsedRoundTime" and making it a constant, something like g_sabotageElapsedRoundTime = ElapsedTimeconstant And then making one more "if" after the check if there are any human players like this: snip Something along those lines would be very nice. OK, I think i made it work as it should, but I need to test it a little more. The current code apart from what you already know is: g_sabotagePlayers = [0,0,0] #Array for Player Numbers g_sabotageTeamScores = [0,0,0] #Array for Team Scores g_sabotageMiniRounds = 3 g_sabotageStartTimer = -1 #Start Timer g_sabotageStarted = 0 #Game State g_sabotageElapsedRoundTime = 0 g_sabotageNoHumanTimer = 0 #Set Tickets within MiniRound def sabotage_settickets(): global g_sabotagePlayers global g_sabotageNoHumanTimer #count alive players on each team. #if no alive players, end miniround g_sabotagePlayers[1] = 0 g_sabotagePlayers[2] = 0 humanPlayers = 0 for p in bf2.playerManager.getPlayers(): if p.isAlive(): g_sabotagePlayers[ p.getTeam() ] += 1 if not p.isAIPlayer(): humanPlayers = 1 emphprnt("Humanplayer = 1") else: pass if g_sabotageElapsedRoundTime > 60: emphprnt("Elapsedtime more than 60") if humanPlayers == 0: emphprnt("Humanplayers == 0") g_sabotageNoHumanTimer += 1 if g_sabotageNoHumanTimer > 30: if g_sabotagePlayers[2] > g_sabotagePlayers[1]: sabotage_endminiround(2, 0) elif g_sabotagePlayers[1] > g_sabotagePlayers[2]: sabotage_endminiround(1, 0) else: sabotage_endminiround(0,0) else: pass else: pass if g_sabotagePlayers[2] > 0: #No Team 1 left, Team 2 win if g_sabotagePlayers[1] < 1: sabotage_endminiround(2, 0) if g_sabotagePlayers[1] > 0: #No Team 2 left, Team 1 win if g_sabotagePlayers[2] < 1: sabotage_endminiround(1, 0) So far, thank you very much for helping me, I wouldn't have been able to make this without you help. Now I just need to test it, and then remove the text messages that are printed every second. Maybe work a little on the message when the round ends.
  3. Liguster

    Check If Any Human Players Are Alive.

    Something doesn't work. It doesn't end the miniround, but it also disables the the feature that ends the round when there are no players on one team. g_sabotagePlayers = [0,0,0] #Array for Player Numbers g_sabotageTeamScores = [0,0,0] #Array for Team Scores g_sabotageMiniRounds = 3 g_sabotageStartTimer = -1 #Start Timer g_sabotageStarted = 0 #Game State g_sabotageElapsedRoundTime = 0 tacTimer = None def onTimer(data): global g_sabotageStarted global g_sabotageStartTimer global g_sabotageElapsedRoundTime if g_sabotageStarted == 1: g_sabotageElapsedRoundTime += 1 # Round in progress, recalculate player numbers sabotage_settickets() elif g_sabotageStarted == 2: g_sabotageElapsedRoundTime = 0 # Miniround due to start, use timer to count down to miniround start # Count Timer Down g_sabotageStartTimer -= 1 if g_sabotageStartTimer == 0: # Set started state, start and round timer g_sabotageStarted = 1 g_sabotageStartTimer = -1 emphprnt("Game starting now... ") else: # Show mini round start timer in scores if g_sabotageStartTimer == 60: emphprnt("The game will be starting in 1 minute") if g_sabotageStartTimer == 30: emphprnt("The game will be starting in " + str( g_sabotageStartTimer ) + " seconds") if g_sabotageStartTimer == 20: if g_sabotageTeamScores[1] > g_sabotageTeamScores[2]: emphprnt(str( g_team_names[1] ) + " currently lead by " + str( g_sabotageTeamScores[1] ) + " game to " + str( g_sabotageTeamScores[2] ) ) if g_sabotageTeamScores[2] > g_sabotageTeamScores[1]: emphprnt(str( g_team_names[2] ) + " currently lead by " + str( g_sabotageTeamScores[2] ) + " game to " + str( g_sabotageTeamScores[1] ) ) if g_sabotageTeamScores[2] == g_sabotageTeamScores[1]: emphprnt("The match is currently a draw at " + str( g_sabotageTeamScores[2] ) + " game(s) each") if g_sabotageStartTimer == 15: emphprnt("The first team to win " + str( g_sabotageMiniRounds ) + " games will win the round") if g_sabotageStartTimer == 10: emphprnt("The game will be starting in " + str( g_sabotageStartTimer ) + " seconds") if g_sabotageStartTimer == 5: emphprnt("The game will be starting in " + str( g_sabotageStartTimer) + " seconds") if g_sabotageStartTimer == 3: emphprnt("The game will be starting in " + str( g_sabotageStartTimer ) + " seconds") sabotage_startminiroundA() if g_sabotageStartTimer == 2: emphprnt("The game will be starting in " + str( g_sabotageStartTimer ) + " seconds") if g_sabotageStartTimer == 1: emphprnt("The game will be starting in " + str( g_sabotageStartTimer ) + " second") sabotage_startminiroundB() elif g_sabotageStarted == 4: g_sabotageElapsedRoundTime = 0 # Round Finished, use timer to count down to officially end round # Count Timer Down g_sabotageStartTimer -= 1 if g_sabotageStartTimer < 1: g_sabotageStarted = 0 g_sabotageStartTimer = -1 # Update game score if g_sabotageTeamScores[1] == g_sabotageMiniRounds: bf2.gameLogic.setTickets(1, g_sabotageTeamScores[1]) bf2.gameLogic.setTickets(2, g_sabotageTeamScores[2]) host.sgl_endGame(1, 3) else: bf2.gameLogic.setTickets(2, g_sabotageTeamScores[2]) bf2.gameLogic.setTickets(1, g_sabotageTeamScores[1]) host.sgl_endGame(2, 3) else: if g_sabotageTeamScores[1] > g_sabotageTeamScores[2]: emphprnt(str( g_team_names[1] ) + " have won the match by " + str( g_sabotageTeamScores[1] ) + " games to " + str( g_sabotageTeamScores[2] ) ) else: emphprnt(str( g_team_names[2] ) + " have won the match by " + str( g_sabotageTeamScores[2] ) + " games to " + str( g_sabotageTeamScores[1] ) ) I believe that there is some sort of error in this part of the code: It just continues on after the last bot on one of teams have been killed. :s def sabotage_settickets(): global g_sabotagePlayers #count alive players on each team. #if no alive players, end miniround g_sabotagePlayers[1] = 0 g_sabotagePlayers[2] = 0 humanPlayers = 0 for p in bf2.playerManager.getPlayers(): if p.isAlive(): g_sabotagePlayers[ p.getTeam() ] += 1 if not p.isAIPlayer(): humanPlayers += 1 if humanPlayers == 0 and g_sabotageElapsedRoundTime > 30: sabotage_endminiroundtime() if g_sabotagePlayers[2] > 0: #No Team 1 left, Team 2 win if g_sabotagePlayers[1] < 1: sabotage_endminiround(2, 0) if g_sabotagePlayers[1] > 0: #No Team 2 left, Team 1 win if g_sabotagePlayers[2] < 1: sabotage_endminiround(1, 0) Do you know if it's possible to get the console to tell you everything that happens python wise? Would make it easier to see where the code fails.
  4. Liguster

    Check If Any Human Players Are Alive.

    Thank you very much, I really appreciate that you take your time to help me with my problem I'll try the code once I get time. Do know what will happen if the bots spawn a split second before the player? That happens sometimes and it would be pretty bad if that resulted in ending the miniround. Do you know if it's possible to use the miniround timer to call any checks? Like this: if g_sabotageTimer == 270: #it's likely called something else if p.ishumanplayer() and not p.isAlive(): sabotage_endminiroundtime()
  5. Liguster

    Check If Any Human Players Are Alive.

    Would it be possible to run something like this? #End miniround if no human players are alive def sabotage_endminiroundhumanplayers(): if g_sabotageStarted == 1: if newTime() =< 270 and not p.isAIPlayer() and not p.isAlive(): #I want to run this script 30 secs into the game and check if there are any non AI players who are dead sabotage_endminiroundtime() else: pass The newTime thing is called here def sabotage_startminiroundB(): newTime = 299 + ( host.timer_getWallTime() - g_timestart ) print host.rcon_invoke("sv.timeLimit " + str(newTime) ) sabotage_settickets() I'm very new to writing actual code, so I don't know how it works.
  6. Liguster

    Check If Any Human Players Are Alive.

    The problem is that the gamemode kills all players after each miniround. Meaning that I can't check for players once, but I have to check twice with at least 5 sec interval. Here is a download link to the gamemode script: http://peecee.dk/upload/download/352939
  7. Hey guys, I'm having a problem with a gamemode that I'm using. The problem is that because there is no respawn, the game can get pretty boring if you are killed in the beginning of the round and you have to wait up to 5 minutes (minirounds are 5 minutes). Therefor I'm searching for a script that will run this code at specific time. #End MiniRound because of time def sabotage_endminiroundtime(): # Whichever team has more alive players wins # Count Players sabotage_settickets() if g_sabotagePlayers[1] > g_sabotagePlayers[2]: sabotage_endminiround(1,3) elif g_sabotagePlayers[2] > g_sabotagePlayers[1]: sabotage_endminiround(2,3) else: #round is drawn sabotage_endminiround(0,0) One of the major problems is that there are times where no one is supposed to be alive and therefore I can't just check if anyone is alive. The method I'm thinking is usable is: Check if any human players are alive every 30(ish) secs, if there is no humans players alive, i'd like it to run the code listed above. I've already looked into the "antibotcamp" script, but there is still the problem with long wait times if the bot are running around without finding each other, and it happens to kill some bots when they respawned after a "miniround". I hope you guys can help me.
  8. Liguster

    Particle Collision

    Sup' guys I'm making an effect where it would be a nice detail if the particles would bounce on the ground. But I'm not sure if dice made it possible to do that in the game. It looks nice in the editor, but when I'm ingame they (the particles) will not bounce. Do I need anything else apart from: ObjectTemplate.collisionEnable 1 ? And could be something to do with having my settings on medium? Bonus: How do I make the particle affected be light? I mean, so that it's not always completely white, but a little darker if the light setting is dark. Full effect code: rem *** Generated with Bf2Editor.exe [created: 2005/3/24 14:57 <--- lies] ObjectTemplate.activeSafe EffectBundle e_exp_tornado ObjectTemplate.modifiedByUser Fred ObjectTemplate.saveInSeparateFile 1 ObjectTemplate.createdInEditor 1 rem ---BeginComp:WindAffector --- ObjectTemplate.createComponent WindAffector ObjectTemplate.windType Point ObjectTemplate.windIsDynamic 1 ObjectTemplate.windDirection 0/-1/0 ObjectTemplate.windSpeed 10 ObjectTemplate.windBlowTime -1 ObjectTemplate.windFalloff 10 ObjectTemplate.windRadialFalloff 5 rem ---EndComp --- ObjectTemplate.floaterMod 0 ObjectTemplate.hasMobilePhysics 0 rem ------------------------------------- ObjectTemplate.addTemplate S_e_exp_tornado_Start ObjectTemplate.addTemplate em_exp_tornado_sparks ObjectTemplate.setPosition 0/0.3/0 rem ------------------------------------- ObjectTemplate.setStartOnEffects 0 ObjectTemplate.setStopOnEffects 0 ObjectTemplate.timeToLive CRD_NONE/1/0/0 ObjectTemplate.randomAgeFactor CRD_NONE/1/0/0 ObjectTemplate.startAtCreation 0 ObjectTemplate.speedFromPhysics 0 ObjectTemplate.activeSafe Sound S_e_exp_tornado_Start ObjectTemplate.modifiedByUser Fred ObjectTemplate.createdInEditor 1 ObjectTemplate.soundFilename "bla bla bla" ObjectTemplate.loopCount 1 ObjectTemplate.is3dSound 1 ObjectTemplate.stopType 1 ObjectTemplate.volume 1 ObjectTemplate.pitch 1 ObjectTemplate.reverbLevel 1 ObjectTemplate.pitchEnvelope 0/1/0.9/1.1/1/1/0/0.9/1.1/ ObjectTemplate.minDistance 9 ObjectTemplate.halfVolumeDistance 20 ObjectTemplate.soundRadius 1 ObjectTemplate.create SpriteParticleSystem em_exp_tornado_sparks ObjectTemplate.modifiedByUser Fred ObjectTemplate.createdInEditor 1 ObjectTemplate.showInFirstPerson 1 ObjectTemplate.showInThirdPerson 1 ObjectTemplate.emitPrio High ObjectTemplate.lodDistance Medium ObjectTemplate.qualityLevel Low ObjectTemplate.emitterType Standard ObjectTemplate.isLocalSystem 0 ObjectTemplate.emitRadius 0/0/0 ObjectTemplate.emitRangeX CRD_NONE/0/0/0 ObjectTemplate.emitRangeY CRD_NONE/0/0/0 ObjectTemplate.emitRangeZ CRD_NONE/0/0/0 ObjectTemplate.randomRadialDirection 360 ObjectTemplate.radialDirection 0 ObjectTemplate.emitFrequency 1000 ObjectTemplate.preWarmTime 0.1 ObjectTemplate.emitTime 0.2 ObjectTemplate.emitDelay 0 ObjectTemplate.isLooping 0 ObjectTemplate.emitSpeed 30 ObjectTemplate.randomemitSpeed 5 ObjectTemplate.emitDirection 120/90/120 ObjectTemplate.timeToLive 10 ObjectTemplate.randomTimeToLive 0.05 ObjectTemplate.windAffectionFactor 0 ObjectTemplate.forceToWaterSurface 0 ObjectTemplate.waterSurfaceOffset 0.03 ObjectTemplate.rotationGraph 0/0/0/1 ObjectTemplate.alignRotationToSpeed 1 ObjectTemplate.transparencyGraph 0/-0.6/-0.33/1 ObjectTemplate.gravity -20 ObjectTemplate.gravityGraph 0/0/0/1 ObjectTemplate.airResistanceGraph -0.05/-2/3/0.11 ObjectTemplate.emitSpeedGraph 0/0/-0.42/1 ObjectTemplate.randomDirectionAngle 10/360/10 ObjectTemplate.airResistance 0.6 ObjectTemplate.collisionEnable 1 ObjectTemplate.collisionSpeedAlongNormal 0.6 ObjectTemplate.collisionSpeedAlongPlane 0.96 ObjectTemplate.randomSize 0 ObjectTemplate.particleMaxSize 0.015 ObjectTemplate.sizeGraph 0/0/0/1 ObjectTemplate.randomIntensity 0.0 ObjectTemplate.lightMapIntensityOffset 1 ObjectTemplate.color1 2/2/2 ObjectTemplate.color2 2/2/2 ObjectTemplate.colorBlendGraph 1/1/3/0 ObjectTemplate.alphaCull 0 ObjectTemplate.particleType Additive ObjectTemplate.drawOrder Front ObjectTemplate.randomRotation 0 ObjectTemplate.randomRotationSpeed 0 ObjectTemplate.rotationSpeed 0.25 ObjectTemplate.pivotOffset 0/0 ObjectTemplate.selfShadowIntensity 1 ObjectTemplate.textureName Objects\Effects\Textures\dirt\small_w ObjectTemplate.animationEnable 0 ObjectTemplate.animationSpeed 1 ObjectTemplate.animationPlayOnce 0 ObjectTemplate.setAnimationFrameWidthRelative 0 ObjectTemplate.setAnimationFrameHeightRelative 0 ObjectTemplate.animationRandomizedStartFrame 0 ObjectTemplate.animationFrameCount 0 ObjectTemplate.animationFrameCountX 0 ObjectTemplate.nearCullingEnable 1
  9. Liguster

    Airsoft Mod

    Some of the maps work in MP, but I don't know why some maps don't. Anyways, updated first post with new recruitment info.
  10. back home after 9 days at the Roskilde festival :P

  11. Hey guys I have a little problem. I have two gamemodes that I would like to have AI in when playing MP. Having one is quite easy. That is just using the coop gamemode. How do i get a second gamemode with AI? The alternative is to add up to 6 gamemodes to a map. ex: gpm_coop 16 gpm_coop 32 gpm_coop 64 gpm_coop ?? gpm_coop ?? gpm_coop ?? And then make the game (somehow) use different gamemodes. Hope you can help me Cheers
  12. Liguster

    Airsoft Mod

    Thread resurrection! I have now finished v0.5 of the mod Download link: http://www.moddb.com/mods/battlefield-2-airsoft/downloads/battlefield-2-airsoft Have fun
  13. Liguster

    Changing Projectile Material.

    It seems to be harder than I thought, and I really don't have the time for such a minor thing. I will start working on it again, when my mod is released.
  14. Liguster

    Changing Projectile Material.

    Would you mind posting a example of your code? Thanks. BTW thanks reminding me about the doppler, I'll need to find a away to do that.
  15. Liguster

    Changing Projectile Material.

    I'm not able to change the sound that way apparently. When changing the material to 2011 there is no sound at all, although this will be tested through with a sound that I know works later. The rem ------------------------------------- ObjectTemplate.addTemplate S_usrif_m24_Projectile_Looping rem ------------------------------------- Didn't change anything and I was able to remove the sound by changing only the projectile material.
×