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

Improved lua objectmerger

Status
Not open for further replies.
Level 21
Joined
Mar 27, 2012
Messages
3,232
I am not particularly fond of having to write out long pieces of code for each ability that I create in lua. Thus, I created a master function called ModifyObject that can make every single object data change to an ability in just 1 line. It supports formulas(exactly as much as lua supports them), changing all levels of an ability and variable amounts of parameters.

Considering how powerful it is and how little time it took to make, I'm actually wondering why no one thought of this before.

I will not post the code in this post, because first I want to find out if there's any interest for such a thing.
However, here is a teaser.
Code:
require "lua\\ModifyObject"
setobjecttype("abilities")
createobject("ANcl","ABIL")
ModifyObject(current,{anam="'lulz'-f",alev="10-3-f",Ncl31="1",amcs0="Gn*2-f"})

This creates an ability based on Channel, with 'ABIL' as the rawcode.
The last line makes all those changes:
Sets the name of the ability to "lulz".
Sets the levels of the ability to 10-3=7.
Changes the Options parameter of level 1 to "visible".
Changes the cooldown of each level to level*2. (2,4,6,8,10...)
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Considering how powerful it is and how little time it took to make, I'm actually wondering why no one thought of this before.

I did but looks kinda ugly. And afterwards I outsourced object creation and customized it, so the length did not disturb.

Also ObjectMerger accepts that as a single-liner too:

Code:
//! external ObjectMerger w3a AHtb STUN anam "My Stun" alev 1 Htb1 1 0 acdn 1 0 amcs 1 0 amat " "

If you have so many objects, I would build functions anyway and not use the meta code.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
I'm aware that objectmerger accepts several arguments in a single line, but it's not really comparable to dynamic values for each field.
I can use pretty much any kind of code to set values, so now the only thing missing is a way to write vJASS code through lua. If I had that, I could make systems that are fully implemented through JASS. I could also easily store the object editor fields of abilities in a hashtable.
 
Status
Not open for further replies.
Top