HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Need help with External Scripts.

02-20-2010, 06:49 PM#1
Anachron
Hello folks!

I've released my inventory system here.
How it looks



People really like it, but what I don't like, I don't know how to generate scripts that automatically generate destructables.

Can anyone create the script for the destructables I've created in that map?
You will surely get credit in the map and I would be really happy.

Thanks in advance,
Anachron
02-20-2010, 10:21 PM#2
Ammorth
Collapse JASS:
scope CIGenDestructibles
// set this to true to generate the object data
// setting this to false will not generate data and therefore will speed up save times
// you can change anything between CI_GEN_START and CI_GEN_END.
// only call the CI_GEN textmacros between CI_GEN_START and CI_GEN_END
// CI_GEN_SLOT can be used by the user to generate custom destructibles for their items
//! runtextmacro CI_GEN_START("true")

//! runtextmacro CI_GEN_SLOT("it02", "(Clarity Potion)", "ReplaceableTextures\\CommandButtons\\BTNPotionOfClarity.blp")
//! runtextmacro CI_GEN_SLOT("coat", "(Claws of Attack)", "ReplaceableTextures\\CommandButtons\\BTNClawsOfAttack.blp")
//! runtextmacro CI_GEN_SLOT("it01", "(Healing Potion)", "ReplaceableTextures\\CommandButtons\\BTNPotionGreenSmall.blp")
//! runtextmacro CI_GEN_SLOT("it04", "(Hood of Cunning)", "ReplaceableTextures\\CommandButtons\\BTNHoodOfCunning.blp")
//! runtextmacro CI_GEN_SLOT("it03", "(Shaman Claw)", "ReplaceableTextures\\CommandButtons\\BTNShamanMaster.blp")

//! runtextmacro CI_GEN_BORDER("cwbt", "#CW (Bottom)", "CustomWindow\\borderD.mdl")
//! runtextmacro CI_GEN_BORDER("cwld", "#CW (Corner Left Down)", "CustomWindow\\cornerDL.mdl")
//! runtextmacro CI_GEN_BORDER("cwlu", "#CW (Corner Left Up)", "CustomWindow\\cornerUL.mdl")
//! runtextmacro CI_GEN_BORDER("cwrd", "#CW (Corner Right Down)", "CustomWindow\\cornerDR.mdl")
//! runtextmacro CI_GEN_BORDER("cwru", "#CW (Corner Right Up)", "CustomWindow\\cornerUR.mdl")
//! runtextmacro CI_GEN_BORDER("cwlf", "#CW (Left)", "CustomWindow\\borderL.mdl")
//! runtextmacro CI_GEN_BORDER("cwrg", "#CW (Right)", "CustomWindow\\borderR.mdl")
//! runtextmacro CI_GEN_BORDER("cwup", "#CW (Top)", "CustomWindow\\borderU.mdl")

//! runtextmacro CI_GEN_SLOT("cwcc", "#CW (Cancel)", "ReplaceableTextures\\CommandButtons\\BTNCancel.blp")
//! runtextmacro CI_GEN_SLOT("cwds", "#CW (Dissselect)", "UI\\Widgets\\Console\\Human\\CommandButton\\human-multipleselection-heroglow.blp")
//! runtextmacro CI_GEN_SLOT("cwdp", "#CW (Drop Item)", "ReplaceableTextures\\CommandButtons\\BTNPickUpItem.blp")
//! runtextmacro CI_GEN_SLOT("cwit", "#CW (Item Slot)", "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNPickUpItem.blp")
//! runtextmacro CI_GEN_SLOT("cwsf", "#CW (Item Slot Full)", "ReplaceableTextures\\CommandButtons\\BTNDustOfAppearance.blp")

//! runtextmacro CI_GEN_SLOT("ciam", "[Amulet Slot]", "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNAmulet.blp")
//! runtextmacro CI_GEN_SLOT("cibt", "[Boots Slot]", "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNBoots.blp")
//! runtextmacro CI_GEN_SLOT("cigv", "[Glove Slot]", "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNGauntletsOfOgrePower.blp")
//! runtextmacro CI_GEN_SLOT("cihn", "[Hand Slot]", "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNGlove.blp")
//! runtextmacro CI_GEN_SLOT("cihd", "[Helmet Slot]", "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNHoodOfCunning.blp")
//! runtextmacro CI_GEN_SLOT("cimn", "[Main Slot]", "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNImprovedMoonArmor.blp")
//! runtextmacro CI_GEN_SLOT("cimc", "[Misc Slot]", "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNBelt.blp")
//! runtextmacro CI_GEN_SLOT("cirg", "[Ring Slot]", "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNGoldRing.blp")
//! runtextmacro CI_GEN_SLOT("cish", "[Shoulder Slot]", "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNLeatherUpgradeTwo.blp")
//! runtextmacro CI_GEN_SLOT("citr", "[Trouser Slot]", "ReplaceableTextures\\CommandButtonsDisabled\\DISBTNDustOfAppearance.blp")

