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

What is....

Status
Not open for further replies.
Level 11
Joined
Jun 21, 2007
Messages
505
JASS is special code for world editor triggers. You can see an example for JASS code by selecting a trigger and going the following way - "Edit/Convert to custom text".
AI is how computer players (CP... U - CPU) react and act - their programme. You may edit AIs using AI editor module in Frozen Throne's World Editor.
I'm not sure if triggers may be converted to custom text in RoC (Reign of Chaos) WE (World Editor).
 
Level 5
Joined
Jun 18, 2008
Messages
146
JASS:

  • function Trig_Multiboard_Func014Func001C takes nothing returns boolean
    • if ( not ( GetPlayerSlotState(ConvertedPlayer(GetForLoopIndexA())) == PLAYER_SLOT_STATE_PLAYING ) ) then
      • return false
    • endif
    • return true
  • endfunction
  • function Trig_Multiboard_Func014Func002C takes nothing returns boolean
    • if ( not ( GetPlayerSlotState(ConvertedPlayer(GetForLoopIndexA())) == PLAYER_SLOT_STATE_PLAYING ) ) then
      • return false
    • endif
    • return true
  • endfunction
  • function Trig_Multiboard_Func014Func003C takes nothing returns boolean
    • if ( not ( GetPlayerSlotState(ConvertedPlayer(GetForLoopIndexA())) == PLAYER_SLOT_STATE_PLAYING ) ) then
      • return false
    • endif
    • return true
  • endfunction
  • function Trig_Multiboard_Actions takes nothing returns nothing
    • call CreateMultiboardBJ( 3, 13, "TRIGSTR_022" )
    • set udg_MB_Multiboard = GetLastCreatedMultiboard()
    • call MultiboardSetItemStyleBJ( udg_MB_Multiboard, 0, 0, true, false )
    • call MultiboardSetItemValueBJ( udg_MB_Multiboard, 1, 1, "TRIGSTR_023" )
    • call MultiboardSetItemValueBJ( udg_MB_Multiboard, 2, 1, "TRIGSTR_024" )
    • call MultiboardSetItemValueBJ( udg_MB_Multiboard, 3, 1, "TRIGSTR_025" )
    • call MultiboardSetItemValueBJ( udg_MB_Multiboard, 1, 13, "TRIGSTR_026" )
    • call MultiboardSetItemValueBJ( udg_MB_Multiboard, 1, 12, "TRIGSTR_048" )
    • call MultiboardSetItemWidthBJ( udg_MB_Multiboard, 1, 0, 9.00 )
    • call MultiboardSetItemWidthBJ( udg_MB_Multiboard, 2, 0, 9.00 )
    • call MultiboardSetItemWidthBJ( udg_MB_Multiboard, 3, 0, 9.00 )
    • call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 2, 13, ( "|cffffcc00" + ( "-" + "|r" ) ) )
    • call MultiboardSetItemValueBJ( GetLastCreatedMultiboard(), 2, 12, ( "|cffffcc00" + ( I2S(udg_I_Level) + "|r" ) ) )
    • set bj_forLoopAIndex = 1
    • set bj_forLoopAIndexEnd = 9
    • loop
      • exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
      • if ( Trig_Multiboard_Func014Func001C() ) then
        • call MultiboardSetItemValueBJ( udg_MB_Multiboard, 1, ( GetConvertedPlayerId(ConvertedPlayer(GetForLoopIndexA())) + 2 ), ( udg_Colours[GetForLoopIndexA()] + GetPlayerName(ConvertedPlayer(GetForLoopIndexA())) ) )
      • else
        • call MultiboardSetItemValueBJ( udg_MB_Multiboard, 1, ( GetConvertedPlayerId(ConvertedPlayer(GetForLoopIndexA())) + 2 ), ( "|cffffcc00" + "-" ) )
      • endif
      • if ( Trig_Multiboard_Func014Func002C() ) then
        • call MultiboardSetItemValueBJ( udg_MB_Multiboard, 2, ( GetConvertedPlayerId(ConvertedPlayer(GetForLoopIndexA())) + 2 ), ( "|c0080FF80" + I2S(udg_I_Leaks[GetForLoopIndexA()]) ) )
      • else
        • call MultiboardSetItemValueBJ( udg_MB_Multiboard, 2, ( GetConvertedPlayerId(ConvertedPlayer(GetForLoopIndexA())) + 2 ), ( "|c0080FF80" + "-" ) )
      • endif
      • if ( Trig_Multiboard_Func014Func003C() ) then
        • call MultiboardSetItemValueBJ( udg_MB_Multiboard, 3, ( GetConvertedPlayerId(ConvertedPlayer(GetForLoopIndexA())) + 2 ), ( "|c0080FF80" + I2S(udg_I_Kills[GetForLoopIndexA()]) ) )
      • else
        • call MultiboardSetItemValueBJ( udg_MB_Multiboard, 3, ( GetConvertedPlayerId(ConvertedPlayer(GetForLoopIndexA())) + 2 ), ( "|c0080FF80" + "-" ) )
      • endif
      • set bj_forLoopAIndex = bj_forLoopAIndex + 1
    • endloop
    • call MultiboardMinimizeBJ( true, udg_MB_Multiboard )
    • call MultiboardMinimizeBJ( false, udg_MB_Multiboard )
    • call MultiboardMinimizeBJ( true, udg_MB_Multiboard )
  • endfunction
  • //===========================================================================
  • function InitTrig_Multiboard takes nothing returns nothing
    • set gg_trg_Multiboard = CreateTrigger( )
    • call TriggerRegisterTimerEventSingle( gg_trg_Multiboard, 0.00 )
    • call TriggerAddAction( gg_trg_Multiboard, function Trig_Multiboard_Actions )
  • endfunction
