• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How to refer to the item in this

Status
Not open for further replies.
Level 4
Joined
Apr 19, 2013
Messages
86
Hey everyone, I was trying to put some restrictions on Anachrons Inventory system. Like I put a boolean where it doesn't do anything if the aquiring unit is a building (since I have buildings that do that in my map). But now I want to make a condition where nothing happens if the item is a power. The thing is I can't figure out how to reference the item as it's picked up.

note the ??? marks...

JASS:
ibrary CIEvents
endlibrary

module CIEvents
    public method pick takes CustomItem ci returns boolean
        if .checkPickup(ci) and IsUnitType(.carrier,UNIT_TYPE_STRUCTURE)== false and IsItemPowerup(???)== false then
            call ci.pick(.carrier)
            call .addItem(ci)
            return true
        endif
        
        return false
    endmethod
    
    public method drop takes CustomItem ci returns boolean
        if .hasItem(ci) then
            call ci.drop(.carrier)
            return .remItem(ci)
        endif
        
        return false
    endmethod
    
    public method pawn takes CustomItem ci returns boolean
        if .hasItem(ci) then
            call ci.pawn(.carrier)
            return true
        endif
        
        return false
    endmethod
    
    public method use takes CustomItem ci returns boolean
        if .hasItem(ci) then
            call ci.use(.carrier)
            return true
        endif
        
        return false
    endmethod
endmodule

Thanks guys, you've all helped me so much!
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
ooo i thought u always needed permission ?
Nope, only if you want to redistribute it. Not like the mods are going to hack your map and make sure all of your systems are unmodified.

Also, in this case, the interface was already there for the coder to use so its intended to be modified

You are missing the l.

Also, the module should be inside the library.

I could answer your question if i knew what inventory system you were using (a link would be extra helpful)
 
Nope, only if you want to redistribute it. Not like the mods are going to hack your map and make sure all of your systems are unmodified.

Also, in this case, the interface was already there for the coder to use so its intended to be modified

ooo ok lol. Also ik they wont try to hack ur pc lol. I just didnt know if asking to mod something is allowed without permission. Thanks for clearing this up now tho lol.
 
Level 4
Joined
Apr 19, 2013
Messages
86
Hey guys thanks a bunch for answering so quickly, I was busy yesterday.

Umm yeah I should have been more informative.

What I succeeded in doing was modifying it by restricting the system to only handle non-structure units. (you can see where I did this in the first boolean segment). To do this I needed to know how to refer to the unit that Anachron labeled as .carrer in the above trigger. It was kind of hard as I'm relatively new to vjass.

Now that I'm trying to place a restriction on the type of item that the system handles. So that's what I'm struggling with now, I don't see the name of the item anywhere. I tried CustomItem, and .ci and Item. And all the obvious guesses.

I'm guessing though it's somewhere in this trigger.

You were saying it might be in a nother library though? Like a global?
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Hey guys thanks a bunch for answering so quickly, I was busy yesterday.

Umm yeah I should have been more informative.

What I succeeded in doing was modifying it by restricting the system to only handle non-structure units. (you can see where I did this in the first boolean segment). To do this I needed to know how to refer to the unit that Anachron labeled as .carrer in the above trigger. It was kind of hard as I'm relatively new to vjass.

Now that I'm trying to place a restriction on the type of item that the system handles. So that's what I'm struggling with now, I don't see the name of the item anywhere. I tried CustomItem, and .ci and Item. And all the obvious guesses.

I'm guessing though it's somewhere in this trigger.

You were saying it might be in a nother library though? Like a global?

No, im saying that i wont be able to help you if you dont tell us the name of the system your using :)

e/ make my life easier and post the source code in a
JASS:
 block
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
ci.handle

e/ holy crap that system has alot of code o_O i did my fs inventory in 700 lines >.<
 
Level 4
Joined
Apr 19, 2013
Messages
86
Sweet, I'll try that out, thanks so much dude!

Edit: Ok i tried it but it gave me this error

Error: ci.handle is private

JASS:
library CIEvents
endlibrary

module CIEvents
    public method pick takes CustomItem ci returns boolean
        if .checkPickup(ci) and IsUnitType(.carrier,UNIT_TYPE_STRUCTURE)== false and IsItemPowerup(ci.handle) == false then
            call ci.pick(.carrier)
            call .addItem(ci)
            return true
        endif
        
        return false
    endmethod
 
Level 4
Joined
Apr 19, 2013
Messages
86
dang, I tried

IsItemPowerup(ci.gethandle()) and IsItemPowerup(ci.gethandle)

each time it says ci.gethandle is not a member of custom inventory

did it work in yours?
 
Status
Not open for further replies.
Top