• 🏆 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!

[Lua Object Generation] Problem with setting ability fields

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
Hi,

I think there may be a bug. I used the following commands, but it always sets the values to the passed value plus an offset of 48. I tried to be clever with passing in negative values (i.e. -47 so I could get the right value of "1") but that doesn't work.

Am I wrong or is this a bug?

JASS:
    //! i makechange(current, "Ncl3", "1", "1")
    //! i makechange(current, "Ncl2", "1", "1")

"Ncl3" refers to a field in abilities which can range over the following discrete values: [0,31], each referring to the different ways the spell is realized, e.g. "1" would set the spell flag to just "Visible"

"Ncl2" refers to what are the valid targets of the abilities, i.e. is it an AOE or a single target spell. It ranges over the values: [0, 3], where "1" would set the flag to "Unit Target."

Now when I run those commands above, it actually sets the values to "49" and "49" correspondingly. I did a bit more checking, and if I did pass "0" to either one, I would get "48," so it looks like it's adding some offset of 48 to the passed values. Unfortunately I tried something like -47, but that didn't give me the value "1."

Please fix this ASAP or at least tell me if I'm doing something wrong...
 
It is fixed here:
http://www.wc3c.net/showpost.php?p=1050064&postcount=7

  • Download the zip.
  • Open the zip, and then copyObjectMerger.exe and FileExporter.exe.
  • Navigate to your jassnewgenpack/grimext folder.
  • Paste ObjectMerger.exe and FileExporter.exe.

Restart the editor, and then your code should work. The hotfix should've been included already, but I guess it was lost in one of the updates (probably from the transition from 1.5e to 2.0). I'll let moyack know.

Example:
JASS:
//! externalblock extension=lua ObjectMerger $FILENAME$
//! i    setobjecttype("abilities")
//! i    createobject("ANcl", "A000")
//! i    makechange(current, "Ncl3", "1", "3")
//! endexternalblock
That will create an ability based off channel, and it will set the Ncl3 field (Level 1 - Data - Options) to "Visible, Targeting Image". Thanks for the report.
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
It is fixed here:
http://www.wc3c.net/showpost.php?p=1050064&postcount=7

  • Download the zip.
  • Open the zip, and then copyObjectMerger.exe and FileExporter.exe.
  • Navigate to your jassnewgenpack/grimext folder.
  • Paste ObjectMerger.exe and FileExporter.exe.

Restart the editor, and then your code should work. The hotfix should've been included already, but I guess it was lost in one of the updates (probably from the transition from 1.5e to 2.0). I'll let moyack know.

Example:
JASS:
//! externalblock extension=lua ObjectMerger $FILENAME$
//! i    setobjecttype("abilities")
//! i    createobject("ANcl", "A000")
//! i    makechange(current, "Ncl3", "1", "3")
//! endexternalblock
That will create an ability based off channel, and it will set the Ncl3 field (Level 1 - Data - Options) to "Visible, Targeting Image". Thanks for the report.

Ah this was a known bug? Just curious what causes it to happen?
 
I haven't looked at the actual hex code for it, but Ncl2 and Ncl3 are somewhat unique fields. Ncl2 is a combo-box, and the raw data ranges from 0 to 3. Ncl3 features multiply-selectable checkboxes (you can select more than one of them). I think they are just special cases that needed to be handled differently than the other fields.

The reason why it displayed 49 in place of "1" is that it was showing its ASCII value (table). It probably just wrote to the w3a incorrectly (different from what the editor expected), which is why it ended up displaying 49.
 
Status
Not open for further replies.
Top