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

System

Status
Not open for further replies.
Level 9
Joined
Mar 31, 2011
Messages
496
Hero Next/Previous Selection System


Note: I saw next/previous hero selection system on tutorials, but I can't seem to understand it so I'm now asking to someone to give me some map samples of that, or better explanation, Thanks!
 
Level 9
Joined
Mar 31, 2011
Messages
496
oooohhhh... not that

Next/Previous hero selection, I mean, like in GranPix? I forgot the name.. It's made by blizzard

btw, thanks for helping
 
Level 9
Joined
Mar 31, 2011
Messages
496
Ouch I hate jass, Is it possible to convert this to Mui, or what ever the simple triggers called.
Cuz I got the GrandPix over the internet.

JASS:
function ResetCameraForPick takes integer nPlayerIndex returns nothing
    call SetCameraTargetControllerNoZForPlayer( Player(nPlayerIndex), udg_PickCartCameraUnits[nPlayerIndex], 0, 0, true )
    call SetCameraFieldForPlayer( Player(nPlayerIndex), CAMERA_FIELD_TARGET_DISTANCE, 800, 0 )
    call SetCameraFieldForPlayer( Player(nPlayerIndex), CAMERA_FIELD_FIELD_OF_VIEW, 70, 0 )
    call SetCameraFieldForPlayer( Player(nPlayerIndex), CAMERA_FIELD_ROTATION, 270, 0 )
    call SetCameraFieldForPlayer( Player(nPlayerIndex), CAMERA_FIELD_ZOFFSET, 0, 0 )
    call SetCameraFieldForPlayer( Player(nPlayerIndex), CAMERA_FIELD_ANGLE_OF_ATTACK, 350.00, 0 )
    call SetCameraFieldForPlayer( Player(nPlayerIndex), CAMERA_FIELD_FARZ, 1000.00, 0 )
endfunction

function GetGameTip takes nothing returns string
    local string str = "|cff00ff00[IN GAME TIPS]|r|n"
    set str = str + "|n|cffffcc00Arrow keys|r - Drive your cart"
    set str = str + "|n|cffffcc00'A' 'S' 'D' 'F'|r - Use items"
    set str = str + "|n|cffffcc00'W'|r - Fire machine gun"
    set str = str + "|n|cffffcc00'Q'|r - Honk"

    return str
endfunction

function GetCartDescription takes unit uCart returns string
    local integer nModelId = GetPickModelIndex( GetUnitTypeId( uCart ) )
    //local string str = StringCase( GetUnitName( uCart ), true )
    //set str = str + "|n|nMax Speed :  " + R2SW( GetModelMaxSpeed( nModelId ), 1, 1 )
    //set str = str +   "|nAcceleration :  " + R2SW( GetModelAcceRate( nModelId ), 1, 1 )
    //set str = str +   "|nTurn Speed :  " + R2SW( GetModelTurnRate( nModelId ), 1, 1 )
    return udg_ModelDescription[nModelId]
endfunction

function CreateGameTipTag takes integer nPlayerIndex returns nothing
    set udg_GameTipTextTag[nPlayerIndex] = CreateTextTag()
    call SetTextTagText( udg_GameTipTextTag[nPlayerIndex], GetGameTip(), 0.023 )
    call SetTextTagColor( udg_GameTipTextTag[nPlayerIndex], 255, 255, 255, 255 )
    call SetTextTagVelocity( udg_GameTipTextTag[nPlayerIndex], 0, 0 )
    call ShowTextTagForceBJ( true, udg_GameTipTextTag[nPlayerIndex], GetForceOfPlayer(Player(nPlayerIndex)) )
    call SetTextTagPos( udg_GameTipTextTag[nPlayerIndex], GetLocationX(udg_PickCartPos[nPlayerIndex]) + 300, GetLocationY(udg_PickCartPos[nPlayerIndex]) + 200, 70)
endfunction

