BF2.US bf2-rsdeveloper wiki Parity Discord bf2.us
generated from the code
On this page

host.Object methods

Scripts never construct host.Object; they receive one from host.omgr_getObjectsOfType, pmgr_p_get('vehicle', ...), handler arguments and similar. Each method below is bound on every such object.

All methods#

A game cell holds the original method's address in that game where it is known (BF2: bf2_w32ded.exe or BF2.exe; Heroes: BFHeroes.exe 1.89). Every badge is server: only the machine that hosts the game (the dedicated server, or a client hosting a local game) runs the game scripts, so a Python mod is a server-side mod (the Python layer).

Scope badges
serveronly the server reads it: a mod on the server alone takes effect, players need nothingclientonly the game client reads it (drawing, sound, HUD): every player who should see it needs the modsharedthe server and every client read it: both need the same files, or the clients' view jumpsyesthe game has it; nobody has classified its scope yet
BF22142HeroesA game column holds that game's badge and the argument types its program registers; an empty cell means the game does not know the name. The Notes column gives the reason (how the scopes are worked out).
NameBF22142HeroesNotes
getPositionserver 0x00534ff0serverserver 0x0066e422 (1.89)obj.getPosition()
setPositionserver 0x00535030serverserver 0x0066e451 (1.89)obj.setPosition(vec3)
getRotationserver 0x005350a0serverserver 0x0066e4a5 (1.89)obj.getRotation()
setRotationserver 0x005350e0serverserver 0x0066e4d9 (1.89)obj.setRotation(vec3)
getChildrenserver 0x00535990serverserver 0x0066f242 (1.89)obj.getChildren()
getParentserver 0x00535b30serverserver 0x0066f110 (1.89)obj.getParent()
getDamageserver 0x00535150serverserver 0x0066e57d (1.89)obj.getDamage()
setDamageserver 0x005351b0serverserver 0x0066e614 (1.89)obj.setDamage(value)
getTemplatePropertyserver 0x00535220serverserver 0x0066e715 (1.89)obj.getTemplateProperty(name)
isValidserver 0x00534c90serverserver 0x0066e371 (1.89)obj.isValid()
getOccupyingPlayersserver 0x00535b70serverserver 0x0066f13b (1.89)obj.getOccupyingPlayers()
getIsRemoteControlledserver 0x00535a10serverserver 0x0066f1c3 (1.89)obj.getIsRemoteControlled()
getIsWreckserver 0x00535400serverserver 0x0066e895 (1.89)obj.getIsWreck()
getTeamserver 0x00535450serverserver 0x0066e8df (1.89)obj.getTeam()
cp_getParamserver 0x00535d80serverserver 0x0066f2b9 (1.89)obj.cp_getParam(name[, team])
cp_setParamserver 0x005354a0serverserver 0x0066e941 (1.89)obj.cp_setParam(name, value[, extra])
getMaxDamageserverserver 0x0066e5c7 (1.89)obj.getMaxDamage(...)
isTitanserverserver 0x0066eff5 (1.89)obj.isTitan(...)
getNetworkIdserver 0x0066e530 (1.89)obj.getNetworkId(...)
getXPDamageModserver 0x0066e676 (1.89)obj.getXPDamageMod(...)
getXPHealModserver 0x0066e6c5 (1.89)obj.getXPHealMod(...)
soldier_getParamserver 0x0066eb48 (1.89)obj.soldier_getParam(...)
soldier_setParamserver 0x0066ec1e (1.89)obj.soldier_setParam(...)
getAssetIdserver 0x0066ed03 (1.89)obj.getAssetId(...)

Methods in detail#

getPosition#

BF22142Heroes
python
obj.getPosition()
FactDetail
Arguments (as parsed)Obj@0
Returns(f,f,f)
ErrorsE3
Original codebf2_w32ded.exe!0x00534ff0, BF2.exe!0x00591590, BFHeroes.exe (1.89)!0x0066e422
bf2-rscrates/bf2-server/src/objects.rs:1302

What it does (from the original code). IObject vt+0x68() position.

Shipped scripts use it like this:

BF2: mods/sandbox/python/game/gamemodes/addons/jump.py:16
pPos = p.getPosition()
2142: mods/bf2142/python/game/gamemodes/gpm_ca.py:554
print vehicle.getPosition()
Heroes: mods/bfheroes/python/game/scoringCommon.py:933
titanPos = titan.getPosition()

setPosition#