AI:

  • Multiboard
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Multiboard - Create a multiboard with 3 columns and 13 rows, titled |c80808080Icy TD v1...
      • Set MB_Multiboard = (Last created multiboard)
      • Multiboard - Set the display style for MB_Multiboard item in column 0, row 0 to Show text and Hide icons
      • Multiboard - Set the text for MB_Multiboard item in column 1, row 1 to |cffffcc00Player:|r
      • Multiboard - Set the text for MB_Multiboard item in column 2, row 1 to |c0080FF80Leaks:|r
      • Multiboard - Set the text for MB_Multiboard item in column 3, row 1 to |c0080FF80Kills:|r
      • Multiboard - Set the text for MB_Multiboard item in column 1, row 13 to |c00FF0000Lives:|r
      • Multiboard - Set the text for MB_Multiboard item in column 1, row 12 to |c00FF0000Level:|r
      • Multiboard - Set the width for MB_Multiboard item in column 1, row 0 to 9.00% of the total screen width
      • Multiboard - Set the width for MB_Multiboard item in column 2, row 0 to 9.00% of the total screen width
      • Multiboard - Set the width for MB_Multiboard item in column 3, row 0 to 9.00% of the total screen width
      • Multiboard - Set the text for (Last created multiboard) item in column 2, row 13 to (|cffffcc00 + (- + |r))
      • Multiboard - Set the text for (Last created multiboard) item in column 2, row 12 to (|cffffcc00 + ((String(I_Level)) + |r))
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Multiboard - Set the text for MB_Multiboard item in column 1, row ((Player number of (Player((Integer A)))) + 2) to (Colours[(Integer A)] + (Name of (Player((Integer A)))))
            • Else - Actions
              • Multiboard - Set the text for MB_Multiboard item in column 1, row ((Player number of (Player((Integer A)))) + 2) to (|cffffcc00 + -)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Multiboard - Set the text for MB_Multiboard item in column 2, row ((Player number of (Player((Integer A)))) + 2) to (|c0080FF80 + (String(I_Leaks[(Integer A)])))
            • Else - Actions
              • Multiboard - Set the text for MB_Multiboard item in column 2, row ((Player number of (Player((Integer A)))) + 2) to (|c0080FF80 + -)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Multiboard - Set the text for MB_Multiboard item in column 3, row ((Player number of (Player((Integer A)))) + 2) to (|c0080FF80 + (String(I_Kills[(Integer A)])))
            • Else - Actions
              • Multiboard - Set the text for MB_Multiboard item in column 3, row ((Player number of (Player((Integer A)))) + 2) to (|c0080FF80 + -)
      • Multiboard - Minimize MB_Multiboard
      • Multiboard - Maximize MB_Multiboard
      • Multiboard - Minimize MB_Multiboard
JASS is more complicated and AI is easy, jass works better.

siDeKicK
 
Level 8
Joined
Dec 29, 2006
Messages
359
I think your confused my friend, i think your thinking of JASS and GUI, jass is a programming language used for WC3, it looks like this

JASS:
globals
    integer array StunArray
    integer StunTotal=0
endglobals

struct stundata
    unit u=null
    real d=0
    boolean destroyplease=false
endstruct

function StunUnit_KeepStunned takes nothing returns nothing
    local integer i = 0
    local stundata dat
    loop
        exitwhen i==Stun_Total
        set dat=StunArray[i]
        if dat.destroyplease then
            set Stun_Total=Stun_Total-1
            set StunArray[i]=StunArray[Stun_Total]
            call dat.destroy()
            set i=i-1
else
            set dat.d=dat.d-0.01
            call SetUnitPosition(dat.u,GetUnitX(dat.u),GetUnitY(dat.u))
            set dat.destroyplease=(dat.d<=0)
        endif
        set i=i+1
    endloop
    if Stun_Total==0 then
        call ReleaseTimer(GetExpiredTimer())
    endif
endfunction

function StunUnit takes unit u,real d returns nothing
    local stundata dat=stundata.create()
    set dat.d=d
    set dat.u=u
    if (Stun_Total==0) then
        call TimerStart(NewTimer(),.01,true,function StunUnit_KeepStunned)
    endif
    set Stun_Total=Stun_Total+1
    set StunArray[Stun_Total-1]=dat
endfunction

Credits to Fulla for that set of code, cnp from the Small Code Snippets thread :D

GUI is just a window that allows you to select events conditions and actions (which when the game is running, will be converted and read by the game as JASS anyways)

AI (Artificial Intelligence) is a separate interface that allows you to control how computer players will act during a game.
 
Status
Not open for further replies.
Top