function DestroyGameTipTag takes integer nPlayerIndex returns nothing
    if ( udg_PickCartTextTag[nPlayerIndex] == null ) then
        return
    endif
    call DestroyTextTag( udg_GameTipTextTag[nPlayerIndex] )
    set udg_GameTipTextTag[nPlayerIndex] = null
endfunction

function ResetPickCartTextTag takes integer nPlayerIndex returns nothing
    if ( udg_PickCarts[nPlayerIndex] != null ) then
        if ( udg_PickCartTextTag[nPlayerIndex] != null ) then
            call DestroyTextTag( udg_PickCartTextTag[nPlayerIndex] )
        endif
        set udg_PickCartTextTag[nPlayerIndex] = CreateTextTag()
        call SetTextTagText( udg_PickCartTextTag[nPlayerIndex], GetCartDescription(udg_PickCarts[nPlayerIndex]), 0.023 )
        call SetTextTagColor( udg_PickCartTextTag[nPlayerIndex], 200, 255, 0, 255 )
        call SetTextTagVelocity( udg_PickCartTextTag[nPlayerIndex], 0, 0.020 )
        call ShowTextTagForceBJ( true, udg_PickCartTextTag[nPlayerIndex], GetForceOfPlayer(Player(nPlayerIndex)) )
        call SetTextTagPos( udg_PickCartTextTag[nPlayerIndex], GetLocationX(udg_PickCartPos[nPlayerIndex]) - 150, GetLocationY(udg_PickCartPos[nPlayerIndex]) + 200, -90)
    else
        if ( udg_PickCartTextTag[nPlayerIndex] != null ) then
            call DestroyTextTag( udg_PickCartTextTag[nPlayerIndex] )
            set udg_PickCartTextTag[nPlayerIndex] = null
        endif
    endif
endfunction

function PreparePickingCartPlayer takes integer nPlayerIndex returns nothing
    local unit uCamera = null
    local unit uCart = null
    local location loc = null
    local rect rc = null

    set udg_GameGoingStatus[nPlayerIndex] = udg_GAME_PICKING

    set udg_PickCartCameraUnits[nPlayerIndex] = CreateUnitAtLoc( Player(nPlayerIndex), 'n00K', udg_PickCartPos[nPlayerIndex], 0 )
    set loc = PolarProjectionBJ( udg_PickCartPos[nPlayerIndex], 80, 0 )
    set udg_PickCarts[nPlayerIndex] = CreateUnitAtLoc( Player(nPlayerIndex), GetModelPickUnitType(0), loc, 90 )
    call RemoveLocation( loc )

    call ClearSelectionForPlayer( Player(nPlayerIndex) )
    call SelectUnitForPlayerSingle( udg_PickCarts[nPlayerIndex], Player(nPlayerIndex) )

    set rc = Rect( GetLocationX(udg_PickCartPos[nPlayerIndex]) - 250, GetLocationY(udg_PickCartPos[nPlayerIndex]) - 250, GetLocationX(udg_PickCartPos[nPlayerIndex]) + 250, GetLocationY(udg_PickCartPos[nPlayerIndex]) + 250 )
    set udg_PickCartVisibility[nPlayerIndex] = CreateFogModifierRectBJ( true, Player(nPlayerIndex), FOG_OF_WAR_VISIBLE, rc )
    call RemoveRect( rc )

    call TimerStart( udg_PickCartPlayerTimer[nPlayerIndex], 0.05, true, null )

    call CreateGameTipTag( nPlayerIndex )
    call ResetPickCartTextTag( nPlayerIndex )

    call ResetCameraForPick( nPlayerIndex )
endfunction

function RotatePickCart takes integer nPlayerIndex returns nothing
    local location loc = null
    local real rAngle = 0

    if ( udg_PickCarts[nPlayerIndex] == null ) then
        return
    endif

    set loc = GetUnitLoc( udg_PickCarts[nPlayerIndex] )
    set rAngle = GetUnitFacing( udg_PickCarts[nPlayerIndex] ) + 5
    call SetUnitFacing( udg_PickCarts[nPlayerIndex], rAngle )
    call SetUnitPositionLoc( udg_PickCarts[nPlayerIndex], loc )
    call RemoveLocation( loc )
