wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Tutorials > JASS/AI scripts tutorials
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 03-13-2006, 05:15 AM   #1
kaldoreielf
User
 
kaldoreielf's Avatar
 
Join Date: Mar 2006
Posts: 179

Submissions (2)

kaldoreielf has a little shameless behaviour in the past (-5)

Send a message via MSN to kaldoreielf
Default Multiboard per player tutorial

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:
Collapse 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
Now where it says *TRIGGERNAME* type in the exact name of this JASS trigger, if it isn't exact, it won't work.
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:
Collapse 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
Collapse Events
Time - Elapsed game time is 0.05 seconds
Conditions
Collapse 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]))
I have setup all rows and columns now for player one, if you wish to do this for other players, repeat and change Multiboard[1] to Multiboard[PlayerNumber]
Credit to Vuen also, for helping me with the tutorial.
Have fun, and I hoped this helped you out, enjoy!

Added By BertTheJasser:
Collapse 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

__________________
My Warcraft Log - Please leave some comments!

Funny Warcraft Pictures Gallery Latest Picture: Up-close Blood Mage

Last edited by kaldoreielf : 05-20-2006 at 10:55 PM.
kaldoreielf is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 05-11-2006, 06:20 PM   #2
operator
User
 
Join Date: Apr 2006
Posts: 172

Submissions (7)

operator will become famous soon enough (37)operator will become famous soon enough (37)

Send a message via MSN to operator
Default

Nice, I have been looking for sumthing like this
operator is offline   Reply With Quote
Old 05-12-2006, 03:27 PM   #3
Thunder_Eye
Lol I got a custom title!
 
Thunder_Eye's Avatar
 
Join Date: Aug 2004
Posts: 1,231

Thunder_Eye has a spectacular aura about (88)Thunder_Eye has a spectacular aura about (88)Thunder_Eye has a spectacular aura about (88)

Default

In the first example why are you using JASS?
__________________
Thunder_Eye is offline   Reply With Quote
Old 05-12-2006, 09:12 PM   #4
kaldoreielf
User
 
kaldoreielf's Avatar
 
Join Date: Mar 2006
Posts: 179

Submissions (2)

kaldoreielf has a little shameless behaviour in the past (-5)

Send a message via MSN to kaldoreielf
Default

Because this is a JASS tutorial in multiboards.
__________________
My Warcraft Log - Please leave some comments!

Funny Warcraft Pictures Gallery Latest Picture: Up-close Blood Mage
kaldoreielf is offline   Reply With Quote
Old 05-20-2006, 09:33 AM   #5
BertTheJasser
xyzi - our universe
 
BertTheJasser's Avatar
 
Join Date: May 2005
Posts: 742

Submissions (2)

BertTheJasser has a spectacular aura about (111)BertTheJasser has a spectacular aura about (111)BertTheJasser has a spectacular aura about (111)BertTheJasser has a spectacular aura about (111)

Default

Update:
Collapse 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.
__________________
Note: Bye... I had a lot of fun here!
Special thanks to Vexorian who helped me learn jass, the real jass and always helped me when problems occured, I would call him somehow my mentor. Pipedream, who made amazing Grimoire and helped me acclerating my map (currently at 99% finished, no developement atm).

Vote for Linux Ports in general of Blizzard products: http://www.PetitionOnline.com/ibpfl/

Last edited by BertTheJasser : 05-20-2006 at 09:40 AM.
BertTheJasser is offline   Reply With Quote
Old 05-24-2006, 12:03 AM   #6
Kahlar
User
 
Join Date: May 2006
Posts: 3

Kahlar has little to show at this moment (0)

Default

Nice tut.
Kahlar is offline   Reply With Quote
Old 08-25-2006, 06:49 AM   #8
taste
User
 
taste's Avatar
 
Join Date: Aug 2006
Posts: 12

taste has little to show at this moment (0)

Default

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?
taste is offline   Reply With Quote
Old 03-03-2007, 01:33 PM   #9
Chocobo
User
 
Chocobo's Avatar
 
Join Date: Dec 2006
Posts: 226

Chocobo is on a distinguished road (24)

Default

Quote:
Originally Posted by taste
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?

It's using GetLocalPlayer()..
__________________
__________________
good
Chocobo is offline   Reply With Quote
Old 05-05-2007, 02:08 PM   #10
undeadorcjerk
User
 
Join Date: Dec 2006
Posts: 8

undeadorcjerk has little to show at this moment (0)

Default

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.
__________________
~Nile




Illidan image from Chaosan

Wisdom from my friend Inuperrin on azeroth server: Go jump off a thing above acid with flying, firebreathing parrannas.
undeadorcjerk is offline   Reply With Quote
Old 07-05-2007, 03:35 PM   #11
Mapz_Maker
User
 
Mapz_Maker's Avatar
 
Join Date: Nov 2006
Posts: 198

Submissions (1)

Mapz_Maker is on a distinguished road (12)

Default

always nice to see someone manipulate and simplify my code, lol.
I wrote the original per player multiboard tutorial (on wc3c), except it was a menu, which is better!
__________________
Trigger:
Rep Mapz_Maker
Events
WC3C - Mapz_Maker makes a post!
Conditions
Actions
Custom Script: loop
Custom Script: exitwhen 1 = 2
Custom Script: set Mapz_Maker's Rep = Mapz_Maker's Rep + 1
Custom Script: endloop

Last edited by Mapz_Maker : 07-05-2007 at 03:36 PM.
Mapz_Maker is offline   Reply With Quote
Old 10-24-2007, 12:35 AM   #12
eliw00d
User
 
Join Date: Jun 2007
Posts: 2

eliw00d has little to show at this moment (0)

Default it doesn't work

nevermind.

Last edited by eliw00d : 10-24-2007 at 12:39 AM.
eliw00d is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 03:36 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2014, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services