Helper me :(

Thảo luận trong 'World Editor' bắt đầu bởi dh-g, 29/8/09.

  1. dh-g

    dh-g Fire in the hole!

    Tham gia ngày:
    29/8/09
    Bài viết:
    2,654
    Nơi ở:
    Q1 TP.HCM
    mà giờ up ban 1.24 thì Jass code của 1.23 sẽ ngưng hoạt động với 1.24
    GUI/Triger thì có thể hoạt động nhan Jass code của 1.23 em xài rắt nhiều mong máy anh chị giúp ẹm dịch thành Jass ==> GUI

    Mã:
    function Trig_SaveLoad_Save_All_Actions takes nothing returns nothing
        local integer i
        local integer r
        call DisplayTextToForce(GetForceOfPlayer(GetTriggerPlayer()), "|cffffcc00Saving character please wait.|r")
        set udg_SaveCount = 1
        set udg_Save[udg_SaveCount] = GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD)
        set udg_SaveCount = ( udg_SaveCount + 1 )
        set udg_Save[udg_SaveCount] = GetPlayerState(GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER)
        set udg_SaveCount = ( udg_SaveCount + 1 )
        set udg_TempUnit = udg_SaveLoadPlayerHeroSingle[GetConvertedPlayerId(GetTriggerPlayer())]
        set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )
        set udg_SaveCount = ( udg_SaveCount + 1 )
        set udg_Save[udg_SaveCount] = GetHeroXP(udg_TempUnit)
        set udg_SaveCount = ( udg_SaveCount + 1 )
        set udg_Save[udg_SaveCount] = UnitInventoryCount(udg_TempUnit)
        set i = 1
        set r = 6
        loop
            exitwhen i > r
            if IsItemOwned(UnitItemInSlotBJ(udg_TempUnit, i)) then
                set udg_SaveCount = ( udg_SaveCount + 1 )
                set udg_TempItem = UnitItemInSlotBJ(udg_TempUnit, i)
                set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
            else
            endif
            set i = i + 1
        endloop
        set udg_SaveCount = ( udg_SaveCount + 1 )
        set udg_Save[udg_SaveCount] = GetHeroStatBJ(bj_HEROSTAT_STR, udg_SaveLoadPlayerHeroSingle[GetConvertedPlayerId(GetTriggerPlayer())], false)
        set udg_SaveCount = ( udg_SaveCount + 1 )
        set udg_Save[udg_SaveCount] = GetHeroStatBJ(bj_HEROSTAT_AGI, udg_SaveLoadPlayerHeroSingle[GetConvertedPlayerId(GetTriggerPlayer())], false)
        set udg_SaveCount = ( udg_SaveCount + 1 )
        set udg_Save[udg_SaveCount] = GetHeroStatBJ(bj_HEROSTAT_INT, udg_SaveLoadPlayerHeroSingle[GetConvertedPlayerId(GetTriggerPlayer())], false)
        set udg_Code = SaveLoad_Encode()
        call QuestMessageBJ( GetForceOfPlayer(GetTriggerPlayer()), bj_QUESTMESSAGE_SECRET, "TRIGSTR_3977" )
        call DisplayTimedTextToForce( GetForceOfPlayer(GetTriggerPlayer()), 60.00, "|cffffcc00Code Enable: |r" + udg_Code )
    endfunction
    
    //===========================================================================
    function InitTrig_SaveLoad_Save_All takes nothing returns nothing
        set gg_trg_SaveLoad_Save_All = CreateTrigger(  )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_All, Player(0), "-save", true )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_All, Player(1), "-save", true )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_All, Player(2), "-save", true )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_All, Player(3), "-save", true )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_All, Player(4), "-save", true )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_All, Player(5), "-save", true )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_All, Player(6), "-save", true )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_All, Player(7), "-save", true )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_All, Player(8), "-save", true )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_All, Player(9), "-save", true )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_All, Player(10), "-save", true )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_All, Player(11), "-save", true )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Save_All, Player(12), "-save", true )
        call TriggerAddAction( gg_trg_SaveLoad_Save_All, function Trig_SaveLoad_Save_All_Actions )
    endfunction
    
    
    Mã:
    function Trig_SaveLoad_Load_All_Conditions takes nothing returns boolean
        if ( not ( StringLength(GetEventPlayerChatString()) > 6 ) ) then
            return false
        endif
        return true
    endfunction
    
    function Trig_SaveLoad_Load_All_Func005A takes nothing returns nothing
        call RemoveUnit( GetEnumUnit() )
    endfunction
    
    function Trig_SaveLoad_Load_All_Actions takes nothing returns nothing
        local integer i
        local integer r
        set udg_Code = SubStringBJ(GetEventPlayerChatString(), 7, StringLength(GetEventPlayerChatString()))
        set udg_Validate = SaveLoad_Decode( udg_Code )
        if udg_Validate == false then
            call DisplayTextToForce(GetForceOfPlayer(GetTriggerPlayer()), "TRIGSTR_3978")
            return
        else
        endif
        call DisplayTextToForce(GetPlayersAll(), (udg_Player_Colors[GetConvertedPlayerId(GetTriggerPlayer())] + (GetPlayerName(GetTriggerPlayer()) + " has loaded:")))
        call ForGroupBJ( GetUnitsOfPlayerAll(GetTriggerPlayer()), function Trig_SaveLoad_Load_All_Func005A )
        set udg_SaveCount = 1
        call SetPlayerStateBJ( GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD, udg_Save[udg_SaveCount] )
        set udg_SaveCount = ( udg_SaveCount + 1 )
        call SetPlayerStateBJ( GetTriggerPlayer(), PLAYER_STATE_RESOURCE_LUMBER, udg_Save[udg_SaveCount] )
        set udg_SaveCount = ( udg_SaveCount + 1 )
        set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
        call CreateNUnitsAtLoc( 1, udg_TempUnitType, GetTriggerPlayer(), GetRectCenter(gg_rct_Town_Tele), bj_UNIT_FACING )
        call UnitAddAbilityBJ( udg_SaveLoadSBooksStored[udg_Save[udg_SaveCount]], GetLastCreatedUnit() )
        set udg_SaveLoadPlayerHeroSingle[GetConvertedPlayerId(GetTriggerPlayer())] = GetLastCreatedUnit()
        call GroupAddUnitSimple( GetLastCreatedUnit(), udg_duelpeople )
        call ForceAddPlayerSimple( GetTriggerPlayer(), udg_Players )
        set udg_SaveCount = udg_SaveCount + 1
        call SetHeroXP( GetLastCreatedUnit(), udg_Save[udg_SaveCount], false )
        set udg_SaveCount = udg_SaveCount + 1
        set i = 1
        set r = udg_Save[udg_SaveCount]
        call DisplayTextToForce( GetPlayersAll(), ( udg_Player_Colors[GetConvertedPlayerId(GetTriggerPlayer())] + ( "Level " + ( I2S(GetUnitLevel(GetLastCreatedUnit())) + ( " " + GetUnitName(GetLastCreatedUnit()) ) ) ) ) )
        loop
            exitwhen i > r
                set udg_SaveCount = ( udg_SaveCount + 1 )
                set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
                call UnitAddItemByIdSwapped( udg_TempItemType, udg_SaveLoadPlayerHeroSingle[GetConvertedPlayerId(GetTriggerPlayer())] )
                set i = i + 1
            endloop
        set udg_SaveCount = ( udg_SaveCount + 1 )
        call ModifyHeroStat( bj_HEROSTAT_STR, udg_SaveLoadPlayerHeroSingle[GetConvertedPlayerId(GetTriggerPlayer())], bj_MODIFYMETHOD_SET, udg_Save[udg_SaveCount] )
        set udg_SaveCount = ( udg_SaveCount + 1 )
        call ModifyHeroStat( bj_HEROSTAT_AGI, udg_SaveLoadPlayerHeroSingle[GetConvertedPlayerId(GetTriggerPlayer())], bj_MODIFYMETHOD_SET, udg_Save[udg_SaveCount] )
        set udg_SaveCount = ( udg_SaveCount + 1 )
        call ModifyHeroStat( bj_HEROSTAT_INT, udg_SaveLoadPlayerHeroSingle[GetConvertedPlayerId(GetTriggerPlayer())], bj_MODIFYMETHOD_SET, udg_Save[udg_SaveCount] )
    endfunction
    
    //===========================================================================
    function InitTrig_SaveLoad_Load_All takes nothing returns nothing
        set gg_trg_SaveLoad_Load_All = CreateTrigger(  )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_All, Player(0), "-load ", false )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_All, Player(1), "-load ", false )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_All, Player(2), "-load ", false )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_All, Player(3), "-load ", false )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_All, Player(4), "-load", false )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_All, Player(5), "-load", false )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_All, Player(6), "-load", false )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_All, Player(7), "-load", false )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_All, Player(8), "-load", false )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_All, Player(9), "-load", false )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_All, Player(10), "-load ", false )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_All, Player(11), "-load ", false )
        call TriggerRegisterPlayerChatEvent( gg_trg_SaveLoad_Load_All, Player(12), "-load ", false )
        call TriggerAddCondition( gg_trg_SaveLoad_Load_All, Condition( function Trig_SaveLoad_Load_All_Conditions ) )
        call TriggerAddAction( gg_trg_SaveLoad_Load_All, function Trig_SaveLoad_Load_All_Actions )
    endfunction
    
    
    2 cái này là jass code save game nhân em không biết cách phiên dịch thành GUI ai help me em :((
     
  2. Tom_Kazansky

    Tom_Kazansky

    Tham gia ngày:
    28/12/06
    Bài viết:
    3,454
    Nơi ở:
    Hà Nội
    lần sau JASS, Trigger gì thì cho vào code tag nhé, [code]<trigger, jass paste vào đây>[/code], hoặc dùng biểu tượng: [​IMG]

    2 trigger trên mới chỉ là convert từ GUI ra JASS thôi, giờ lại convert lại GUI để làm gì ?

    sửa thì:
    Mã:
    function Trig_SaveLoad_Load_All_Conditions takes nothing returns boolean
        if ( not ( StringLength(GetEventPlayerChatString()) > 6 ) ) then
            return false
        endif
        return true
    endfunction
    ===>

    Mã:
    function Trig_SaveLoad_Load_All_Conditions takes nothing returns boolean
        return StringLength(GetEventPlayerChatString()) > 6 
    endfunction
    p.s: vấn đề "ko tương thích" với patch 1.24 không chỉ ở trong 1, 2 trigger đâu 3:-O
     

Chia sẻ trang này