BF22142Heroes
python
obj.setPosition(vec3)
FactDetail
Arguments (as parsed)Obj@0 vec3@1
ReturnsNone
ErrorsE3,E4
Original codebf2_w32ded.exe!0x00535030, BF2.exe!0x00591600, BFHeroes.exe (1.89)!0x0066e451
bf2-rscrates/bf2-server/src/objects.rs:1313

What it does (from the original code). IObject vt+0x6c(&vec).

Shipped scripts use it like this:

BF2: mods/sandbox/python/game/gamemodes/sbxCore.py:134
o.setPosition(oPos)

getRotation#

BF22142Heroes
python
obj.getRotation()
FactDetail
Arguments (as parsed)Obj@0
Returns(f,f,f)
ErrorsE3
Original codebf2_w32ded.exe!0x005350a0, BF2.exe!0x00591700, BFHeroes.exe (1.89)!0x0066e4a5
bf2-rscrates/bf2-server/src/objects.rs:1347

What it does (from the original code). 0x00536310: angles from the world matrix (vt80 if +0x28==0 else vte4) via 0x0068a720, negated and reordered; convention unverified.

Shipped scripts use it like this:

BF2: mods/sandbox/python/game/gamemodes/sbxGame_build.py:1565
rot = x.getRotation()
2142: mods/bf2142/python/game/gamemodes/gpm_ca.py:555
print vehicle.getRotation()

setRotation#

BF22142Heroes
python
obj.setRotation(vec3)
FactDetail
Arguments (as parsed)Obj@0 vec3@1
ReturnsNone
ErrorsE3,E4
Original codebf2_w32ded.exe!0x005350e0, BF2.exe!0x00591780, BFHeroes.exe (1.89)!0x0066e4d9
bf2-rscrates/bf2-server/src/objects.rs:1353

What it does (from the original code). 0x0044d050 (rotation from angles).

Shipped scripts use it like this:

BF2: mods/sandbox/python/game/gamemodes/sbxCore.py:135
o.setRotation(oRot)

getChildren#

BF22142Heroes
python
obj.getChildren()
FactDetail
Arguments (as parsed)Obj@0
Returnstuple(host.Object)
ErrorsE3
Original codebf2_w32ded.exe!0x00535990, BF2.exe!0x00592660, BFHeroes.exe (1.89)!0x0066f242
bf2-rscrates/bf2-server/src/objects.rs:1363

What it does (from the original code). Child list from vt+0xec, linked by +0x2c.

Shipped scripts use it like this:

BF2: mods/sandbox/python/game/gamemodes/sbxPlayerManager.py:84
kids = parent.getChildren()

getParent#

BF22142Heroes
python
obj.getParent()
FactDetail
Arguments (as parsed)Obj@0
Returns`host.ObjectNone`
ErrorsE3
Original codebf2_w32ded.exe!0x00535b30, BF2.exe!0x00592880, BFHeroes.exe (1.89)!0x0066f110
bf2-rscrates/bf2-server/src/objects.rs:1373

What it does (from the original code). Parent object as host.Object.

Shipped scripts use it like this:

BF2: python/bf2/ObjectManager.py:15
parent = obj.getParent()
2142: python/bf2/ObjectManager.py:15
parent = obj.getParent()
Heroes: python/bf2/ObjectManager.py:15
parent = obj.getParent()

getDamage#

BF22142Heroes
python
obj.getDamage()
FactDetail
Arguments (as parsed)Obj@0
Returns`floatNone`
ErrorsE3
Original codebf2_w32ded.exe!0x00535150, BF2.exe!0x00591880, BFHeroes.exe (1.89)!0x0066e57d
bf2-rscrates/bf2-server/src/objects.rs:1401

What it does (from the original code). Armor component (+0x3c) vt+0x3c(); None if no armor. Only bound when hasArmor.

Shipped scripts use it like this:

BF2: mods/sandbox/python/game/gamemodes/sbxGame_build.py:122
if o.getDamage() > 0:
2142: mods/bf2142/python/game/gamemodes/gpm_ti.py:179
newHealth = object.getDamage() - hitPoints

setDamage#

BF22142Heroes
python
obj.setDamage(value)
FactDetail
Arguments (as parsed)Obj@0 f@1
ReturnsNone
ErrorsE3,missing arg
Original codebf2_w32ded.exe!0x005351b0, BF2.exe!0x00591910, BFHeroes.exe (1.89)!0x0066e614
bf2-rscrates/bf2-server/src/objects.rs:1487

What it does (from the original code). Armor component vt+0x38((float)value). Only bound when hasArmor.

