• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Weapon system 1.0

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
A system that allows you to display a hero's stats(including a few that the ui doesnt mention) and weapon type in a multiboard, while also adding stats using Cohadars Bonus system. Documentation is included. No BJ's, and includes a demo. Credits to Cohadar for Bonus
JASS:
//////////////////////////////////////////////////////////////////////////////////////////////////
// Lobsters Multiboard weapon system\\
//  Description: creates a multiboard for a player that describes a units attack, armor, stats, 
//  attack speed, and evasion, along with allowing you to increase these stats using 
//  Cohadars bonus system(modified)
//  
//  Intended Use: This system is intended for rpgs' and other maps that focus on one hero per player
//  It is made to replace items as a weapon slot
//
//  Requires: vjass
//  Importing: Copy the code out of the custom script section,and place 
//  it in YOUR maps custom script box. Next copy the Bonus, and Bonus Plugins into your map.
//  Enable the plugins, and save, close the map, open the map, and disable the plugins.
//
//  Demo instructions: Press Esc to create the multiboard. Then type "increase#" where # 
//  is a number between 1 and 8. You will see your stats in both the hero, and the multiboard
//  go up.
//
//  Using the system: Using the system is easy. To register a multiboard for a player use the 
//  function:
//
//  function MultiboardCreate takes player p, string wt,  string title returns nothing.
//
//  player p is the player for whom the mkultiboard will appear
//  string wt is the weapon type(or anything else you want to put in the first row)
//  string title is the multiboards title.
//
//  Use the following functions to increase a heros stats
// 
//  function updateattack takes unit u, integer i returns nothing
//  function updatestrength takes unit u, integer i returns nothing
//  function updateagility takes unit u, integer i returns nothing
//  function updateintelligence takes unit u, integer i returns nothing
//  function updatearmor takes unit u, integer i returns nothing
//  function updatespeed takes unit u, integer i returns nothing
//  function updatecritical takes unit u, integer i returns nothing 
//  function updateevasion takes unit u, integer i returns nothing 
// 
//  where unit u is the unit, and integer i is the amount for the respective
//  stat.
// 
// Special Thanks to: Cohadar for Bonus.

function MultiboardCreate takes player p, string wt,  string title returns nothing
globals
//configurables
string attributedamage      = "Sharpness"
string attributestrength    = "Strength"
string attributeagility     = "Agility"
string attributeintelligence= "intelligence"
string attributearmor       = "Defense"
string attributespeed       = "Speed"
string attributecritical    = "Critical"
string attributeevasion     = "Evasion"

// end configurables

    multiboard array multi
    string multititle
    integer array damage 
    integer array strength
    integer array agility
    integer array intelligence
    integer array defense
    integer array aspeed
    integer array critical
    integer array evasion
endglobals

    local multiboard m
    local integer pli
   
    
    call BJDebugMsg("test1")
    set multi[GetPlayerId(p)] = CreateMultiboard()
    set m = multi[GetPlayerId(p)]
    set pli = GetPlayerId(p)
    
     
    
    call MultiboardDisplay(multi[GetPlayerId(p)],false)
    call MultiboardSetItemsStyle(m,true, false)
//Now to setup the multiboard
    call MultiboardSetColumnCount(m, 1)
    call MultiboardSetRowCount(m, 9)
    call MultiboardSetItemsWidth(m, .1)
    call MultiboardSetTitleText(m, title)
    call MultiboardSetItemsStyle(m,true, false)
    call MultiboardSetItemValue(MultiboardGetItem(m, 0,0), wt)
    call MultiboardSetItemValue(MultiboardGetItem(m, 1,0), attributedamage + ": " +I2S(damage[pli]))
    call MultiboardSetItemValue(MultiboardGetItem(m, 2,0), attributestrength + ": " +I2S(strength[pli]))
    call MultiboardSetItemValue(MultiboardGetItem(m, 3,0), attributeagility + ": " +I2S(agility[pli]))
    call MultiboardSetItemValue(MultiboardGetItem(m, 4,0), attributeintelligence + ": " +I2S(intelligence[pli]))
    call MultiboardSetItemValue(MultiboardGetItem(m, 5,0), attributearmor + ": " +I2S(defense[pli]))
    call MultiboardSetItemValue(MultiboardGetItem(m, 6,0), attributespeed + ": " +I2S(aspeed[pli]))
    call MultiboardSetItemValue(MultiboardGetItem(m, 7,0), attributecritical + ": " +I2S(critical[pli])+"%")
    call MultiboardSetItemValue(MultiboardGetItem(m, 8,0), attributeevasion + ": " +I2S(evasion[pli])+"%")
        if GetLocalPlayer() == p then
            call MultiboardDisplay(m,true)
        endif
    endfunction
    
function updateattack takes unit u, integer i returns nothing 
    local multiboard m
    local player p
    local integer pli
    call BJDebugMsg("lol1")
    set p = GetOwningPlayer(u)
    set m = multi[GetPlayerId(p)]
    set pli = GetPlayerId(p)
    set Bonus_Damage[u] =  Bonus_Damage[u] + i
    set damage[pli] = damage[pli] + i
    call MultiboardSetItemValue(MultiboardGetItem(m,1,0), attributedamage + ": " +I2S(damage[pli]))
    
    
        
        
        
    
endfunction 

function updatestrength takes unit u, integer i returns nothing 
    local multiboard m
    local player p
    local integer pli
    set p = GetOwningPlayer(u)
    set m = multi[GetPlayerId(p)]
    set pli = GetPlayerId(p)
    set Bonus_Str[u] = Bonus_Str[u] + i
    set strength[pli] = strength[pli] + i
    call MultiboardSetItemValue(MultiboardGetItem(m,2,0), attributestrength + ": " +I2S(strength[pli]))
