• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[vJASS] Lib conflict (function redeclared)

Status
Not open for further replies.
Level 6
Joined
Oct 26, 2005
Messages
190
Hello everyone. As I was adding some libraries and systems to a map, I noticed that upon saving, Jasshelper would give error regarding a GetUnitId function. The error itself is that it says "function redeclared". This happened when I imported AutoIndex. I'm no vJASS expert but I noticed that this same function is used in UnitUserData library, so I assume these two are the ones in conflict.

How can I solve this issue? Thanks in advance.
 
Since you're going to end up with two libraries manipulating user data, you should remove one and adapt the systems that use them to use the other one. Having two unit indexers is not a good idea.

Remove whichever one is used less often. If you need help making some script use the other indexer, then just post the indexer + the script in question and it should be an easy fix.
 
Level 6
Joined
Oct 26, 2005
Messages
190
Oh, okay. That is a very simple fix. Here is the updated spell. You can copy over the libraries from it to replace your current ones, and then delete the "UnitUserData" trigger. It is attached below.

Better yet, if you're up to fixing it yourself, here is how:

Since "UnitUserData" and "AutoIndex" both use GetUnitId, and "UnitUserData" only offers the function "GetUnitId", you can simply delete UnitUserData and make the other libraries require AutoIndex. It will be perfectly compatible. The only one that uses "UnitUserData" is "LastOrder", so simply click the "LastOrder" trigger, and find this line (it is at the very top):
JASS:
library LastOrder initializer Init needs UnitIndexingUtils
Change that to this:
JASS:
library LastOrder initializer Init needs AutoIndex

And then you're good to go! Just make sure you delete the "UnitUserData" trigger to avoid any conflicts.
 

Attachments

  • Light Shield 2.1.3.w3x
    122.2 KB · Views: 38
Status
Not open for further replies.
Top