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

[JASS] Ehm, hi, multiboards, once again (Have read tutorials)

Status
Not open for further replies.
Level 6
Joined
Jul 25, 2005
Messages
221
Hullo, I was gonna use this multiboard trick where you only display a multiboard to a certain player, and it didnt work, can anyone correct this or explain why it doesnt work... or something? :eekani:
Dont mind the udg_variables, they havent actually been corrected. its the whole if(GetLocalPlayer()==p) thing im confused about.

JASS:
function Trig_Create_Multiboard_Actions takes nothing returns nothing
local integer i
local player p
    set p=Player(0)
    set i=0
    call TriggerSleepAction( 0.05 )
    call SetTimeOfDay( 6.00 )
    set udg_real_Seconds = 5.00
    set udg_real_PeriodicTime = 0.05
    set udg_real_TimeBetweenPower = ( udg_real_Seconds * ( 1 / udg_real_PeriodicTime ) )
    // Time between power gain is as follows: 20= 1 second, 40= 2 etc.
    // real_TimeBetweenPower  = Time/(1/Periodic Time) = n seconds
    // or: n seconds *  (1/Periodic Time) = Time (= time for TimeBetweenPower)
    set udg_real_PowerAdd = 0.00
    set udg_real_MaxPower = 5000.00
    loop
        exitwhen (i>11)
    call CreateMultiboardBJ( 2, 2, "Power" )
    set udg_multiboard_Power = GetLastCreatedMultiboard()
    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 1, "Current: " )
    call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 1, "ReplaceableTextures\\CommandButtons\\BTNMoonStone.blp" )
    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 2, 1, I2S(R2I(udg_real_Power)) )
    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 2, "Max: " )
    call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 2, "ReplaceableTextures\\CommandButtons\\BTNMoonStone.blp" )
    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 2, 2, I2S(R2I(udg_real_MaxPower)) )
    call MultiboardSetItemStyleBJ( GetLastCreatedMultiboard(), 2, 1, true, false )
    call MultiboardSetItemStyleBJ( GetLastCreatedMultiboard(), 2, 2, true, false )
    call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 1, 1, 7.00 )
    call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 2, 1, 6.00 )
    call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 1, 2, 7.00 )
    call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 2, 2, 6.00 )
    call MultiboardDisplayBJ( false, GetLastCreatedMultiboard() )
    if(GetLocalPlayer()== p) then
    call MultiboardDisplayBJ( true, GetLastCreatedMultiboard() )
    endif
    set p=Player(i)
    set i=i+1
    endloop
endfunction
//===========================================================================
function InitTrig_Create_Multiboard takes nothing returns nothing
    set gg_trg_Create_Multiboard = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Create_Multiboard, function Trig_Create_Multiboard_Actions )
endfunction
 
Level 17
Joined
Apr 13, 2008
Messages
1,608
JASS:
   set udg_multiboard_Power = GetLastCreatedMultiboard()

Use a multiboard array instead of this.


JASS:
    if(GetLocalPlayer()== p) then
    call MultiboardDisplayBJ( true, GetLastCreatedMultiboard() )
    endif

Use the multiboard array inside of this instead of the LastCreatedMultiboard.
 
Level 6
Joined
Jul 25, 2005
Messages
221
Ok, doing what you said, made no difference, it still doesn't show a multiboard

Note: Doing it without the loop works alright, for ONE player, then i copied and pasted the same code, and the latter code overwrote the first one, so now player two has a multiboard and player one doesn't
 
Level 6
Joined
Jul 25, 2005
Messages
221
Could it be because of i=0? or should that not matter?
can anyone make a better version of my trigger, purely for study purpose. :)
 
Level 17
Joined
Apr 13, 2008
Messages
1,608
No, I'm sure that's not a problem. I don't see the problem here, but it's 3 AM and I'm not too excited about this so I might have skipped something :p

But I do 3 things differently in my map (and my MBs do work).

I placed the "if GetLocalPlayer" lines outside of the main loop.
I did not compare the local player to a Player(loopinteger) but I did one if statement for every player.

And last: I did not do this:
call MultiboardDisplayBJ( false, GetLastCreatedMultiboard() )

I don't think these changes could cause a problem but meh, give it a try, who knows?
 
Level 6
Joined
Jul 25, 2005
Messages
221
Aha! The thing that made it not show was "Call MultiboardDisplay bla bla false) obviously
You were right :p

It works perfectly, im gonna see if i can use the loop with i as integer anyway :D

+rep coming your way mate :)

EDIT:

Yay, using the loop integer worked like a charm! :D
Here's how the code looks now, if any of the other members have experience the same prob as me:
JASS:
function Trig_Create_Multiboard_Actions takes nothing returns nothing
local integer i
    call TriggerSleepAction( 0.05 )
    call SetTimeOfDay( 6.00 )
    set udg_real_Seconds = 5.00
    set udg_real_PeriodicTime = 0.05
    set udg_real_TimeBetweenPower = ( udg_real_Seconds * ( 1 / udg_real_PeriodicTime ) )
    // Time between power gain is as follows: 20= 1 second, 40= 2 etc.
    // real_TimeBetweenPower  = Time/(1/Periodic Time) = n seconds
    // or: n seconds *  (1/Periodic Time) = Time (= time for TimeBetweenPower)
    set udg_real_PowerAdd = 0.00
    set udg_real_MaxPower = 5000.00
    set i=0
    loop
        exitwhen (i>11)
    call CreateMultiboardBJ( 2, 2, "Power" )
    set udg_multiboard_Power[i] = GetLastCreatedMultiboard()
    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 1, "Current: " )
    call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 1, "ReplaceableTextures\\CommandButtons\\BTNMoonStone.blp" )
    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 2, 1, I2S(R2I(udg_real_Power)) )
    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 2, "Max: " )
    call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 2, "ReplaceableTextures\\CommandButtons\\BTNMoonStone.blp" )
    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 2, 2, I2S(R2I(udg_real_MaxPower)) )
    call MultiboardSetItemStyleBJ( GetLastCreatedMultiboard(), 2, 1, true, false )
    call MultiboardSetItemStyleBJ( GetLastCreatedMultiboard(), 2, 2, true, false )
    call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 1, 1, 7.00 )
    call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 2, 1, 6.00 )
    call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 1, 2, 7.00 )
    call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 2, 2, 6.00 )
    call MultiboardDisplay( GetLastCreatedMultiboard(), false)
    call MultiboardDisplay( GetLastCreatedMultiboard(), true)
    set i=i+1
    if(GetLocalPlayer()== Player(i)) then
    call MultiboardDisplay(udg_multiboard_Power[i], true)
    endif
    endloop
endfunction
//===========================================================================
function InitTrig_Create_Multiboard takes nothing returns nothing
    set gg_trg_Create_Multiboard = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_kill_trigger_2, Player(0), "kill", true )
    call TriggerAddAction( gg_trg_Create_Multiboard, function Trig_Create_Multiboard_Actions )
endfunction

EDIT, EDIT: is it better to divide it up like this? (Please don't be mean to my posting methods... its not spamming (I hope))
JASS:
function loopformultiboards takes nothing returns nothing
local integer i
    set i=0
    loop
    exitwhen (i>11)
    call CreateMultiboardBJ( 2, 2, "Power" )
    set udg_multiboard_Power[i] = GetLastCreatedMultiboard()
    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 1, "Current: " )
    call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 1, "ReplaceableTextures\\CommandButtons\\BTNMoonStone.blp" )
    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 2, 1, I2S(R2I(udg_real_Power)) )
    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 1, 2, "Max: " )
    call MultiboardSetItemIconBJ( GetLastCreatedMultiboard(), 1, 2, "ReplaceableTextures\\CommandButtons\\BTNMoonStone.blp" )
    call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 2, 2, I2S(R2I(udg_real_MaxPower)) )
    call MultiboardSetItemStyleBJ( GetLastCreatedMultiboard(), 2, 1, true, false )
    call MultiboardSetItemStyleBJ( GetLastCreatedMultiboard(), 2, 2, true, false )
    call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 1, 1, 7.00 )
    call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 2, 1, 6.00 )
    call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 1, 2, 7.00 )
    call MultiboardSetItemWidthBJ( GetLastCreatedMultiboard(), 2, 2, 6.00 )
    call MultiboardDisplay( GetLastCreatedMultiboard(), false)
    call MultiboardDisplay( GetLastCreatedMultiboard(), true)
    set i=i+1
    if(GetLocalPlayer()== Player(i)) then
    call MultiboardDisplay(udg_multiboard_Power[i], true)
    endif
    endloop
endfunction
function Trig_Create_Multiboard_Actions takes nothing returns nothing
    call TriggerSleepAction( 0.05 )
    call SetTimeOfDay( 6.00 )
    set udg_real_Seconds = 5.00
    set udg_real_PeriodicTime = 0.05
    set udg_real_TimeBetweenPower = ( udg_real_Seconds * ( 1 / udg_real_PeriodicTime ) )
    // Time between power gain is as follows: 20= 1 second, 40= 2 etc.
    // real_TimeBetweenPower  = Time/(1/Periodic Time) = n seconds
    // or: n seconds *  (1/Periodic Time) = Time (= time for TimeBetweenPower)
    set udg_real_PowerAdd = 0.00
    set udg_real_MaxPower = 5000.00
    call loopformultiboards()
endfunction
//===========================================================================
function InitTrig_Create_Multiboard takes nothing returns nothing
    set gg_trg_Create_Multiboard = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_kill_trigger_2, Player(0), "kill", true )
    call TriggerAddAction( gg_trg_Create_Multiboard, function Trig_Create_Multiboard_Actions )
endfunction
 
Last edited:
Status
Not open for further replies.
Top