Forgotten Hope Public Forum

Forgotten Hope 2 => Modding => Topic started by: roekeloos[NL] on 09-04-2009, 16:04:17

Title: objective
Post by: roekeloos[NL] on 09-04-2009, 16:04:17
can someone make a tut about how it works i want to make my new map a obj map so please help me out what i need to do for the allies to destroy airplanes on the airfield
Title: Re: objective
Post by: azreal on 09-04-2009, 20:04:22
Well the only planes that are coded to be used in objective mode are the (non-flyable) MC 202s. Try looking at how it was done on Op. Hyacinth.

EDIT: see Natty's post. Its much better :D

P.S. and please try to use some punctuation next time ;)
Title: Re: objective
Post by: Natty on 09-04-2009, 21:04:42
Roekekloos you can take any plane you want and make it destroyable/objective

but there is no tutorial really... you need to learn BF2 scripting.. sorry to say it, but you cant make an objective map without first study the game mechanics... Read on bfeditor, ask devs (more precise questions, for ex "How do I disable the engine in the plane", start a thread with pictures of your map, etc..

I suggest look in op. hyacinth map, all files, dissect it. The plane is not hard to fix, you can make an objective tank or any object that is allready destroyable (has hitpoints + wreck) and use it. (can attach spawnpoints to it also)
Good luck!
Title: Re: objective
Post by: Schism-RvtL on 10-04-2009, 09:04:04
This is not a complete tutorial but I hope this will give you (and others) a good idea of how the mode works.

First you have to place the vehicles you want to use as objects (just like putting regular vehicles on the map). The vehicles have to spawn at the controlpoint you want to affect when those vehicles are destroyed.

Check the mapdata.py used for Hyacinth (located in the level folder of Hyacinth). As you can see the plugin ‘destroyObjective’ is imported, you can find the corresponding python file in the python folder (default= C:\Program Files\EA GAMES\Battlefield 2\mods\fh2\python\game\plugins):

Code: [Select]
from game.plugins import plugin, destroyObjective, limitKit
What controlpoints, number of objects and objects are used are defined here:

Code: [Select]
objective_32 = [
    plugin(destroyObjective, controlpoint = 'CP_64_Hy_Airfield', \
                             refcount = 6, \
                             template = 'mc202_objective'),
    plugin(destroyObjective, controlpoint = 'CP_64_Hy_BarceCompound', \
                             refcount = 4, \
                             template = 'pziic'),
    plugin(destroyObjective, controlpoint = 'CP_32_Hyacinth_Barce', \
                             refcount = 2, \
                             template = ['hqradio1','hqradio2']),
]
As you can see the Airfield will be captured by the british if they destroy 6 planes (mc202). The name of the object is the exact name used in the gameplayobjects.con.

This tells the game when the objective mode is used (the 32-players map in conquest mode):

Code: [Select]
gpm_cq = {
  16: common_kitlimit,
  32: common_kitlimit + objective_32,
  64: common_kitlimit,
}

Things like locking the vehicles is done in the tmp.con (located in the server.zip). The entry radius of the pz2 is changed to 0 to prevent players from entering and moving them.

Code: [Select]
rem disable pziic
ObjectTemplate.activeSafe EntryPoint pziic_EntryPoint
ObjectTemplate.setEntryRadius 0

The following lines change how the pz2 can be destroyed.

Code: [Select]
rem make pziic never destroyable
ObjectTemplate.activeSafe PlayerControlObject pziic
ObjectTemplate.armor.canBeRepairedWhenWreck 0
ObjectTemplate.armor.wreckExplosionForce 7
ObjectTemplate.armor.wreckExplosionMaterial 70
ObjectTemplate.armor.wreckHitPoints 500
ObjectTemplate.armor.timeToStayAsWreck 60
ObjectTemplate.armor.criticalDamage 500
ObjectTemplate.armor.canBeDestroyed 1
ObjectTemplate.armor.defaultMaterial 127

The icon for the minimap is replaced for a yellow star to indicate it is an objective:

Code: [Select]
rem objective icon
ObjectTemplate.vehicleHud.miniMapIcon Ingame\Vehicles\Icons\Minimap\mini_Objective.dds

I think this prevents a destroyed pz2 from damaging the nearby panzers but I’m not sure:

Code: [Select]
rem and don't cause huge explosion
ObjectTemplate.armor.explosionForce 15
ObjectTemplate.armor.explosionForceMod 7
ObjectTemplate.armor.explosionForceMax 4000
ObjectTemplate.armor.explosionDamage 0
ObjectTemplate.armor.explosionRadius 0
ObjectTemplate.armor.explosionMaterial 99

The code in the tmp.con is not required so you can decide whether an objective should be able to move etc.

You can copy the files from Hyacinth and change them to use on your map.
Title: Re: objective
Post by: roekeloos[NL] on 10-04-2009, 10:04:59
okeey thanxs guys i gonna take a look
Title: Re: objective
Post by: 508th PIR Hawkeye on 10-04-2009, 22:04:47
Roekekloos you can take any plane you want and make it destroyable/objective

but there is no tutorial really... you need to learn BF2 scripting.. sorry to say it, but you cant make an objective map without first study the game mechanics... Read on bfeditor, ask devs (more precise questions, for ex "How do I disable the engine in the plane", start a thread with pictures of your map, etc..

I suggest look in op. hyacinth map, all files, dissect it. The plane is not hard to fix, you can make an objective tank or any object that is allready destroyable (has hitpoints + wreck) and use it. (can attach spawnpoints to it also)
Good luck!

Thx Natty! Goin to use it! :D


Edit: Are there other FH 2 maps who use this objective mode Natty?