//! runtextmacro CI_GEN_SPECIAL("cwsl", "#CW (Selector)", "CustomWindow\\selector.mdl")

//! runtextmacro CI_GEN_END()

// these textmacros below generate an LUA file through vJass to send to ObjectMerger
// don't change these unless you know what you are doing.

//! textmacro CI_GEN_START takes DO_GEN
    //! externalblock extension=lua ObjectMerger $FILENAME$
    //! i if "$DO_GEN$" == "true" then
    //! i setobjecttype("destructables")
//! endtextmacro

//! textmacro CI_GEN_END
    //! i end
    //! endexternalblock
//! endtextmacro

//! textmacro CI_GEN_SPECIAL takes RAWCODE, NAME, MODEL
    //! i createobject("YTlb", "$RAWCODE$")
    //! i makechange(current, "bfxr", 180.00)
    //! i makechange(current, "bfil", "$MODEL$")
    //! i makechange(current, "boch", 0.00)
    //! i makechange(current, "bshd", "")
    //! i makechange(current, "btar", "")
    //! i makechange(current, "bcpr", 0)
    //! i makechange(current, "bmas", 10.0)
    //! i makechange(current, "bmis", 0.10)
    //! i makechange(current, "bcpd", 0)
    //! i makechange(current, "buch", 0)
    //! i makechange(current, "bptx", none)
    //! i makechange(current, "bsuf", "$NAME$")
    //! i makechange(current, "bnam", " ")
//! endtextmacro

//! textmacro CI_GEN_SLOT takes RAWCODE, NAME, TEXTURE
    //! i createobject("YTlb", "$RAWCODE$")
    //! i makechange(current, "bfxr", 180.00)
    //! i makechange(current, "bfil", "CustomWindow\\IconBase.mdl")
    //! i makechange(current, "boch", 0.00)
    //! i makechange(current, "btxf", "$TEXTURE$")
    //! i makechange(current, "btxi", 32)
    //! i makechange(current, "bshd", "")
    //! i makechange(current, "btar", "")
    //! i makechange(current, "bcpr", 0)
    //! i makechange(current, "bmas", 10.0)
    //! i makechange(current, "bmis", 0.10)
    //! i makechange(current, "bcpd", 0)
    //! i makechange(current, "buch", 0)
    //! i makechange(current, "bptx", none)
    //! i makechange(current, "bsuf", "$NAME$")
    //! i makechange(current, "bnam", " ")
//! endtextmacro
    
//! textmacro CI_GEN_BORDER takes RAWCODE, NAME, MODEL
    //! i createobject("YTlb", "$RAWCODE$")
    //! i makechange(current, "bfxr", 0.00)
    //! i makechange(current, "bfil", "$MODEL$")
    //! i makechange(current, "boch", 0.00)
    //! i makechange(current, "btxf", "UI\\Widgets\\EscMenu\\Human\\human-options-menu-border.blp")
    //! i makechange(current, "btxi", 32)
    //! i makechange(current, "bshd", "")
    //! i makechange(current, "btar", "")
    //! i makechange(current, "bcpr", 0)
    //! i makechange(current, "bmas", 10.0)
    //! i makechange(current, "bmis", 0.10)
    //! i makechange(current, "bcpd", 0)
    //! i makechange(current, "buch", 0)
    //! i makechange(current, "bptx", none)
    //! i makechange(current, "bsuf", "$NAME$")
    //! i makechange(current, "bnam", " ")
//! endtextmacro

endscope

Copy and paste into a trigger.

Aswell, you should remove the shadows and fogging from the inventory models. This stops them from changing blue/orange from the omnient light (night and day). I was bored so I did them for you aswell. See the attachments.

A couple of other suggestions (although some of these have already been noted on the hive):

