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

Preloading one trigger and game message issue

Status
Not open for further replies.
Level 11
Joined
May 7, 2008
Messages
300
I want to preload this trigger (Champion of Agility, Strength and Intelligence are spellbooks with passive abilities which are added when hero reaches level 21).

  • Champion Mark
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Level of (Leveling Hero)) Equal to 21
    • Actions
      • Set TempUnitType = (Unit-type of (Leveling Hero))
      • Game - Display to (All players) for 12.00 seconds the text: (PlayerColourNames[(Player number of (Owner of (Leveling Hero)))] + has just reached level 21!)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • TempUnitType Equal to |c00ff0000Holy Warrior|r
              • TempUnitType Equal to |c00ff0000Mountain King|r
              • TempUnitType Equal to Corher
              • TempUnitType Equal to |c00ff0000Cursed Knight|r
              • TempUnitType Equal to |c0000ff00Vampire|r
              • TempUnitType Equal to |c00ff0000Beastmaster|r
              • TempUnitType Equal to |c00ff0000Pit Lord|r
              • TempUnitType Equal to |c00ff0000Cow King|r
              • TempUnitType Equal to |c00ff0000Berserker|r
        • Then - Actions
          • Unit - Add Champion of Strength to (Leveling Hero)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • TempUnitType Equal to |c000080ffWizard|r
                  • TempUnitType Equal to |c000080ffArcane Apprentice|r
                  • TempUnitType Equal to |c000080ffNecromancer|r
                  • TempUnitType Equal to |c000080ffWitch|r
                  • TempUnitType Equal to |c000080ffLightning Spirit|r
            • Then - Actions
              • Unit - Add Champion of Intelligence to (Leveling Hero)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • TempUnitType Equal to |c0000ff00Night Elf Blademaster|r
                      • TempUnitType Equal to |c0000ff00Moon Ranger|r
                      • TempUnitType Equal to |c0000ff00Light Ranger|r
                      • TempUnitType Equal to |c0000ff00Dark Rogue|r
                      • TempUnitType Equal to |c0000ff00Deadeye|r
                      • TempUnitType Equal to |c0000ff00Tremble Lord|r
                • Then - Actions
                  • Unit - Add Champion of Agility to (Leveling Hero)
                • Else - Actions
So far I made this 'preload' trigger for 'Champion of Strength' spellbook:

  • Preload Champion
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Set TargetPoint = (Center of (Playable map area))
      • Unit - Create 1 Dummy for Player 3 (Teal) at TargetPoint facing Default building facing degrees
      • Unit - Add Champion of Strength to (Last created unit)
      • Unit - Remove Champion of Strength from (Last created unit)
      • Unit - Remove (Last created unit) from the game
      • Custom script: call RemoveLocation (udg_TargetPoint)
Also, there is one issue on this kind of trigger. The trigger is supposed to be like this:

''Name of the player who typed -unstuck - has just typed unstuck command. It's unit bla bla'' and so on.

Current trigger:

JASS:
scope Unstuck initializer Init

        globals
            private constant real DUR = 8.00
            private force Unstuck = CreateForce()
        endglobals

    private function Conditions takes nothing returns boolean
        return IsPlayerInForce( GetTriggerPlayer(), Unstuck ) == false
    endfunction
    
    private function Filt takes nothing returns boolean
        return IsUnitType( GetFilterUnit(), UNIT_TYPE_HERO ) and GetOwningPlayer( GetFilterUnit() ) == GetTriggerPlayer()
    endfunction

    private function Actions takes nothing returns nothing

        local player p = GetTriggerPlayer()
        local integer i = GetConvertedPlayerId( p )
        local group g = CreateGroup()
        local unit u
        
        call GroupEnumUnitsInRect( g, bj_mapInitialPlayableArea, Condition( function Filt ) )
        set u = FirstOfGroup( g )
        
        call ForceAddPlayer( Unstuck, p )
        call PauseUnit( u, true )

        call SetUnitInvulnerable( u, false )
call DisplayTimedTextToForce( GetPlayersAll(), 8.00, ( udg_PlayerColours[GetConvertedPlayerId(GetTriggerPlayer())] + " has just used unstuck command. It's hero will be moved to center of the map within 8 seconds." ) )
        call TriggerSleepAction( 8.00 )

        call SetUnitPosition( u, 0.00, 0.00 )
    
        call PauseUnit( u, false )
        call SetUnitInvulnerable( u, false )
        call TriggerSleepAction( 90.00 )
        call ForceRemovePlayer( Unstuck, p )
        
        call DestroyGroup( g )
        set g = null
        set u = null
        set p = null
    endfunction

    //===========================================================================
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        loop
            call TriggerRegisterPlayerChatEvent( t, Player(i), "-unstuck", true )
            set i = i + 1
            exitwhen i == bj_MAX_PLAYER_SLOTS
        endloop
        call TriggerAddCondition( t, Condition( function Conditions ) )
        call TriggerAddAction( t, function Actions )
        set t = null
    endfunction

endscope

Issue is that you get something like this ''No name - no name appeared - has just bla bla plus you gain colored text''.
 
Status
Not open for further replies.
Top