endfunction

function StartPickingCart takes nothing returns nothing
    local boolean bContinue = false
    local integer nPlayerIndex = 0
    loop
        exitwhen nPlayerIndex >= 8

        if ( GetPlayerController(Player(nPlayerIndex)) == MAP_CONTROL_USER and GetPlayerSlotState(Player(nPlayerIndex)) == PLAYER_SLOT_STATE_PLAYING ) then
            call PreparePickingCartPlayer(nPlayerIndex)
        else
            call DestroyTimer( udg_PickCartPlayerTimer[nPlayerIndex] )
            call DestroyTextTag( udg_PickCartTextTag[nPlayerIndex] )
            set udg_PickCartTextTag[nPlayerIndex] = null
        endif

        set nPlayerIndex = nPlayerIndex + 1
    endloop
endfunction

function ResetCameraTarget takes integer nPlayerIndex, unit uTarget returns nothing
    if ( uTarget != null and uTarget != udg_PlayerCameraTarget[nPlayerIndex] ) then
        set udg_PlayerCameraTarget[nPlayerIndex] = uTarget
        if ( IsUnitAliveBJ( udg_PlayerCameraTarget[nPlayerIndex] ) ) then
            call SetCameraTargetControllerNoZForPlayer( Player(nPlayerIndex), udg_PlayerCameraTarget[nPlayerIndex], 0, 0, true )
        endif
    endif

    if (GetLocalPlayer() == Player(nPlayerIndex) ) then
        if ( GetCameraField(CAMERA_FIELD_TARGET_DISTANCE) != 500 + udg_PlayerCameraIndex[nPlayerIndex] * 225 ) then
            call SetCameraField( CAMERA_FIELD_TARGET_DISTANCE, 500 + udg_PlayerCameraIndex[nPlayerIndex] * 225, 0 )
        endif
        if ( GetCameraField(CAMERA_FIELD_FIELD_OF_VIEW) != 70 ) then
            call SetCameraField( CAMERA_FIELD_FIELD_OF_VIEW, 70, 0 )
        endif
        if ( GetCameraField(CAMERA_FIELD_ROTATION) != udg_Angle[nPlayerIndex] ) then
            call SetCameraField( CAMERA_FIELD_ROTATION, udg_Angle[nPlayerIndex], 0 )
        endif
        if ( GetCameraField(CAMERA_FIELD_ZOFFSET) != 200 ) then
            call SetCameraField( CAMERA_FIELD_ZOFFSET, 200.00, 0 )
        endif
        if ( GetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK) != 340 ) then
            call SetCameraField( CAMERA_FIELD_ANGLE_OF_ATTACK, 340.00, 0 )
        endif
        if ( GetCameraField(CAMERA_FIELD_FARZ) != 5500 ) then
            call SetCameraField( CAMERA_FIELD_FARZ, 5500.00, 0 )
        endif
    endif
endfunction

function ResetCamera takes integer nPlayerIndex returns nothing
    if ( udg_NormalCamera[nPlayerIndex] ) then
        return
    endif

    if ( GetPlayerController(Player(nPlayerIndex)) != MAP_CONTROL_USER or GetPlayerSlotState(Player(nPlayerIndex)) != PLAYER_SLOT_STATE_PLAYING ) then
        return
    endif

    call ResetCameraTarget( nPlayerIndex, null )
endfunction

