• 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.

[vJASS] Fsi

Status
Not open for further replies.
Level 16
Joined
Mar 3, 2006
Messages
1,564
Level 17
Joined
Jul 17, 2011
Messages
1,863
"fsi" is based on adding the damage ability or whatever ability an item can have via the function which ads an ability to a hero it is not possible to do it without the imported models however you only need 1 total model the rest is optional this model is the square model which is used in all fsi systems it can be textured in WE by setting it the model of a destructible and then giving the destructible a skin path of any of the in game icons available

the rest has to do with triggering an event which replaces models and ads and removes abilities
 
You should check this out:
http://www.hiveworkshop.com/forums/...inventory-159130/?prev=d=list&r=20&u=Anachron

Check the imports used, the way the destructables are made in the object editor, and then you will learn how it works.

It pretty much consists of creating/hiding/showing destructables. Since it is in a fixed position, you can just create a trackable on each position using the invisible model that anachron used. (if you need to change the size you can just edit the model in war3 model editor) I recommend you use my Track system since it has an easy interface to detect who clicked the trackable.

For the actual screen, you can create the borders using the appropriate destructables and set the camera angle of attack to 270 so that it is looking directly down at the ground. You'll need a bit of reserved area for this.

The annoying parts are hiding it for players and whatnot, and testing things in multiplayer. The most annoying part is tooltips, because you have to deal with strings in annoying ways, regardless of whether you are using multiboards or texttags.

Overall, you should look at the way Anachron does it and then use that as a basis. If you need another sample, I have some old ones that I used to use that have fewer requirements so it might be easier to look through.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
@ PurgeandFire

That was pretty good and illustrative, I was learning before you post this and I got the concept and here is my code that I was experimenting on:

JASS:
globals
    trackable array SLOT
    string MDL = "war3mapImported\\IconBase.mdx"
    trigger C = CreateTrigger()
    trigger T = CreateTrigger()
    integer ROWS = 5
    integer COLU = 5
    real OFFSET_X = 128.00
    real OFFSET_Y = 128.00
endglobals

function Clicked_Actions takes nothing returns nothing
    local integer i = 1
    local integer j
    loop
        exitwhen i > ROWS
        set j = 1
        loop
            exitwhen j > COLU
                if GetTriggeringTrackable() == SLOT[ROWS*(i-1) + j] then
                    call BJDebugMsg("Slot |cffFFCC00" + I2S(i) + "|r,|cffFFCC00" + I2S(j) + "|r Clicked")
                endif
            set j = j + 1
        endloop
        set i = i + 1
    endloop
endfunction

function Tracked_Actions takes nothing returns nothing
    local integer i = 1
    local integer j
    loop
        exitwhen i > ROWS
        set j = 1
        loop
            exitwhen j > COLU
                if GetTriggeringTrackable() == SLOT[ROWS*(i-1) + j] then
                    //call BJDebugMsg("Slot |cffFFCC00" + I2S(i) + "|r,|cffFFCC00" + I2S(j) + "|r Tracked")
                endif
            set j = j + 1
        endloop
        set i = i + 1
    endloop
endfunction

function Trig_Init_Actions takes nothing returns nothing
    local integer i = 1
    local integer j
    loop
        exitwhen i > ROWS
        set j = 1
        loop
            exitwhen j > COLU
                set SLOT[ROWS*(i-1) + j] = CreateTrackable(MDL,OFFSET_X*(j-1),OFFSET_Y*(i-1),0)
                call TriggerRegisterTrackableHitEvent  (C,SLOT[ROWS*(i-1) + j])
                call TriggerRegisterTrackableTrackEvent(T,SLOT[ROWS*(i-1) + j])
            set j = j + 1
        endloop
        set i = i + 1
    endloop
    call FogModifierStart(CreateFogModifierRect(Player(0),FOG_OF_WAR_VISIBLE,bj_mapInitialPlayableArea,true,false))
    call TriggerAddAction(C, function Clicked_Actions)
    call TriggerAddAction(T, function Tracked_Actions)
    set C = null
    set T = null
    call CameraSetupApplyForceDuration(gg_cam_1,true,0)
endfunction

//===========================================================================
function InitTrig_Init takes nothing returns nothing
    set gg_trg_Init = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Init, function Trig_Init_Actions )
endfunction

Thanks for the reply.

But I have another question.

Is FSI possible in a campaign with many transition maps (like Orc Bonus Campaign but with a FSI) can the inventory data be imported and exported via game cache from one map to another ?
 
@ PurgeandFire

That was pretty good and illustrative, I was learning before you post this and I got the concept and here is my code that I was experimenting on:

JASS:
globals
    trackable array SLOT
    string MDL = "war3mapImported\\IconBase.mdx"
    trigger C = CreateTrigger()
    trigger T = CreateTrigger()
    integer ROWS = 5
    integer COLU = 5
    real OFFSET_X = 128.00
    real OFFSET_Y = 128.00
endglobals

function Clicked_Actions takes nothing returns nothing
    local integer i = 1
    local integer j
    loop
        exitwhen i > ROWS
        set j = 1
        loop
            exitwhen j > COLU
                if GetTriggeringTrackable() == SLOT[ROWS*(i-1) + j] then
                    call BJDebugMsg("Slot |cffFFCC00" + I2S(i) + "|r,|cffFFCC00" + I2S(j) + "|r Clicked")
                endif
            set j = j + 1
        endloop
        set i = i + 1
    endloop
endfunction

function Tracked_Actions takes nothing returns nothing
    local integer i = 1
    local integer j
    loop
        exitwhen i > ROWS
        set j = 1
        loop
            exitwhen j > COLU
                if GetTriggeringTrackable() == SLOT[ROWS*(i-1) + j] then
                    //call BJDebugMsg("Slot |cffFFCC00" + I2S(i) + "|r,|cffFFCC00" + I2S(j) + "|r Tracked")
                endif
            set j = j + 1
        endloop
        set i = i + 1
    endloop
endfunction

function Trig_Init_Actions takes nothing returns nothing
    local integer i = 1
    local integer j
    loop
        exitwhen i > ROWS
        set j = 1
        loop
            exitwhen j > COLU
                set SLOT[ROWS*(i-1) + j] = CreateTrackable(MDL,OFFSET_X*(j-1),OFFSET_Y*(i-1),0)
                call TriggerRegisterTrackableHitEvent  (C,SLOT[ROWS*(i-1) + j])
                call TriggerRegisterTrackableTrackEvent(T,SLOT[ROWS*(i-1) + j])
            set j = j + 1
        endloop
        set i = i + 1
    endloop
    call FogModifierStart(CreateFogModifierRect(Player(0),FOG_OF_WAR_VISIBLE,bj_mapInitialPlayableArea,true,false))
    call TriggerAddAction(C, function Clicked_Actions)
    call TriggerAddAction(T, function Tracked_Actions)
    set C = null
    set T = null
    call CameraSetupApplyForceDuration(gg_cam_1,true,0)
endfunction

//===========================================================================
function InitTrig_Init takes nothing returns nothing
    set gg_trg_Init = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Init, function Trig_Init_Actions )
endfunction

Thanks for the reply.

But I have another question.

Is FSI possible in a campaign with many transition maps (like Orc Bonus Campaign but with a FSI) can the inventory data be imported and exported via game cache from one map to another ?

Ah, if you are making it for a campaign then life is even easier. That means you just need to make it work for single player, so the way you are doing it should be completely fine.

And yes, you can transfer the data.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
That's what I have reached so far

JASS:
globals

    boolean PrevSelection = false

    integer ROWS = 10
    integer COLU = 10
    integer pi
    integer pj

    multiboard ItemStats

    string MDL = "war3mapImported\\Track75.mdx"
    string Empty = "|cff8F8F8FEmpty Slot|r"
    string tempstr = ""

    trigger C = CreateTrigger()
    trigger T = CreateTrigger()

    real X1 = -2816
    real Y1 =  2816
    real DX = 90.00
    real DY = 90.00

    // ARRAYS
    destructable array IconBase   [10][10]
    destructable array Selection  [10][10]
    destructable array ShamanClaw [10][10]

    string       array Label      [10][10]

    trackable    array SLOT       [10][10]

endglobals

function initItems takes nothing returns nothing
    set Label[1][1] = "|cffFFCC00Shaman Claw|r"
    call ShowDestructable(ShamanClaw[1][1],true)
endfunction

function Clicked_Actions takes nothing returns nothing
    local integer i = 1
    local integer j

    loop
        exitwhen i > ROWS
        set j = 1
        loop
            exitwhen j > COLU
                if GetTriggeringTrackable() == SLOT[i][j] then
                    //call BJDebugMsg("Slot |cffFFCC00" + I2S(i) + "|r,|cffFFCC00" + I2S(j) + "|r Clicked")

                    if PrevSelection == false then
                        set PrevSelection = true
                        call ShowDestructable(Selection[i][j],true)
                        set pi = i
                        set pj = j
                    else
                        if Label[pi][pj] != Empty then
                            set tempstr = Label[pi][pj]
                            set Label[pi][pj] = Label[i][j]
                            set Label[i][j] = tempstr

                            call ShowDestructable(ShamanClaw[pi][pj],false)
                            call ShowDestructable(ShamanClaw[i][j],true)
                            call MultiboardSetTitleText( ItemStats, Label[i][j] )
                        endif

                        set PrevSelection = false
                        call ShowDestructable(Selection[pi][pj],false)
                    endif

                endif
            set j = j + 1
        endloop
        set i = i + 1
    endloop