Shipped scripts use it like this:

BF2: mods/sandbox/python/game/gamemodes/addons/kill.py:49
p.getVehicleRoot().setDamage(0.1)

getTemplateProperty#

BF22142Heroes
python
obj.getTemplateProperty(name)
FactDetail
Arguments (as parsed)Obj@0 s@1
Returns`strNone`
ErrorsE3,missing arg
Original codebf2_w32ded.exe!0x00535220, BF2.exe!0x00591a10, BFHeroes.exe (1.89)!0x0066e715
bf2-rscrates/bf2-server/src/objects.rs:1378

What it does (from the original code). name containing " \n\r\t" -> None. Else selects the object's template (DAT_0089ae4c vt+0x58), runs console "objectTemplate.<name>\n" with output level 2 and returns the captured output string.

Shipped scripts use it like this:

BF2: mods/bf2/python/game/gamemodes/gpm_coop.py:57
radius = float(obj.getTemplateProperty('radius'))
2142: mods/bf2142/python/game/gamemodes/gpm_ca.py:69
radius = float(obj.getTemplateProperty('radius'))
Heroes: mods/bfheroes/python/game/gamemodes/gpm_cq.py:422
radius = float(obj.getTemplateProperty('radius'))

isValid#

BF22142Heroes
python
obj.isValid()
FactDetail
Arguments (as parsed)T@0
Returnsint(0/1)
Errorstoken errors
Original codebf2_w32ded.exe!0x00534c90, BF2.exe!0x00591230, BFHeroes.exe (1.89)!0x0066e371
bf2-rscrates/bf2-server/src/objects.rs:1294

What it does (from the original code). 1 while the engine object behind the token still exists.

Shipped scripts use it like this:

BF2: mods/sandbox/python/game/gamemodes/sbxCore.py:136
if o_obj.isValid():
2142: mods/bf2142/python/game/scoringCommon.py:842
if object.isValid():
Heroes: mods/bfheroes/python/game/gamemodes/gpm_cq.py:247
if not cp.isValid():

getOccupyingPlayers#

BF22142Heroes
python
obj.getOccupyingPlayers()
FactDetail
Arguments (as parsed)Obj@0
Returnstuple(Player)
ErrorsE3
Original codebf2_w32ded.exe!0x00535b70, BF2.exe!0x005928f0, BFHeroes.exe (1.89)!0x0066f13b
bf2-rscrates/bf2-server/src/objects.rs:1453

What it does (from the original code). Players of this PCO and all child PCOs (0x00535a90). Only bound for PCOs.

Shipped scripts use it like this:

BF2: mods/bf2/python/game/gamemodes/gpm_coop.py:603
for p in o.getOccupyingPlayers():
2142: mods/bf2142/python/game/gamemodes/gpm_ca.py:682
for p in o.getOccupyingPlayers():
Heroes: mods/bfheroes/python/game/gamemodes/gpm_cq.py:757
for p in o.getOccupyingPlayers():

getIsRemoteControlled#

BF22142Heroes
python
obj.getIsRemoteControlled()
FactDetail
Arguments (as parsed)Obj@0
Returnsint(0/1)
ErrorsE3
Original codebf2_w32ded.exe!0x00535a10, BF2.exe!0x00592720, BFHeroes.exe (1.89)!0x0066f1c3
bf2-rscrates/bf2-server/src/objects.rs:1467

What it does (from the original code). 1 if any child's template class id is 0x9c42. Only bound for PCOs.

Shipped scripts use it like this:

BF2: mods/bf2/python/game/scoringCommon.py:133
if object and object.isPlayerControlObject and object.getIsRemoteControlled():
2142: mods/bf2142/python/game/scoringCommon.py:528
if vehicle.getIsRemoteControlled() and not checkTitan(vehicle):
Heroes: mods/bfheroes/python/game/scoringCommon.py:652
if vehicle.getIsRemoteControlled() and not checkTitan(vehicle):

getIsWreck#

BF22142Heroes
python
obj.getIsWreck()
FactDetail
Arguments (as parsed)Obj@0
Returnsint(0/1)
ErrorsE3
Original codebf2_w32ded.exe!0x00535400, BF2.exe!0x00591c90, BFHeroes.exe (1.89)!0x0066e895
bf2-rscrates/bf2-server/src/objects.rs:1436

What it does (from the original code). Armor component vt+0x5c() == 1. Only bound for PCOs.

Shipped scripts use it like this:

BF2: Admin/standard_admin/tk_punish.py:119
if object != None and object.getIsWreck():
2142: Admin/standard_admin/tk_punish.py:124
if object != None and object.getIsWreck():
Heroes: mods/bfheroes/python/game/scoringCommon.py:351
if object != None and object.getIsWreck():

getTeam#

BF22142Heroes
python
obj.getTeam()
FactDetail
Arguments (as parsed)Obj@0
Returnsint
ErrorsE3
Original codebf2_w32ded.exe!0x00535450, BF2.exe!0x00591d10, BFHeroes.exe (1.89)!0x0066e8df
bf2-rscrates/bf2-server/src/objects.rs:1444

What it does (from the original code). (vt+0xc(0xc4c5)) vt+0x98(). Only bound for PCOs.

Shipped scripts use it like this:

BF2: mods/bf2/python/game/gamemodes/gpm_coop.py:305
if p.getTeam() == 1:
2142: mods/bf2142/python/game/gamemodes/gpm_ca.py:347
if p.getTeam() == 1:
Heroes: mods/bfheroes/python/game/gamemodes/gpm_tut.py:284
if p.getTeam() == 1:

cp_getParam#

BF22142Heroes
python
obj.cp_getParam(name[, team])
FactDetail
Arguments (as parsed)Obj@0 s@1 [i@2]
Returns`intfloattuple`
ErrorsE3,missing arg,"object isn't a control point","invalid team","bad attribute"
Original codebf2_w32ded.exe!0x00535d80, BF2.exe!0x00592bc0, BFHeroes.exe (1.89)!0x0066f2b9
bf2-rscrates/bf2-server/src/objects.rs:1396

What it does (from the original code). CP interface vt+0xc(0xc4d1), CP template = template vt+0xc(0xc4d3). team int; takeOverChangePerSecond float; onlyTakeableByTeam, unableToChangeTeam, isHemisphere, supplyGroupId (template); supplyValueNeeded/supplyValue(team) int; areaValue(team 1|2) int; allowCaptureByTeam(team) int; timeToLoseControl/timeToGetControl float; enemyTicketLossWhenCaptured int; supplyGroupsNeeded(team) -> ((int, x), ...); flag int; capturingState int; hasGreyCapturingState int.

Shipped scripts use it like this:

BF2: mods/bf2/python/game/gamemodes/gpm_coop.py:143
team = obj.cp_getParam('team')
2142: mods/bf2142/python/game/gamemodes/gpm_ca.py:157
team = obj.cp_getParam('team')
Heroes: mods/bfheroes/python/game/gamemodes/gpm_cq.py:532
team = obj.cp_getParam('team')

cp_setParam#

BF22142Heroes
python
obj.cp_setParam(name, value[, extra])
FactDetail
Arguments (as parsed)`Obj@0 s@1 then i@2f@2 [i@3]`
ReturnsNone
ErrorsE3,missing arg,"object isn't a control point","bad attribute"
Original codebf2_w32ded.exe!0x005354a0, BF2.exe!0x00591d90, BFHeroes.exe (1.89)!0x0066e941
bf2-rscrates/bf2-server/src/objects.rs:1397

What it does (from the original code). team vt18(v); playerId vt20(v); takeOverChangePerSecond vt3c((float)v); allowCaptureByTeam vt30(args[2], args[3] > 0) (reads i@3 then i@2); flag vt4c(v, 0); capturingState vt54(v).

Shipped scripts use it like this:

BF2: mods/xpack/python/game/gamemodes/gpm_coop.py:356
cp.cp_setParam('flag', 0)
2142: mods/bf2142/python/game/gamemodes/gpm_ca.py:533
cp.cp_setParam('team', newTeam)
Heroes: mods/bfheroes/python/game/gamemodes/gpm_hoth.py:261
cp.cp_setParam('team', 0)

getMaxDamage#

2142Heroes
python
obj.getMaxDamage(...)
FactDetail
Original codeBFHeroes.exe (1.89)!0x0066e5c7
bf2-rscrates/bf2-server/src/objects.rs:1413

What it does (from the bf2-rs port). BFHeroes.exe!0x0066e5c7: same behaviour (the key chain and calls match, vtable offsets shifted). 2142 only: object_getMaxDamage (bf2142ded!0x08163a80): argObject_IObject(0); the armor component (2142 object +0x44) vt+0x8c as a float.

Shipped scripts use it like this:

2142: mods/bf2142/python/game/gamemodes/gpm_ti.py:187
ticketsTeam = 100.0*(newHealth/object.getMaxDamage())
Heroes: mods/bfheroes/python/game/scoringCommon.py:614
damagePercent = (damage/object.getMaxDamage()) * 100