function PickCartNavigate takes unit uCartPick, boolean bForward returns nothing
    local location loc = null
    local real rAngle = 0
    local integer nModelIndex = GetPickModelIndex( GetUnitTypeId( uCartPick ) )
    local integer nPlayerIndex = GetPlayerIndex( GetOwningPlayer(uCartPick) )
    if ( nModelIndex < 0 or nPlayerIndex < 0 ) then
        return
    endif
    if ( uCartPick != udg_PickCarts[nPlayerIndex] ) then
        return
    endif

    if ( bForward ) then
        set nModelIndex = nModelIndex + 1
        if ( nModelIndex >= udg_MODEL_NUM ) then
            set nModelIndex = 0
        endif
    else
        set nModelIndex = nModelIndex - 1
        if ( nModelIndex < 0 ) then
            set nModelIndex = udg_MODEL_NUM - 1
        endif
    endif

    set loc = GetUnitLoc( udg_PickCarts[nPlayerIndex] )
    set rAngle = GetUnitFacing( udg_PickCarts[nPlayerIndex] )
    call RemoveUnit( udg_PickCarts[nPlayerIndex] )
    set udg_PickCarts[nPlayerIndex] = CreateUnitAtLoc( Player(nPlayerIndex), GetModelPickUnitType( nModelIndex ), loc, rAngle )
    call RemoveLocation( loc )
    call ClearSelectionForPlayer( Player(nPlayerIndex) )
    call SelectUnitForPlayerSingle( udg_PickCarts[nPlayerIndex], Player(nPlayerIndex) )
    call ResetPickCartTextTag( nPlayerIndex )
endfunction

function PickCartSimple takes player plPlayer, integer nModelIndex returns nothing
    local integer nPlayerIndex = -1
    local rect rc = null

    set nPlayerIndex = GetPlayerIndex( plPlayer )
    if ( nPlayerIndex < 0 ) then
        return
    endif

    if ( udg_GameGoingStatus[nPlayerIndex] != udg_GAME_PICKING ) then
        return
    endif

    call DestroyTimer( udg_PickCartPlayerTimer[nPlayerIndex] )
    call RemoveUnit( udg_PickCarts[nPlayerIndex] )
    set udg_PickCarts[nPlayerIndex] = null
    call RemoveUnit( udg_PickCartCameraUnits[nPlayerIndex] )
    set udg_PickCartCameraUnits[nPlayerIndex] = null
    call DestroyGameTipTag( nPlayerIndex )
    call ResetPickCartTextTag( nPlayerIndex )

    set udg_PlayerModels[nPlayerIndex] = nModelIndex
    set udg_Carts[nPlayerIndex] = CreateUnitAtLoc( Player(nPlayerIndex), GetModelUnitType( udg_PlayerModels[nPlayerIndex] ), udg_StartPoints[udg_HowManyPicked], udg_START_ANGLE )
    set udg_CartPrePos[nPlayerIndex] = udg_StartPoints[udg_HowManyPicked]
    call ClearSelectionForPlayer( Player(nPlayerIndex) )
    call SelectUnitForPlayerSingle( udg_Carts[nPlayerIndex], Player(nPlayerIndex) )

    set udg_Angle[nPlayerIndex] = udg_START_ANGLE
    call ResetCameraTarget( nPlayerIndex, udg_Carts[nPlayerIndex] )
    call ChangeCartSound( nPlayerIndex, udg_SNDINDEX_COAST )

    set udg_HowManyPicked = udg_HowManyPicked + 1

    call DestroyFogModifier( udg_PickCartVisibility[nPlayerIndex] )
    set rc = Rect( GetLocationX(udg_PickCartPos[nPlayerIndex]) - 200, GetLocationY(udg_PickCartPos[nPlayerIndex]) - 200, GetLocationX(udg_PickCartPos[nPlayerIndex]) + 200, GetLocationY(udg_PickCartPos[nPlayerIndex]) + 200 )
    set udg_PickCartVisibility[nPlayerIndex] = CreateFogModifierRectBJ( true, Player(nPlayerIndex), FOG_OF_WAR_MASKED, rc )
    call RemoveRect( rc )

    call CreateFogModifierRectBJ( true, Player(nPlayerIndex), FOG_OF_WAR_VISIBLE, gg_rct_VisibleRgn )
endfunction

