Why won’t this compile? It’s the lexicon example, but it gives duplicate function implementation error. It’s the same one used in Urk’s stable prefab except his uses tokens. Copying his gives same error when saving, but since his were compiled at some time, they work in his prefab.
// An existing horse with a tag of "HorseTemplate" is used to create a new horse
// with a tag of "NewHorse" near the PC, who becomes the owner of the new horse.
#include "x3_inc_horse"
void main()
{
object oPC = GetPCSpeaker();
object oHorse = HorseCreateHorse(GetResRef(GetObjectByTag("HorseTemplate")), GetLocation(oPC), oPC, "NewHorse");
}
there might not be any problem with HorseCreateHorse()
A duplicate function error is more general. There can be only 1 declaration/implementation of any function ( eg. HorseCreateHorse() ) in a script, including its #includes …
the function might not even be called in your script, but the compiler seems to be seeing two+ implementations of a function with the same name somewhere in the dependencies
Yeah, that’s weird because it would compile at one time or Urks scripts wouldn’t work. Trying to copy/paste them in new scripts wouldn’t compile and thus won’t work in my mod.
It really helps to track down the issue if you link to the system(s) you use. There are several Urk’s horse contributions in the vault.
But which function? The compiler should say it in the error line.
The only function you have defined here is main(). So perhaps you (or someone) has uncommented main() in x3_inc_horse (or somewhere up the include chain from x3_inc_horse)?
The end of vanilla x3_inc_horse should look like this (note the //):