- You should include text for the special buttons to explain what they are (head slot, cancel, drop item, etc).
- If you make the items a player picks up consumable and consumed on pickup (think tomes), you can allow units to pickup items with all 6 slots occupied. Then, if there is a problem you can re-create the item (as if it wasn't picked up). The plus-side is you can use all 6 slots for potions. The downside is potions would need both a dummy item (the one that is picked up) and the item in thier inventory. If you allow to drop from the wc3 inventory (potions) you can detect that and replace the dropped item with its dummy item counter-part.
Attached Files
File type: mdxborderD.mdx (1.5 KB)
File type: mdxborderL.mdx (1.5 KB)
File type: mdxborderR.mdx (1.5 KB)
File type: mdxcentral.mdx (2.2 KB)
File type: mdxcornerDL.mdx (1.8 KB)
File type: mdxcornerDR.mdx (1.8 KB)
File type: mdxcornerUL.mdx (1.8 KB)
File type: mdxcornerUR.mdx (1.8 KB)
File type: mdxempinv.MDX (2.2 KB)
File type: mdxIconBase.mdx (2.4 KB)
02-20-2010, 10:25 PM#3
Anachron
Thanks a lot, you did test this, right? :)
02-20-2010, 10:30 PM#4
Ammorth
Yes, I downloaded version W, saved and test-mapped. Everything turned out the same.

1 other thing I was going to add to suggestions is to generate the UI at a location (instead of pre-placing it). Just tell the user the point they pick should be of certain size and flat. It makes it easier to copy this to their map as now the object data is generated automatically.
02-20-2010, 10:31 PM#5
Anachron
Yes, that was exactly what I was trying to do. Really big thanks, you saved me a lot of work.
Where did you learn how to make that anyway?
02-20-2010, 10:34 PM#6
Ammorth
hmm, I picked up the basics while setting up the PAS object merger lines. And then with the help of Earth-Fury on IRC and the bonusmod object merger shit, I did this.

Its kinda nice, cause now that I know how, I can do it for myself whenever I want =D
02-20-2010, 10:38 PM#7
Anachron
Quote:
Originally Posted by Ammorth
hmm, I picked up the basics while setting up the PAS object merger lines. And then with the help of Earth-Fury on IRC and the bonusmod object merger shit, I did this.

Its kinda nice, cause now that I know how, I can do it for myself whenever I want =D
Yeah, that basically what I want too^^

Quote:
- You should include text for the special buttons to explain what they are (head slot, cancel, drop item, etc).
Yeah, nice idea, thanks.

Quote:
- If you make the items a player picks up consumable and consumed on pickup (think tomes), you can allow units to pickup items with all 6 slots occupied. Then, if there is a problem you can re-create the item (as if it wasn't picked up). The plus-side is you can use all 6 slots for potions. The downside is potions would need both a dummy item (the one that is picked up) and the item in thier inventory. If you allow to drop from the wc3 inventory (potions) you can detect that and replace the dropped item with its dummy item counter-part.
Yeah, I am afraid of the downside. Currently I wanna have it like that, and the Powerup module doesnt work correctly. So I have to use atleast 5 slots for now, while slots-1 slots can only be used.

Edit: Omg, I say year to often.
Edit2: Alright, released the new version. Thanks again, Ammorth!

Ps.) This may be offtopic, but do you think its good enough for wc3c.net too?
02-20-2010, 10:41 PM#8
Ammorth
I think I might have 1-2 rawcodes wrong... give me a minute.

yep, Corner Right should be cwrg not cwlr

updated the script posted above to reflect this.
02-20-2010, 10:52 PM#9
Anachron
Alright looks fine. Can you please answer my question on last post too?
02-20-2010, 11:01 PM#10
Ammorth
I couldn't see why not. If it is customizable enough, I would assume it would become a system (assuming the code is up to par, which I didn't look at). Even if it doesn't, the feedback you would gain (both for the code and for the system in general) would help polish it even more.
02-20-2010, 11:05 PM#11
Anachron
Yes, and I only used stuff from wc3c.net, so it really could be approved.
But I guess I have to many librarys that are not approved by me in that inventory ):
02-20-2010, 11:10 PM#12
Troll-Brain
I suppose it doesn't handle cooldowns of item abilities ?
At least not in the native way.
02-20-2010, 11:17 PM#13
Anachron
It does.
02-21-2010, 09:23 AM#14
Troll-Brain
I mean, we don't have the cooldown image on the item when the item is on the big inventory, right ?
02-21-2010, 10:53 AM#15
Anachron
No, not yet. Is it that big deal anyway?