endfunction

function updateagility takes unit u, integer i returns nothing 
    local multiboard m
    local player p
    local integer pli
    set p = GetOwningPlayer(u)
    set m = multi[GetPlayerId(p)]
    set pli = GetPlayerId(p)
    set Bonus_Agi[u] = Bonus_Agi[u] + i
    set agility[pli] = agility[pli] + i
    call MultiboardSetItemValue(MultiboardGetItem(m,3,0), attributeagility + ": " +I2S(agility[pli]))
endfunction

function updateintelligence takes unit u, integer i returns nothing 
    local multiboard m
    local player p
    local integer pli
    set p = GetOwningPlayer(u)
    set m = multi[GetPlayerId(p)]
    set pli = GetPlayerId(p)
    set Bonus_Int[u] = Bonus_Int[u] + i
    set intelligence[pli] = intelligence[pli] + i
    call MultiboardSetItemValue(MultiboardGetItem(m,4,0), attributeintelligence + ": " +I2S(intelligence[pli]))
endfunction

function updatearmor takes unit u, integer i returns nothing 
    local multiboard m
    local player p
    local integer pli
    set p = GetOwningPlayer(u)
    set m = multi[GetPlayerId(p)]
    set pli = GetPlayerId(p)
    set Bonus_Armor[u] = Bonus_Armor[u] + i
    set defense[pli] = defense[pli] + i
    call MultiboardSetItemValue(MultiboardGetItem(m,5,0), attributearmor + ": " +I2S(defense[pli]))
endfunction

function updatespeed takes unit u, integer i returns nothing 
    local multiboard m
    local player p
    local integer pli
    set p = GetOwningPlayer(u)
    set m = multi[GetPlayerId(p)]
    set pli = GetPlayerId(p)
    set Bonus_AttackSpeed[u] = Bonus_AttackSpeed[u] + i
    set aspeed[pli] = aspeed[pli] + i
    call MultiboardSetItemValue(MultiboardGetItem(m,6,0), attributespeed + ": " +I2S(aspeed[pli]))
endfunction

function updatecritical takes unit u, integer i returns nothing 
    local multiboard m
    local player p
    local integer pli
    set p = GetOwningPlayer(u)
    set m = multi[GetPlayerId(p)]
    set pli = GetPlayerId(p)
    set Bonus_Critical[u] = Bonus_Critical[u] + i
    set critical[pli] = critical[pli] + i
    call MultiboardSetItemValue(MultiboardGetItem(m,7,0), attributecritical + ": " +I2S(critical[pli]))
endfunction

function updateevasion takes unit u, integer i returns nothing 
    local multiboard m
    local player p
    local integer pli
    set p = GetOwningPlayer(u)
    set m = multi[GetPlayerId(p)]
    set pli = GetPlayerId(p)
    set Bonus_Evasion[u] = Bonus_Evasion[u] + i
    set evasion[pli] = evasion[pli] + i
    call MultiboardSetItemValue(MultiboardGetItem(m,8,0), attributeevasion + ": " +I2S(evasion[pli]))
endfunction

Keywords:
Weapon, sword, lobster, ignorance, is, bliss, system, multiboard, strength, agility, intelligence, damage, speed, attack, evasion, critical, armor.
Contents

Just another Warcraft III map (Map)

Reviews
21:57, 2nd Jan 2010 TriggerHappy: This is far too simple (would be even more simpler with better written code) and is just not configurable enough. Also the items stats don't effect gameplay at all rendering this even less useful.

Moderator

M

Moderator

21:57, 2nd Jan 2010
TriggerHappy:

This is far too simple (would be even more simpler with better written code) and is just not configurable enough. Also the items stats don't effect gameplay at all rendering this even less useful.
 
Level 9
Joined
Jun 3, 2009
Messages
486
Yeah and hide the coding with the hidden tags pls, saves everyone the hassle of scrolling down for a couple of hours ;)
 
Level 9
Joined
Dec 12, 2007
Messages
489
well...
1.
JASS:
    set multi[GetPlayerId(p)] = CreateMultiboard()
    set m = multi[GetPlayerId(p)]
    set pli = GetPlayerId(p)
a little strange thing here, if you know what I mean.... this kind of things also happen in other function too.

2.

JASS:
function MultiboardCreate takes player p, string wt, string title returns nothing
globals
//configurables
string attributedamage = "Sharpness"
string attributestrength = "Strength"
string attributeagility = "Agility"
string attributeintelligence= "intelligence"
string attributearmor = "Defense"
string attributespeed = "Speed"
string attributecritical = "Critical"
string attributeevasion = "Evasion"

// end configurables

    multiboard array multi
    string multititle
    integer array damage
    integer array strength
    integer array agility
    integer array intelligence
    integer array defense
    integer array aspeed
    integer array critical
    integer array evasion
endglobals

....

I don't know if its good to declare globals inside function. besides, it not a library or scoped.

2.
JASS:
function updatestrength takes unit u, integer i returns nothing
    local multiboard m
    local player p
    local integer pli
    set p = GetOwningPlayer(u)
    set m = multi[GetPlayerId(p)]
    set pli = GetPlayerId(p)
    set Bonus_Str[u] = Bonus_Str[u] + i
    set strength[pli] = strength[pli] + i
    call MultiboardSetItemValue(MultiboardGetItem(m,2,0), attributestrength + ": " +I2S(strength[pli]))
endfunction
you don't null the local multiboard, and some variables can be inlined...

3. your testmap sucks, it has useless map size etc.
4. and your script is on custom script, you should put it on custom text trigger.
5. last, put your script on a library or scope.
 
Top