- Joined
- Mar 3, 2006
- Messages
- 1,564
I need to learn how FSI are made but I just want to know what is the best FSI system released till now ?
(Post a link please)
~TIA~
(Post a link please)
~TIA~
What does FSI mean?
... you need also to ave a knowledge on how to use trackables to make this system...
It would not be considered as "leaks" if you re-use them each time you wanna use them throughout the game.But trackables leak and can't be destroyed, isn't it ?
It would not be considered as "leaks" if you re-use them each time you wanna use them throughout the game.
Just like you're creating a location and set it as variable and keep re-use it, it is not considered as a leak.
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
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 ?
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
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
struct customSlot
integer slotType
integer itemTypeId
integer row
integer column
real x
real y
integer playerId
// 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))
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
Man it's not all that hard at all.
When you want to get the customSlot data you use the handle of trackable.
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
HandleIds are really big integers greater than 8190 its more than an array can handle, how can I do that ?
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
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.