• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Can anyone convert this vJass library into normal jass, please?

Status
Not open for further replies.
Level 11
Joined
Oct 9, 2015
Messages
721
Code:
//TESH.scrollpos=0
//TESH.alwaysfold=0
library UnitPause /* v1.0    By IcemanBo (credits to Maker)

    Alternative for the PauseUnit() function without known site effects.
    A paused unit will be completly unuseable until unpaused.
    Unit's current order will be forgetten.
   
            API
          ¯¯¯¯¯¯
    function UnitPause(unit, boolean) returns nothing
   
    function UnitPaused(unit) returns boolean
   
       
    Instructions:
   ¯¯¯¯¯¯¯¯¯¯¯¯¯¯

    After copying the library save the map and restart the editor.
    When done, then comment out the next line:*/
   
    //! external ObjectMerger w3a ANcl paus Ncl6 1 "defend" anam "Channel Pause" acat "" atat "" aher 0 alev 1 Ncl1 1 10000 aani "stand" aeat "" |
   
/*
    Credits:
   ¯¯¯¯¯¯¯¯¯
        This method was used by Maker.
*/

    globals
        private constant integer PAUSE = 'paus'
        private constant integer DEFEND = 852055
    endglobals
    function UnitPause takes unit u, boolean b returns nothing
        if (b) then
           call UnitAddAbility(u, PAUSE)
           call IssueImmediateOrderById(u, DEFEND)
        else
            call UnitRemoveAbility(u, PAUSE)
        endif
    endfunction
    function UnitPaused takes unit u returns boolean
        return (UnitRemoveAbility(u, PAUSE) and UnitAddAbility(u, PAUSE) and IssueImmediateOrderById(u, DEFEND))
    endfunction
endlibrary
Code:
//TESH.scrollpos=0
//TESH.alwaysfold=0
struct PauseTest extends array
    private static unit tester
   
    private static method onSelect takes nothing returns boolean
        if (UnitPaused(tester)) then
            call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "paused")
        else
            call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "not paused")
        endif
        return false
    endmethod
   
    private static method onEscape takes nothing returns boolean
        call UnitPause(tester, not(UnitPaused(tester)))
        return false
    endmethod

    private static method onInit takes nothing returns nothing
       
        local trigger t = CreateTrigger()
        set tester = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
       
        call TriggerRegisterUnitEvent(t, tester, EVENT_UNIT_SELECTED )
        call TriggerAddCondition(t, Filter(function thistype.onSelect))
       
        set t = CreateTrigger()
        call TriggerRegisterPlayerEvent(t, Player(0), EVENT_PLAYER_END_CINEMATIC)
        call TriggerAddCondition(t, Filter(function thistype.onEscape))
        call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Press 'Esc' to pause/unpause.")
    endmethod
endstruct
 
No way, you could probably remake it as vanilla JASS but there's only a little chance.
It's just like making a GUI version of JASS because you can't convert JASS back to GUI.

That's completely wrong.

Just use the ability from that system cast it.

  • Unit - Add Ability Channel Pause
  • Unit - Order Unit to Defend
Remove to unpause.
 
Status
Not open for further replies.
Top