• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ Adding a new damage element [OTX3]

Crevasse

惡名昭彰
Joined
Jan 13, 2017
Messages
149
Solutions
16
Reaction score
109
Location
Washington, D.C.
I'm attempting to add drown damage to my OTX3 distro, client version 7.72

I have modified the following files where damage elements are used:

monsters.cpp [changed]
enums.h [changed]
items.cpp [changed]
combat.cpp [changed]
condition.cpp [changed]
tools.cpp [changed]
creature.cpp [changed]
spells.cpp [changed]
player.cpp [changed]
luascript.cpp [changed]


When I compile, it fails with the following output:
Code:
1>------ Rebuild All started: Project: theforgottenserver, Configuration: Release x64 ------
1>  otpch.cpp
1>  actions.cpp
1>  ban.cpp
1>  baseevents.cpp
1>  bed.cpp
1>  chat.cpp
1>  combat.cpp
1>..\src\combat.cpp(117): error C2065: 'COMBAT_DROWNDAMAGE': undeclared identifier
1>..\src\combat.cpp(138): error C2065: 'COMBAT_DROWNDAMAGE': undeclared identifier
1>..\src\combat.cpp(138): error C2131: expression did not evaluate to a constant
1>  ..\src\combat.cpp(138): note: failure was caused by non-constant arguments or reference to a non-constant symbol
1>  ..\src\combat.cpp(138): note: see usage of 'COMBAT_DROWNDAMAGE'
1>..\src\combat.cpp(138): error C2051: case expression not constant
1>  commands.cpp
1>  condition.cpp
1>  configmanager.cpp
1>  connection.cpp
1>  container.cpp
1>  creature.cpp
1>  creatureevent.cpp
1>  cylinder.cpp
1>  database.cpp
1>  databasemanager.cpp
1>..\src\creature.cpp(1056): error C2065: 'COMBAT_DROWNDAMAGE': undeclared identifier
1>  databasetasks.cpp
1>  depotchest.cpp
1>  depotlocker.cpp
1>  events.cpp
1>  fileloader.cpp
1>  game.cpp
1>  globalevent.cpp
1>  groups.cpp
1>  guild.cpp
1>  house.cpp
1>..\src\game.cpp(3366): error C2065: 'COMBAT_DROWNDAMAGE': undeclared identifier
1>..\src\game.cpp(3366): error C2131: expression did not evaluate to a constant
1>  ..\src\game.cpp(3366): note: failure was caused by non-constant arguments or reference to a non-constant symbol
1>  ..\src\game.cpp(3366): note: see usage of 'COMBAT_DROWNDAMAGE'
1>..\src\game.cpp(3366): error C2051: case expression not constant
1>  housetile.cpp
1>  inbox.cpp
1>  ioguild.cpp
1>  iologindata.cpp
1>  iomap.cpp
1>  iomapserialize.cpp
1>  item.cpp
1>  items.cpp
1>..\src\items.cpp(705): error C2065: 'COMBAT_DROWNDAMAGE': undeclared identifier
1>..\src\items.cpp(764): error C2065: 'COMBAT_DROWNDAMAGE': undeclared identifier
1>..\src\items.cpp(870): error C2601: 'Items::getItemType': local function definitions are illegal
1>  ..\src\items.cpp(331): note: this line contains a '{' which has not yet been matched
1>..\src\items.cpp(878): error C2601: 'Items::getItemType': local function definitions are illegal
1>  ..\src\items.cpp(331): note: this line contains a '{' which has not yet been matched
1>..\src\items.cpp(886): error C2601: 'Items::getItemIdByClientId': local function definitions are illegal
1>  ..\src\items.cpp(331): note: this line contains a '{' which has not yet been matched
1>..\src\items.cpp(895): error C2601: 'Items::getItemIdByName': local function definitions are illegal
1>  ..\src\items.cpp(331): note: this line contains a '{' which has not yet been matched
1>..\src\items.cpp(331): fatal error C1075: the left brace '{' was unmatched at the end of the file
1>  luascript.cpp
1>  mailbox.cpp
1>  map.cpp
1>  monster.cpp
1>..\src\luascript.cpp(1075): error C2065: 'COMBAT_DROWNDAMAGE': undeclared identifier
1>  monsters.cpp
1>  movement.cpp
1>  networkmessage.cpp
1>..\src\monsters.cpp(460): error C2065: 'COMBAT_DROWNDAMAGE': undeclared identifier
1>..\src\monsters.cpp(881): error C2065: 'COMBAT_DROWNDAMAGE': undeclared identifier
1>..\src\monsters.cpp(922): error C2065: 'COMBAT_DROWNDAMAGE': undeclared identifier
1>..\src\monsters.cpp(1011): error C2065: 'COMBAT_DROWNDAMAGE': undeclared identifier
1>  npc.cpp
1>  otserv.cpp
1>  outputmessage.cpp
1>  party.cpp
1>  player.cpp
1>  position.cpp
1>  protocol.cpp
1>  protocolgame.cpp
1>  protocollogin.cpp
1>  protocolstatus.cpp
1>  raids.cpp
1>  reward.cpp
1>  rewardchest.cpp
1>  rsa.cpp
1>  scheduler.cpp
1>  scriptmanager.cpp
1>  server.cpp
1>  signals.cpp
1>  spawn.cpp
1>  spells.cpp
1>  talkaction.cpp
1>  tasks.cpp
1>  teleport.cpp
1>  thing.cpp
1>  tile.cpp
1>  tools.cpp
1>..\src\tools.cpp(519): error C2065: 'COMBAT_DROWNDAMAGE': undeclared identifier
1>..\src\tools.cpp(721): error C2065: 'COMBAT_DROWNDAMAGE': undeclared identifier
1>..\src\tools.cpp(721): error C2131: expression did not evaluate to a constant
1>  ..\src\tools.cpp(721): note: failure was caused by non-constant arguments or reference to a non-constant symbol
1>  ..\src\tools.cpp(721): note: see usage of 'COMBAT_DROWNDAMAGE'
1>..\src\tools.cpp(721): error C2051: case expression not constant
1>  trashholder.cpp
1>  vocation.cpp
1>  waitlist.cpp
1>  weapons.cpp
1>  wildcardtree.cpp
1>..\src\weapons.cpp(142): warning C4100: 'level': unreferenced formal parameter
1>..\src\weapons.cpp(147): warning C4100: 'level': unreferenced formal parameter
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Where do I need to add the identifier? Let me know if I need to include any of the files mentioned.

Thanks
 
Solved. Forgot to change

C++:
COMBAT_COUNT = 8

to

C++:
COMBAT_COUNT = 9

in enums.h

and the other error was from a missing '{' in items.cpp.

========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
Tested, working.
 
Back
Top