Jump to content
Official BF Editor Forums

hjid27

Members
  • Content count

    138
  • Joined

  • Last visited

Community Reputation

0 Neutral

1 Follower

About hjid27

  • Rank
    Member
  • Birthday 07/27/1993

Profile Information

  • Gender
    Male
  • Location
    Bergen

Recent Profile Visitors

5,407 profile views
  1. hjid27

    When Are P.getdefaultvehicle(), P.getvehicle() Equal?

    When you are sitting in an open seat like the 3rd seat on a vodnik, getVehicle() will return the soldier. The soldier will however be a child of the vehicle. You could try to do: if p.getDefaultVehicle().getParent() == None:
  2. hjid27

    Square Minimap

    Copy the bf2/menu_client.zip/atlas/MemeAtlas_020.dds to your mod. Open it up with an image editing program like photoshop or gimp. (dds plugins can be found here if you don't have them: http://www.bfeditor.org/forums/index.php?showtopic=4323) If you're using photoshop go to channels and select "Alpha 1". In Gimp it will be called "Alpha". The completely filled white circle on the top row is the mask for the minimap. The circle next to it is the shadow that is around the edges of the minimap. Make a white square over the white circle and edit the shadow image next to it to be a square too. Save the file as a dds file using DXT5 ARGB and choose "No MIP maps". Repack it into your mod and you should have a square minimap.
  3. hjid27

    Auto Spawnpoint Question

    I think the SetSpawnPoint is a true/false setting as you can see in the HudElementsSpawn.con. hudBuilder.createButtonNode IngameHud MinimizeSpawnButton 770 31 16 16 hudBuilder.setButtonNodeTexture 2 Ingame/GeneralIcons/empty.tga hudBuilder.setButtonNodeTexture 1 Ingame/GeneralIcons/empty.tga hudBuilder.setButtonNodeConCmd "hudItems.setBool SetSpawnPoint 0" 3 Since you only got one cp for each team you can do it through python. import host import bf2 mapDict = { "kubra_dam":[1,2], "iron_gator":[2,1] } def init(): host.registerHandler("RemoteCommand", onRemoteCommand) def onRemoteCommand(playerId, cmd): #Singleplayer fix if playerId == -1: playerId = 255 player = bf2.playerManager.getPlayerByIndex(playerId) if cmd == "spawn": mapName = host.sgl_getMapName().lower() spawnGroupInfo = mapDict[mapName] team = player.getTeam() groupId = spawnGroupInfo[team-1] player.setSpawnGroup(groupId) Because I don't really have a clue on how the spawngroup id's are managed, I used a dictionary based on mapnames to handle it. The first number in the list is the spawngroup id for team 1 and the second is the id for team 2.
  4. hjid27

    Hudelements Coodinates Question

    The whole HUD area is 800x600 regardless of your resolution. An image with the position (400,300) would be in the center of your screen even though your resolution is 1366x768. The same goes for the size: An image with the size of 800x600 would cover the whole screen. If you're going to design on top of a screenshot I would advise you to take a screenshot with your resolution at 800x600.
  5. hjid27

    Running A Script Every 30 Seconds

    Well I'm not completely sure but I think that to change the sun/light settings you would have to make the clients run the files, which makes python kinda useless since it's server side. What you could do is to have an invisible button covering the whole screen that would run a script when your mouse is over it, which makes it run all the time. You could then make the script check if certain files existed and then have an external program to make these change these files based on the time on your computer. The shadows might look a bit weird for statics and stuff.
  6. hjid27

    Running A Script Every 30 Seconds

    If it's only server side I don't really see why you wouldn't use python to do it. It would be easier to help if we knew what you were trying to do.
  7. Some people have asked me if I could give some info on how control points on vehicles work, and with how much I've learned from bfeditor.org I guess I have to contribute a bit. No, I'm not talking about a flag you can add to a vehicle so you have a mobile control point. I'm talking about this: http://www.xfire.com/video/4cfaea/ As you can see in this concept video for Alpha Project, there are destroyable windows and first person hands in the vehicle. If you have tried out the mod you have probably noticed that the 1p hands on the steering wheels and mounted weapons change with the team. If a player on the MEC team enters the civillian car the MEC 1p hands are shown. For a USMC player the USMC hands are shown. This even works on a multiplayer server, but how do we do it? The answer is control points, or flags as people often call them. Flags are one of the few things that BF2 actually use python to manage. Due to code that remained from refractor engine 1 or developers having plans for mobile flags in BF2, the flags can be attached to vehicles and managed by python. By managing, I'm talking about changing the team on the control point so it displays another flag on the flagpole. Instead of changing between a US and a MEC flag, you can set different flag templates on the control point. Example: Hands on Steeringwheel ObjectTemplate.create ControlPoint civ2_hands ObjectTemplate.activeSafe ControlPoint civ2_hands ObjectTemplate.modifiedByUser "Hjid" ObjectTemplate.setNetworkableInfo ControlPointInfo ObjectTemplate.isNotSaveable 1 ObjectTemplate.hasMobilePhysics 0 ObjectTemplate.hasCollisionPhysics 0 ObjectTemplate.physicsType Mesh ObjectTemplate.setControlPointName civ_flag ObjectTemplate.radius 0 ObjectTemplate.showOnMinimap 0 ObjectTemplate.team 0 ObjectTemplate.areaValueTeam1 34 ObjectTemplate.areaValueTeam2 34 ObjectTemplate.timeToGetControl 999999999999 ObjectTemplate.timeToLoseControl 999999999999 ObjectTemplate.hoistMinMax 0.0/0.0 ObjectTemplate.flagTemplateTeam0 nothing ObjectTemplate.flagTemplateTeam1 civ2_mec_hands ObjectTemplate.flagTemplateTeam2 civ2_us_hands This should be the standard template for a flag that you want to attach to a vehicle. Further explanation: ObjectTemplate.create ControlPoint civ2_hands ObjectTemplate.activeSafe ControlPoint civ2_hands ObjectTemplate.modifiedByUser "Hjid" ObjectTemplate.setNetworkableInfo ControlPointInfo ObjectTemplate.isNotSaveable 1 ObjectTemplate.hasMobilePhysics 0 ObjectTemplate.hasCollisionPhysics 0 ObjectTemplate.physicsType Mesh ObjectTemplate.setControlPointName civ_flag Regular control point code for creating a template. ObjectTemplate.radius 0 Since we don't want the control point to be captured by players, we simply remove the flags with a "radius 0" from the list of flags in the conquest gamemode file. ObjectTemplate.showOnMinimap 0 If we didn't use this line, there would be a minimap flag at the center of the minimap("0,0" coordinates). ObjectTemplate.team 0 ObjectTemplate.areaValueTeam1 34 ObjectTemplate.areaValueTeam2 34 ObjectTemplate.timeToGetControl 999999999999 ObjectTemplate.timeToLoseControl 999999999999 ObjectTemplate.hoistMinMax 0.0/0.0 Standard values for the flags, doesn't matter since the flags aren't taken into consideration in the conquest gamemode file(See "radius 0"). ObjectTemplate.flagTemplateTeam0 nothing ObjectTemplate.flagTemplateTeam1 civ2_mec_hands ObjectTemplate.flagTemplateTeam2 civ2_us_hands Probably the most interesting part. By setting the flagTemplate to a template that doesn't exist, the control point will not show anything. This control point will be empty when the team is 0. (Neutral) The civ2_mec_hands and civ2_us_hands are simpleObjects without any networkable info. GeometryTemplate.create BundledMesh civ2_us_hands ObjectTemplate.create SimpleObject civ2_us_hands ObjectTemplate.saveInSeparateFile 1 ObjectTemplate.creator RHYS-COMPUTER:Rhys ObjectTemplate.geometry civ2_us_hands GeometryTemplate.setSubGeometryLodDistance 1 0 0.001 include civ2_us_hands.tweak We use the lodDistance to toggle how far away you should be able to see the hands, so you can't see them through the window. The tweak file does not exist. To add the control point to a vehicle you just add it as you would with any other object. ObjectTemplate.activeSafe RotationalBundle CivilianCar2_Steeringwheel ObjectTemplate.modifiedByUser "Administrator" ObjectTemplate.setNetworkableInfo BasicInfo ObjectTemplate.floaterMod 0 ObjectTemplate.hasMobilePhysics 1 rem ------------------------------------- ObjectTemplate.addTemplate civ2_hands ObjectTemplate.setPosition -0.01020/-0.10596/-0.14147 ObjectTemplate.setRotation 1.5/-25.0/-2.25 That is about all you need to know about the con/tweak coding. Python Code There isn't really anything special in the python code, we use the same code that is used to change flags in the gpm_cq.py file. Highly simplified example: def onEnterVehicle(player, vehicle, freeSoldier = False): for child in vehicle.getChildren(): if child.templateName == "civ2_hands": child.cp_setParam("flag",0) child.cp_setParam("flag",player.getTeam()) def onExitVehicle(player, vehicle): for child in vehicle.getChildren(): if child.templateName == "civ2_hands": child.cp_setParam("flag",0) Notice that we on the enterVehicle function have to first set the control point to team 0 and then to the correct team. This is to fix bugs due to the flag only updating for the player when changing team. The part that is important for the flags is: controlPoint.cp_setParam("flag",team) Where the controlPoint is the object and team is an integer being either 0, 1 or 2. This example only shows how to add simpleObjects as flagtemplates, but it would be the same procedure for other types of objects. As far as I know SimpleObjects, Bundles, Effects and AnimatedBundles are the objects that seem to work fine as flagTemplates. Setting the flagTemplates to a PCO or a destroyable object causes a crash, so to have destroyable stuff on your vehicle you will have to make a bundle with an armor component and change the flag through python based on damage. There is probably a lot of stuff you can do with these flags, so I hope that this was somewhat helpful
  8. hjid27

    Teleport?

    Well the macro is pretty primitive. It's just a hotkey script that spams F12 all the time, which I map to the pickup function c_PIDrop on mod startup. This does although alter the controls.con file of the user, so a program to backup the controls.con and then set it back after you exit the mod would be a good idea. The F12 is then the alternative key to c_PIDrop, so it allows for the G to stay unchanged. I have to do some nifty reposition of players and kits to make them pick up the kit that I want, since they're picking up every kit that would lay on their feet because of the macro. It would probably be easier for the vehicles since you can edit the radius of the entry/exit point, where the radius of the kit is approximately 3m.
  9. hjid27

    Teleport?

    Well I'm currently using macro that just spams the pickup button, making the player always pick up the kit that you spawn at his feet. You can then control which kit a player has through python. We could probably use the same concept for vehicles instead of kits. You have a macro that spams the EnterVehicle button (I usually remap these buttons to the F10-F12 buttons to prevent "eeeeeeeeeee"s and "gggggggg"s in the chat). You can then position the enter/exit-points to the correct player to force him in/out of a vehicle. The downside is that you would have to add a comrose option or similar for enter/exit vehicle.
  10. hjid27

    Bf2Tech Wiki

    http://web.archive.org/web/20110625143657/http://bf2tech.org/index.php/Main_Page WayBackMachine seems to still have most of the site. It's kinda slow somtimes, so I think it would be great to have it uploaded somewhere else.
  11. hjid27

    Hud Messages In Python

    If you want to edit the hud locally to display text you can for example use: host.rcon_invoke('hudBuilder.createTextNode SpecopsSplit TestLabel_1 0 0 54 17') host.rcon_invoke('hudBuilder.setTextNodeString "%s"' % text) This works as long as you have already made a TestLabel_1 in the menu_server.
  12. hjid27

    Looking For A Few Python Commands.

    Look at amideadyets post. host.rcon_invoke("object.listObjectsofTemplate") This line gives you a string containing all of the ids. Just active each id, check the position of the object with: host.rcon_invoke("object.absolutePosition") And then compare this position to the position you get with the getPosition function in python. Also a little tip, you need to have a small delay between disabling the collision and moving the player on a dedicated server.
  13. ObjectTemplate.dontAllowExit 1
  14. Well, I've been looking for a way to edit the radius where you can pickup a kit, but I can't seem to find one. Right now you can pick up a kit by standing a meter away from it, and I'm wondering if there is a way I can make the kits so that you need to stand right on top of them to pick them up. And is there a way to edit the delay between picking up kits?
  15. hjid27

    Bf2 3Ds Max 9 Tools Aren't Working

    Max 2009 is not the same as Max 9.
×