function PickingEnded takes nothing returns nothing
    local integer nPlayerIndex = 0

    if ( udg_PickCartTimer == null ) then
        return
    endif

    call DestroyTrigger( gg_trg_Picking_Cart_Timer )

    call DestroyTimerDialogBJ( udg_PickCartTimerWnd )
    call DestroyTimer( udg_PickCartTimer )
    set udg_PickCartTimer = null

    set nPlayerIndex = 0
    loop
        exitwhen nPlayerIndex >= 8
        if ( udg_PickCarts[nPlayerIndex] != null ) then
            call PickCartSimple( Player(nPlayerIndex), GetPickModelIndex( GetUnitTypeId( udg_PickCarts[nPlayerIndex] ) ) )
        endif
        set nPlayerIndex = nPlayerIndex + 1
    endloop
    // --------------------------------------------------
    call DestroyTrigger( gg_trg_Pick_Cart_Functions )
    call DestroyTrigger( gg_trg_Start_Picking_Cart )
    call DestroyTrigger( gg_trg_Picking_Cart_Player_Timer )
    call DestroyTrigger( gg_trg_Select_Other_Unit_Than_Picking_Cart )
    call DestroyTrigger( gg_trg_Deselect_Picking_Cart )
    call DestroyTrigger( gg_trg_View_Previous_Cart )
    call DestroyTrigger( gg_trg_View_Next_Cart )
    call DestroyTrigger( gg_trg_Pick_Cart )
    // --------------------------------------------------
    call TimerStart( udg_GameStartTimer, 1.00, true, null )
    // --------------------------------------------------
    call TimerStart( udg_DrivingTimer, 0.05, true, null )
    // --------------------------------------------------
    set nPlayerIndex = 0
    loop
        exitwhen nPlayerIndex >= 8
        if ( udg_Carts[nPlayerIndex] != null ) then
            call SetPlayerAbilityAvailable( Player(nPlayerIndex), 'A01V', true )
            call IssueImmediateOrder( udg_Carts[nPlayerIndex], "cannibalize" )
        endif
        set nPlayerIndex = nPlayerIndex + 1
    endloop
    call TimerStart( udg_BigGunLoadTimer, 15, false, null )
    // --------------------------------------------------
    call ClearMapMusic()
    call StopMusic( true )
    call SetMapMusic( gg_snd_Credits + ";" + gg_snd_PH1, false, 0 )
    //call SetMapMusic( gg_snd_carracingxmas, false, 0 )
    call PlayMusic( gg_snd_PH1 )

    set nPlayerIndex = 0
    loop
        exitwhen nPlayerIndex >= 8
        set udg_GameGoingStatus[nPlayerIndex] = udg_GAME_PREPARING
        set nPlayerIndex = nPlayerIndex + 1
    endloop

    //call ShowTipMsg( "Arrow keys - Drive your cart" )
    //call PolledWait( 10 )
    //call ShowTipMsg( "'A' 'S' 'D' 'F' - Use items" )
    //call PolledWait( 10 )
    //call ShowTipMsg( "'W' - Fire machine gun" )
    //call PolledWait( 10 )
    //call ShowTipMsg( "'Q' - Honk" )
endfunction

function PickCart takes player plPlayer, integer nModelIndex returns nothing
    local integer nPlayerIndex = 0

    call PickCartSimple( plPlayer, nModelIndex )
    set nPlayerIndex = 0
    loop
        exitwhen nPlayerIndex >= 8

        if ( udg_PickCarts[nPlayerIndex] != null ) then
            return
        endif
        
        set nPlayerIndex = nPlayerIndex + 1
    endloop

    //All picked? Time for fun
    call PickingEnded()

    return
endfunction

//===========================================================================
function InitTrig_Pick_Cart_Functions takes nothing returns nothing
endfunction



EDIT: I FOUND A TEMPLATE "but" it is Gui :cry:
 
Last edited:
Level 9
Joined
Mar 31, 2011
Messages
496
Uhmmm hey... there's nothing to worry about that, I found this, but when i import this, it doesn't work, will you help me how to import this? i'll attach the map, Thanks to AceHart of helper.net for making this thing :thumbs_up:.
 
Last edited:
Status
Not open for further replies.
Top