|
|
#1 |
|
User
|
Hello! and welcome to my Multiboard per player tutorial! now lets get started...
__________________WHAT YOU NEED: 1. World Editor 2. Basic JASS knowledge VARIABLES: I have 10 players in my map, so I use 10 different multiboard variables, called Multiboard[ARRAY]. The array is the player number, for example, player one is Multiboard[1], player two is Multiboard[2] and so on. One Integar variable called i. Now make a GUI trigger and call it whatever you want, then go to Edit, Convert to Custom text. This will make the GUI trigger into JASS format. Now put this text in the JASS trigger: JASS: JASS:function *TRIGGERNAME* takes nothing returns nothing local integer i = 1 call TriggerSleepAction( 0.00 ) loop exitwhen i > 12 set udg_Multiboard[i] = CreateMultiboardBJ( ROWS, COLUMNS, "TITLE" ) call MultiboardDisplayBJ( false, udg_Multiboard[i] ) set i = i + 1 endloop set i = 1 loop exitwhen i > 12 if ConvertedPlayer(i) == GetLocalPlayer() then call MultiboardDisplayBJ( true, udg_Multiboard[i] ) endif set i = i + 1 endloop endfunction To see if it works, right click the trigger and click Enable trigger, then do it again, if it works the trigger will turn back on, if not, it will show you the errors. This will now show one single Multiboard for each player.why it works; What happens is all 12 multiboards are created on everyone's computer and they are all hidden, and then each player's board is made visible on their respective computer via GetLocalPlayer(). To Customize: If you have less than 12 players in the game, change the stars to the number of players: JASS: JASS:function *TRIGGERNAME* takes nothing returns nothing local integer i = 1 call TriggerSleepAction( 0.00 ) loop exitwhen i > *** set udg_Multiboard[i] = CreateMultiboardBJ( 3, 5, "Title" ) call MultiboardDisplayBJ( false, udg_Multiboard[i] ) set i = i + 1 endloop set i = 1 loop exitwhen i > *** if ConvertedPlayer(i) == GetLocalPlayer() then call MultiboardDisplayBJ( true, udg_Multiboard[i] ) endif set i = i + 1 endloop endfunction Now to setup the Multiboard for your players, create a new GUI trigger. I have made an RPG map, and I use this multiboard system to show skill levels, this is how it worked: Trigger: ![]() Trigger:![]() SetupPlayerOne![]() Conditions![]() Actions![]() ![]() Multiboard - Set the text for Multiboard[1] item in column 1, row 1 to Cooking![]() ![]() Multiboard - Set the text for Multiboard[1] item in column 1, row 2 to Fishing![]() ![]() Multiboard - Set the text for Multiboard[1] item in column 1, row 3 to Fletching![]() ![]() Multiboard - Set the text for Multiboard[1] item in column 1, row 4 to Herblaw![]() ![]() Multiboard - Set the text for Multiboard[1] item in column 1, row 5 to Mining![]() ![]() Multiboard - Set the text for Multiboard[1] item in column 1, row 6 to Smithing![]() ![]() Multiboard - Set the width for Multiboard[1] item in column 0, row 0 to 5.50% of the total screen width![]() ![]() Multiboard - Set the display style for Multiboard[1] item in column 0, row 0 to Show text and Hide icons![]() ![]() Multiboard - Set the text for Multiboard[1] item in column 2, row 1 to (String(Cooking[1]))![]() ![]() Multiboard - Set the text for Multiboard[1] item in column 2, row 2 to (String(Fishing[1]))![]() ![]() Multiboard - Set the text for Multiboard[1] item in column 2, row 3 to (String(Fletching[1]))![]() ![]() Multiboard - Set the text for Multiboard[1] item in column 2, row 4 to (String(Herblaw[1]))![]() ![]() Multiboard - Set the text for Multiboard[1] item in column 2, row 5 to (String(Mining[1]))![]() ![]() Multiboard - Set the text for Multiboard[1] item in column 2, row 6 to (String(Smithing[1]))Credit to Vuen also, for helping me with the tutorial. Have fun, and I hoped this helped you out, enjoy! Added By BertTheJasser: JASS:function CreateMultiboardEx_ColumnCount takes nothing returns integer return 4 //How many columns the mb will have endfunction function CreateMultiboardEx_RowCount takes nothing returns integer return 4 //How many rows the mb will have endfunction function CreateMultiboardEx_Width takes integer row,integer column returns real return 0.06 //the width of a signle item endfunction function CreateMultiboardEx_Val takes integer row,integer column returns string return "" //the string shown at that position endfunction function CreateMultiboardEx_Icon takes integer row,integer column returns string return "" //the icon shown at that position endfunction function UpdateMultiboardEx takes multiboard mb,integer row,integer column,string val,string icon,real width returns nothing local multiboarditem mbi=MultiboardGetItem(mb,row,column) call MultiboardSetItemStyle(mbi,val!="",icon!="") if val!="" then call MultiboardSetItemValue(mbi,val) endif if icon!="" then call MultiboardSetItemIcon(mbi,icon) endif call MultiboardSetItemWidth(mbi,width) call MultiboardReleaseItem(mbi) set mbi=null endfunction //use p==null if you wanna create a mb for all players function CreateMultiboardEx takes player p returns multiboard local multiboard mb=CreateMultiboard() local multiboarditem mbi local string val local string icon local integer column=0 local integer row=0 if p==null then call MultiboardDisplay(mb,true) else call MultiboardDisplay(mb,GetLocalPlayer()==p) endif loop exitwhen row>CreateMultiboardEx_RowCount() set column=0 loop exitwhen column>CreateMultiboardEx_columnCount() set val=CreateMultiboardEx_Val(row,column) set icon=CreateMultiboardEx_Icon(row,column) set mbi=MultiboardGetItem(mb,row,column) call MultiboardSetItemStyle(mbi,val!="",icon!="") if val!="" then call MultiboardSetItemValue(mbi,val) endif if icon!="" then call MultiboardSetItemIcon(mbi,icon) endif call MultiboardSetItemWidth(mbi,CreateMultiboardEx_Width(row,column)) call MultiboardReleaseItem(mbi) set column=column+1 endloop set row=row+1 endloop set mbi=null set bj_lastCreatedMultiboard=mb set mb=null return bj_lastCreatedMultiboard endfunction Last edited by kaldoreielf : 05-20-2006 at 10:55 PM. |
|
|
|
| Sponsored Links - Login to hide this ad! |
|
|
|
|
#2 |
|
User
|
Nice, I have been looking for sumthing like this
|
|
|
|
|
|
#3 |
|
Lol I got a custom title!
Join Date: Aug 2004
Posts: 1,231
![]() ![]()
|
In the first example why are you using JASS?
__________________ |
|
|
|
|
|
#4 |
|
User
|
Because this is a JASS tutorial in multiboards.
__________________ |
|
|
|
|
|
#5 |
|
xyzi - our universe
Join Date: May 2005
Posts: 742
![]() ![]() ![]()
|
Update:
__________________ JASS:function CreateMultiboardEx_ColumnCount takes nothing returns integer return 4 //How many columns the mb will have endfunction function CreateMultiboardEx_RowCount takes nothing returns integer return 4 //How many rows the mb will have endfunction function CreateMultiboardEx_Width takes integer row,integer column returns real return 0.06 //the width of a signle item endfunction function CreateMultiboardEx_Val takes integer row,integer column returns string return "" //the string shown at that position endfunction function CreateMultiboardEx_Icon takes integer row,integer column returns string return "" //the icon shown at that position endfunction function UpdateMultiboardEx takes multiboard mb,integer row,integer column,string val,string icon,real width returns nothing local multiboarditem mbi=MultiboardGetItem(mb,row,column) call MultiboardSetItemStyle(mbi,val!="",icon!="") if val!="" then call MultiboardSetItemValue(mbi,val) endif if icon!="" then call MultiboardSetItemIcon(mbi,icon) endif call MultiboardSetItemWidth(mbi,width) call MultiboardReleaseItem(mbi) set mbi=null endfunction //use p==null if you wanna create a mb for all players function CreateMultiboardEx takes player p returns multiboard local multiboard mb=CreateMultiboard() local multiboarditem mbi local string val local string icon local integer column=0 local integer row=0 if p==null then call MultiboardDisplay(mb,true) else call MultiboardDisplay(mb,GetLocalPlayer()==p) endif loop exitwhen row>CreateMultiboardEx_RowCount() set column=0 loop exitwhen column>CreateMultiboardEx_columnCount() set val=CreateMultiboardEx_Val(row,column) set icon=CreateMultiboardEx_Icon(row,column) set mbi=MultiboardGetItem(mb,row,column) call MultiboardSetItemStyle(mbi,val!="",icon!="") if val!="" then call MultiboardSetItemValue(mbi,val) endif if icon!="" then call MultiboardSetItemIcon(mbi,icon) endif call MultiboardSetItemWidth(mbi,CreateMultiboardEx_Width(row,column)) call MultiboardReleaseItem(mbi) set column=column+1 endloop set row=row+1 endloop set mbi=null set bj_lastCreatedMultiboard=mb set mb=null return bj_lastCreatedMultiboard endfunction Now it should work. Last edited by BertTheJasser : 05-20-2006 at 09:40 AM. |
|
|
|
|
|
#6 |
|
User
Join Date: May 2006
Posts: 3
|
Nice tut.
|
|
|
|
|
|
#8 |
|
User
Join Date: Aug 2006
Posts: 12
|
just wondering, does this mean that by default using the CreateMultiboardBJ function, the multiboard is only created for player1? and not the other players in a network game?
|
|
|
|
|
|
#9 | |
|
User
Join Date: Dec 2006
Posts: 226
|
Quote:
It's using GetLocalPlayer().. |
|
|
|
|
|
|
#10 |
|
User
Join Date: Dec 2006
Posts: 8
|
I must be an idiot or something, but i would be greatful if sometold me what i was doing wrong.
__________________Im on the first part, i copied and pasted the jass into my trigger then replaced *triggername* with the trigger's name. When i test to see if it works, it says there is an error on line 25, it says it expects a name. thats my problem. Thx if you help. |
|
|
|
|
|
#12 |
|
User
Join Date: Jun 2007
Posts: 2
|
nevermind.
Last edited by eliw00d : 10-24-2007 at 12:39 AM. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
|
Donate |