• 🏆 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!

Assignment 2

Status
Not open for further replies.
Level 5
Joined
Jul 25, 2008
Messages
126
Not sure if I did this right kinda iffy on the specifications of the project. (Whats graded anyways just the project?)

JASS:
/*
*   You may only have 2 variables
*
*   Create a unit array called units and initialize it to the following
*   (you may use direct values for these writes)
*
*       index 5:    footman
*       index 11:   rifleman
*       index 421:  knight
*       index 56:   Paladin
*
*   You may use the following natives
*
*           Player
*           CreateUnit
*           GetUnitUserData
*           SetUnitUserData     (you may use direct values when using this native)
*           GetUnitName
*           I2S
*
*   You may use the following functions
*
*           Print(string)
*
*   You are only allowed to use the value 5 *one* time, and you may
*   only use the value 5
*
*   All other values must come from variables
*
*   You may only display 1 string
*/


//Display The Following In-Game
/*
    Unit[5]   -> "Footman"
    Unit[11]  -> "Rifleman"
    Unit[421] -> "Knight"
    Unit[56]  -> "Paladin"
*/

//Unit may be a value
//Is A may be a value
//[ ] may be a value
//-> may be a value
//" " may be a value

//Unit is in green
//[ ] are in purple
//all numbers are in white
//" " are in purple
//all unit names are in red

//! runtextmacro Function()
    globals
    unit array Unit
    string array name
    endglobals
    
    set Unit[5] = CreateUnit(Player(0), 'hfoo', 0, 0,90)
    set Unit[11] = CreateUnit(Player(0), 'hrif', 0, 0,90)
    set Unit[421] = CreateUnit(Player(0), 'hkni', 0, 0,90)
    set Unit[56] = CreateUnit(Player(0), 'Hpal', 0, 0,90)
    set name[5] = "|cFFFF0000" + GetUnitName(Unit[5]) + "|r"
    set name[11] = "|cFFFF0000" + GetUnitName(Unit[11]) + "|r"
    set name[421] = "|cFFFF0000" + GetUnitName(Unit[421]) + "|r"
    set name[56] = "|cFFFF0000" + GetUnitName(Unit[56]) + "|r"
    set name[0] = "|CFF008000Unit|r|cFF800080[|r5|CFF800080]|r -> |CFF800080\"|r" + name[5] + "|CFF800080\"|r"
    set name[1] = "|CFF008000Unit|r|cFF800080[|r11|CFF800080]|r -> |CFF800080\"|r" + name[11] + "|CFF800080\"|r"
    set name[2] = "|CFF008000Unit|r|cFF800080[|r421|CFF800080]|r -> |CFF800080\"|r" + name[421] + "|CFF800080\"|r"
    set name[3] = "|CFF008000Unit|r|cFF800080[|r56|CFF800080]|r -> |CFF800080\"|r" + name[56] + "|CFF800080\"|r"
    set name[4] = name[0] + "\n" + name[1] + "\n" + name[3] + "\n" + name[3] 
    call Print(name[4])
    
//! runtextmacro End_Code()

This is the ingame result

A2_zps82c48702.png
 
Status
Not open for further replies.
Top