endfunction

function Tracked_Actions takes nothing returns nothing
    local integer i = 1
    local integer j
    loop
        exitwhen i > ROWS
        set j = 1
        loop
            exitwhen j > COLU
                if GetTriggeringTrackable() == SLOT[i][j] then
                    //call BJDebugMsg("Slot |cffFFCC00" + I2S(i) + "|r,|cffFFCC00" + I2S(j) + "|r Tracked")
                    call MultiboardSetTitleText( ItemStats, Label[i][j] )
                endif
            set j = j + 1
        endloop
        set i = i + 1
    endloop
endfunction

function Trig_Init_Actions takes nothing returns nothing
    local integer i = 1
    local integer j
    local real x
    local real y
    local trackable temp_track
    local destructable temp_destruct
    loop
        exitwhen i > ROWS
        set j = 1
        loop
            exitwhen j > COLU
                set x = X1 + DX * (j-1)
                set y = Y1 - DY * (i-1)
                //===========================================================================
                // Icon Base
                set temp_destruct = CreateDestructable('B000',x,y,0,1,0)
                set IconBase[i][j] = temp_destruct
                //===========================================================================
                // Icon Selector
                set temp_destruct = CreateDestructable('B001',x,y,0,1,0)
                set Selection[i][j] = temp_destruct
                call ShowDestructable(temp_destruct,false)
                //===========================================================================
                // Create Icons then hiding it
                set temp_destruct = CreateDestructable('Z000',x,y,0,1,0)
                set ShamanClaw[i][j] = temp_destruct
                call ShowDestructable(temp_destruct,false)
                //===========================================================================
                set temp_track = CreateTrackable(MDL,x,y,0)
                set SLOT[i][j] = temp_track
                call TriggerRegisterTrackableHitEvent  (C,temp_track)
                call TriggerRegisterTrackableTrackEvent(T,temp_track)
                set Label[i][j] = Empty
            set j = j + 1
        endloop
        set i = i + 1
    endloop
    call initItems()
    call FogModifierStart(CreateFogModifierRect(Player(0),FOG_OF_WAR_VISIBLE,bj_mapInitialPlayableArea,true,false))
    call TriggerAddAction(C, function Clicked_Actions)
    call TriggerAddAction(T, function Tracked_Actions)
    set C = null
    set T = null
    set temp_track = null
    set temp_destruct = null
    call CameraSetupSetField(gg_cam_1, CAMERA_FIELD_TARGET_DISTANCE, (ROWS+COLU)* 100.0, 0.0)
    call CameraSetupSetDestPosition(gg_cam_1, X1 + 0.5 * DX * (ROWS-1), Y1 - 0.5 * DY * (COLU-1), 0.0)
    call CameraSetupApplyForceDuration(gg_cam_1,true,0)
    call SetCameraTargetController(CreateUnit(Player(0),'e000',X1 + 0.5 * DX * (ROWS-1),Y1 - 0.5 * DY * (COLU-1),0), 0, 0, false)
    call TriggerSleepAction( 0.00 )
    
    set ItemStats = CreateMultiboard()
    call MultiboardSetRowCount(ItemStats, 1)
    call MultiboardSetColumnCount(ItemStats, 1)
    call MultiboardSetTitleText(ItemStats, "|cff8F8F8FEmpty Slot|r")
    call MultiboardDisplay(ItemStats, true)
    call MultiboardDisplay(ItemStats, true)
    call MultiboardMinimize(ItemStats, true)
endfunction

//===========================================================================
function InitTrig_Init takes nothing returns nothing
    set gg_trg_Init = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Init, function Trig_Init_Actions )
endfunction
 
Level 25
Joined
Jun 5, 2008
Messages
2,573
You could also experiment with floating texts instead of multiboards.
I always found multiboards odd for such usage.

Edit:

Use a table and HandleId's.
For example:
JASS:
globals
  Data Table
  .
  .
  .
endglobals

struct trackableStorage
 boolean hasItem
 customItem i
 // more slot related stuff you need

endstruct

struct customItem

 string name
 string description
 // add more stuff you want =\

endstruct



...
function Tracked_Actions takes nothing returns nothing
local tracakbleStorage data
set data = Data[GetHandleId(GetTriggeringTrackable())]
if data.hasItem then
  call BJDebugMsg(data.i.description)
endif
endfunction

For example this when written properly would show the description of the item in the tracked slot.
It's much more nicer than going through loops, don't you think?

Edit2:

You could also save the indexes into the table, like row 1, column 3.
Then use your integer arrays to read the data of the slot.
But i prefer struct usage like the listed above, more modular imo.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
I am currently making the inventory just as a storage place but there is something I can't solve.

