• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Custom inventory

Status
Not open for further replies.
Level 6
Joined
Apr 26, 2007
Messages
225
I downloaded the custom inventory by anachron and i made it work in my map somehow... i have no knowlage in jass at all but with the test unit it spawn i could see my inventory and made a potion work all by myself with a custom icone so i think i can handle myself for the rest... problem is that i have a trigger to choose the hero and i dont know how to call the system when i spawn my hero.. I think i figured it out but the editor give me an error... can anyone take a look at it and tell me whats wrong?

The test unit script in jass is:
JASS:
scope test initializer init

    private function init takes nothing returns nothing
        local unit fakeInv = null
        local unit hero = null
        local integer i = 0
        
        loop
            exitwhen i >= 12
        
            if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(Player(i)) == MAP_CONTROL_USER then
                set fakeInv = CreateInventoryUnit(Player(i), 'h000')
                set hero = CreateUnit(Player(i), 'Hpal', 0., 0., 0.)
                call CreateInventoryUI(hero, fakeInv)
            endif
        
            set i = i +1
        endloop
    endfunction
    
endscope

i picked the lines:
local unit fakeInv = null
local unit hero = null
set fakeInv = CreateInventoryUnit(Player(i), 'h000')
set hero = CreateUnit(Player(i), 'Hpal', 0., 0., 0.)
call CreateInventoryUI(hero, fakeInv)

As my trigger is based on a unit spawning when you press escape when in the right area, i changed "set hero = CreateUnit(Player(i), 'Hpal', 0., 0., 0.)" for "set hero = GetLastCreatedUnit()

Now part of my trigger look like that:
  • Geomancer choose
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
      • Player - Player 2 (Blue) skips a cinematic sequence
      • Player - Player 3 (Teal) skips a cinematic sequence
      • Player - Player 4 (Purple) skips a cinematic sequence
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in Geomancer choose <gen>) and do (Actions)
        • Loop - Actions
          • Custom script: local integer i = 0
          • Custom script: local unit fakeInv = null
          • Custom script: local unit hero = null
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to Player 1 (Red)
            • Then - Actions
              • Cinematic - Clear the screen of text messages for (All players matching ((Triggering player) Equal to (Matching player)))
              • Set playerclass[1] = 1
              • Player Group - Add Player 1 (Red) to players
              • Set playersnumber = (playersnumber + 1)
              • Unit - Remove (Picked unit) from the game
              • Game - Display to Player Group - Player 1 (Red) the text: |cffFFCC00You choos...
              • Player - Set Player 1 (Red) Current gold to 200
              • Custom script: set fakeInv = CreateInventoryUnit(Player(1), 'h000')
              • Unit - Create 1 Geomancer for Player 1 (Red) at (Center of Hero Spawn <gen>) facing Default building facing degrees
              • Custom script: set hero = GetLastCreatedUnit()
              • Custom script: call CreateInventoryUI(hero, fakeInv)
              • Custom script: set i = i +1
              • Camera - Pan camera for Player 1 (Red) to (Center of Hero Spawn <gen>) over 0.00 seconds
              • Selection - Select (Last created unit) for Player 1 (Red)
              • Player - Disable Fire Burst for Player 1 (Red)
              • Player - Disable Burning Attack for Player 1 (Red)
              • Trigger - Turn on Geomancer unavaible <gen>
              • Trigger - Turn off Geomancer info <gen>
              • Trigger - Turn off (This trigger)
            • Else - Actions
Should work shouldnt it...? it dont spawn the inventory or do anything...

Any help...?
 
locals can only be created at the start of a function, you are creating them in the middle of the function.

Basically the order of a function goes.
declerations
locals
other (calls, sets, loops, conditions etc)
end

Placing the local declerations above...
Cinematic - Clear the screen of text messages for (All players matching ((Triggering player) Equal to (Matching player)))
should work because of the way GUI makes functions.
 
Yeah, i finaly figured it out. I had to make my trigger to it detect triggering player and not directely a player (weird...but o well lol) thanks anyway:thumbs_up:
 
Status
Not open for further replies.
Back
Top