isTitan#

2142Heroes
python
obj.isTitan(...)
FactDetail
Original codeBFHeroes.exe (1.89)!0x0066eff5
bf2-rscrates/bf2-server/src/objects.rs:1426

What it does (from the bf2-rs port). BFHeroes.exe!0x0066eff5: same behaviour (the key chain and calls match, vtable offsets shifted). 2142 only: object_isTitan (bf2142ded!0x08163ef0): argObject_IObject(0); world::getChilds with a RemoteControlledPredicator (vtable 0x088732a8, team -1, type 7), true when any object matches (crate::titan::is_titan).

Shipped scripts use it like this:

2142: mods/bf2142/python/game/scoringCommon.py:663
if object.isValid()and root.isTitan():
Heroes: mods/bfheroes/python/game/scoringCommon.py:771
if object.isValid()and root.isTitan():

getNetworkId#

Heroes
python
obj.getNetworkId(...)
FactDetail
Original codeBFHeroes.exe (1.89)!0x0066e530
bf2-rscrates/bfh-server/src/lib.rs:534

What it does (from the bf2-rs port). host.Object.getNetworkId(obj) (BFHeroes.exe!0x0066e530): argObject(0), the networkable's id, 0 without one. host.omgr_getNetworkId(obj) (BFHeroes.exe!0x0066ef0c) is the same except that it returns NULL with no exception set when the object has no networkable (Python's SystemError).

Shipped scripts use it like this:

Heroes: mods/bfheroes/python/game/scoringCommon.py:206
netId = object.getNetworkId()

getXPDamageMod#

Heroes
python
obj.getXPDamageMod(...)
FactDetail
Original codeBFHeroes.exe (1.89)!0x0066e676
bf2-rscrates/bfh-server/src/lib.rs:538

What it does (from the bf2-rs port). host.Object.getXPDamageMod(obj) (BFHeroes.exe@bfh126!0x006a1bae) / getXPHealMod(obj) (BFHeroes.exe@bfh126!0x006a1c00); 1.89's answered 1.0 (0x0066e676 / 0x0066e6c5): argObject(0), then the object's score component (+0x98) vt+0x38 / its heal value as a float; None without the component. scoringCommon.addScore multiplies the XP of a score from the object by it.

Shipped scripts use it like this:

Heroes: mods/bfheroes/python/game/scoringCommon.py:209
xpMod = object.getXPDamageMod()

getXPHealMod#

Heroes
python
obj.getXPHealMod(...)
FactDetail
Original codeBFHeroes.exe (1.89)!0x0066e6c5

Shipped scripts use it like this:

Heroes: mods/bfheroes/python/game/scoringCommon.py:211
xpMod = object.getXPHealMod()

soldier_getParam#

Heroes
python
obj.soldier_getParam(...)
FactDetail
Original codeBFHeroes.exe (1.89)!0x0066eb48
bf2-rscrates/bfh-server/src/lib.rs:536

What it does (from the bf2-rs port). host.Object.soldier_getParam(obj, name) (BFHeroes.exe!0x0066eb48): argString(1), argObject(0), the soldier interface ("object isn't a soldier"), then ability (soldier vt+0xcc as a Python float) or "bad attribute".

soldier_setParam#

Heroes
python
obj.soldier_setParam(...)
FactDetail
Original codeBFHeroes.exe (1.89)!0x0066ec1e
bf2-rscrates/bfh-server/src/lib.rs:537

What it does (from the bf2-rs port). host.Object.soldier_setParam(obj, name, value) (BFHeroes.exe!0x0066ec1e): argString(1), argObject(0), the soldier interface, then for ability argFloat(2) handed to soldier vt+0xd0 (1.126 BFHeroes.exe@bfh126!0x006a2165: vt+0xdc), which stores 1.0 whatever the value (bfh_game::abilities::soldier_ability_after_set); None.

getAssetId#

Heroes
python
obj.getAssetId(...)
FactDetail
Original codeBFHeroes.exe (1.89)!0x0066ed03
bf2-rscrates/bfh-server/src/lib.rs:535

What it does (from the bf2-rs port). host.Object.getAssetId(obj) (BFHeroes.exe!0x0066ed03): argObject(0), then the template's asset id.

Shipped scripts use it like this:

Heroes: python/bf2/stats/stats.py:1165
player.stats.lastWeaponType = weapon.getAssetId()
Source: tools/devwiki/refs_python.py · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.