My idea of making the inventory is by making a unique ID for each item type that I want to add to the system.

I am counting the rows and columns via i,j loops, now when I click on a slot then click on another one (empty or used) all I have to do is swap IDs for the 2 slots. No problem with that.

The thing that I can't make is showing and hiding the destructables, if I already saved the destructables in a hashtable with parent key = itemTypeID and the child key = slot place (i,j) how do I make it MUI, the only non-practical solution I can think of is an array hashtable which is non-sense. I also don't want to use the table because I don't understand what it do and how do I use it and I can't make any heads or tails of it (I really don't know what kind of brilliant mind that Bribe has)
 
Level 25
Joined
Jun 5, 2008
Messages
2,573
Man it's not all that hard at all.

JASS:
struct customSlot

 integer slotType
 integer itemTypeId
 integer row
 integer column
 real      x
 real      y

 integer playerId

Loop for all players, create whole slots at some locations.
Have an integer array to store the number of slots per player.
Now save the structs of customSlot into hashtables using:
JASS:
 // this is inside the loop, looping with integer i for all players, looping r and c for all rows and columns

 customSlot dat = customSlot.create()
 set DataCount[i] = DataCount[i] +1
// the amount of trackables a certain player will render

 set dat.track = CreateTrackable(.....)
 set dat.x = *your x*
 set dat.y = *your y*
 set dat.row = r
 set dat.column = c
 set dat.slotType = 0 // for example, use codes for slot types
                                 // 0 - storage, 1 - helm, 2 - weapon, etc

// for equipment slots manually set them up or use another loop.
 
// save the struct data binded to trackable handle
call SaveInteger(Hashtable, GetHandleId(dat.track), 0, (dat))

// save the struct data to player/DataCount for rendering purposes
call SaveInteger(Hashtable, i, DataCount[i], (dat))

When you render the system for a certain player, you use the loop:
JASS:
local integer i = 0
local customSlot slot
loop
 exitwhen i >= DataCount[*PlayerId*]

 set slot = LoadInteger(Hashtable, *PlayerId*, i)
 call CreateDestructable(slot.x, slot.y, *whatever more options you want*)
 set i = i+1
endloop

When you want to hide or destroy the destructables use the same loop.

Hope this helps.

Edit:

When you want to get the customSlot data you use the handle of trackable.
 
The design Kingz is suggesting is the best you could do.
You should divide your system into many structs with distinct functions and roles.

JASS:
struct Item extends array
    integer id
    /*
    *   This is optional and depends on how you 
    *   handle the actual item handles. If it were
    *   my map, I'd make all items powerups that 
    *   you could pick up and the system would 
    *   remove them after creating 1 Item object 
    *   and inserting it into a Slot.
    */
    item item
endstruct

struct Slot extends array
    Item currentItem
    boolean occupied
    integer id
endstruct

struct Inventory extends array
    static Slot array slots
    static integer slotCount = 49 // Assuming a 7x7 inventory system
endstruct

That should do it.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
Will I need interfaces, stub , super , delegate and all that advanced stuff ?

Another questions:
- Are the parent and child key limited to 8190 as array index or I can use offsets in my hashtable; I am just assuming that you are making a massive map and using tons of item types with a really large number of slots and many units with inventory with a full 12 player.

- Are there an inventory more simpler than Anarchon's one; I really can't understand a single word from it, or at least if someone can tell me how do I "study" it.

@ Mag: I know you are able to make me learn this, you have a very powerful and persuasive psychic powers ;)
 
stub is not advanced, super is never really needed, delegates are only needed in cases in which you are making an advanced and fast API.

You need 0 of those.

edit
Don't use Anachron's system.
It uses a lot of the things you're not very familiar with.
I'd totally recommend writing your own.
I did that once. It was a fun experience, but I had a problem with images crashing the game :p
 
Level 25
Joined
Jun 5, 2008
Messages
2,573
HandleIds are really big integers greater than 8190 its more than an array can handle, how can I do that ?

I didn't mean that.

JASS:
function onClick takes nothing returns nothing
slotData dat  = LoadInteger(Hashtable, GetHandleId(GetTriggeringTrackable()), 0)

// do your stuff with the slot data now...
// if you want to get the row/column use slotData.row, slotData.column

endfunction

Edit:

I could write an FSI core if you want or give you a structure i use for mine FSI and full screen skill trees.

Edit2:

Are the parent and child key limited to 8190 as array index or I can use offsets in my hashtable; I am just assuming that you are making a massive map and using tons of item types with a really large number of slots and many units with inventory with a full 12 player.

Hashtables aren't limited to 8190 per keys, they can use handle id's without any offsets or anything.
 
Status
Not open for further replies.
Top