Demo Map Full Command Cart

DioD

New Member
Reaction score
57
Full Command Cart is:

Jass code handler:
JASS:
library FCC initializer INIT
//FullCommandCart

globals

    unit WHO
    destructable DES
    item ITM
    unit UNT
    real X
    real Y
    timer TT = CreateTimer()
    trigger MZ = CreateTrigger()

endglobals

function order takes nothing returns nothing
    if DES != null then
        call IssueTargetOrder(WHO,"smart",DES)
    elseif ITM != null then
        call IssueTargetOrder(WHO,"smart",ITM)
    elseif UNT != null then
        if IsUnitAlly(UNT,GetOwningPlayer(WHO)) then
            call IssueTargetOrder(WHO,"smart",UNT)
        else
            call IssueTargetOrder(WHO,"attack",UNT)
        endif
    else
        call IssuePointOrder(WHO,"move",X,Y)
    endif
    call UnitAddAbility(WHO,'A000')
    call EnableTrigger(MZ)
endfunction

function FCC_MAIN takes nothing returns nothing
    if GetIssuedOrderId() != OrderId("smart") then
        return
    endif
    set WHO = GetTriggerUnit()
    set DES = GetOrderTargetDestructable()
    set ITM = GetOrderTargetItem()
    set UNT = GetOrderTargetUnit()
    set X = GetOrderPointX()
    set Y = GetOrderPointY()
    call DisableTrigger(MZ)
    call UnitRemoveAbility(WHO,'A000')
    call TimerStart(TT,0.0,false,function order)
endfunction

function INIT takes nothing returns nothing

    //This calls will block standart command cart buttorns for player 0
    call SetPlayerAlliance(Player(0), Player(0), ALLIANCE_SHARED_ADVANCED_CONTROL, false)
    call SetPlayerAlliance(Player(0), Player(0), ALLIANCE_SHARED_CONTROL, false)

    //this calls will disable attack notifications

    call SetPlayerAlliance(Player(0), Player(0), ALLIANCE_HELP_REQUEST, true)
    call SetPlayerAlliance(Player(0), Player(0), ALLIANCE_HELP_RESPONSE, true)
    
    //Remove "share control" message
    
    call ClearTextMessages()
    
//register event for channel hit
    call TriggerRegisterAnyUnitEventBJ( MZ, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
    call TriggerRegisterAnyUnitEventBJ( MZ, EVENT_PLAYER_UNIT_ISSUED_ORDER )
    call TriggerRegisterAnyUnitEventBJ( MZ, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerAddAction( MZ, function FCC_MAIN )
endfunction
endlibrary


and

Object trick (included as demo map) (Channel spell with smart order)

This allow you to have unit (or multiple up to unlimited number) with full command cart filled with spells without spellbooks (total 12).

And possible advanced controls (like double click handling, left mouse button handling and other - NOT INCLUDED this version).
 

Attachments

  • FCC 12 v 2.w3x
    37.1 KB · Views: 472
What does this do?
How do you use it?

Also, make the functions that the user isn't going to use private.
 
This allow you to have unit (or multiple up to unlimited number) with full command cart filled with spells without spellbooks (total 12).

note:
also it allow you to enable-disable control over specific units onfly.

also this trick usefull for maps like castle fight, since you able to keep control over worker, and disable control over other units.
 
If I order mass of units to one position, I doubt it can handle it successfully.
 
@DioD

select multiple units and order?

trigger (obvious some maps order multiple units to do the same thing at the same time, for example AoS's)
 
order multiple units at time and post replay or code or whatever if it will fail i will check and fix.

currently its failsafe.
 
@DioD

You have to do this test to prove to us that there are no errors, not unlike we do the test and prove to you that has some error.
the system is yours, you have to show us the efficiency of it, never the reverse.

And most of all, I never said there would be no mistakes, only pointed out ways for you to order several units to do some action simultaneously.
 
you dont know basics of warcraft's code execution, there is NO WAY to do something "simultaneously", all actions execute in order.
 
And most of all, I never said there would be no mistakes, only pointed out ways for you to order several units to do some action simultaneously.

You know what I mean with simultaneously in Warcraft.

Is your system, you do what you want with it.
 
This is a very cool idea, but the code itself needs revision.

you dont know basics of warcraft's code execution, there is NO WAY to do something "simultaneously", all actions execute in order.
This is true, but it is possible for things to happen before the 1-tick delay imposed by a 0-second timer. The following trigger would break your system:
Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(smart))
    • Actions
      • Unit - Order (Target unit of issued order) to Right-Click (Triggering unit)


I would recommend using TimerUtils, and having an actual interface instead of hard-coding which players should be affected. May I suggest this:
(note: this has not been tested to work or compile - it's just an overview)
JASS:
library HCC requires TimerUtils
// Copy this library into a trigger in your map.
// Requires JassHelper and TimerUtils.
//
// Usage:
// call HideCommandCart(whichPlayer, active) with your player and "true"
// if you wish to hide the command cart buttons for that player, or "false"
// to re-enable them.
//
// Each unit needs to have the dummy "smart" order handler ability to be
// able to receive "smart" (right-click) orders when the command cart is
// hidden.
globals
    private trigger array SMARTHANDLER
endglobals

public function HideCommandCart takes player whichPlayer, boolean active returns nothing
    //These calls will block standard command cart buttons
    call SetPlayerAlliance(whichPlayer, whichPlayer, ALLIANCE_SHARED_ADVANCED_CONTROL, not(active))
    call SetPlayerAlliance(whichPlayer, whichPlayer, ALLIANCE_SHARED_CONTROL, not(active))

    //These calls will disable attack notifications
    call SetPlayerAlliance(whichPlayer, whichPlayer, ALLIANCE_HELP_REQUEST, active)
    call SetPlayerAlliance(whichPlayer, whichPlayer, ALLIANCE_HELP_RESPONSE, active)
    
    //Remove "share control" message
    if GetLocalPlayer() == whichPlayer then
        call ClearTextMessages()
    endif

    //Enables/disables smart order handling
    if active then
        call EnableTrigger(SMARTHANDLER[GetPlayerId(whichPlayer)])
    else
        call DisableTrigger(SMARTHANDLER[GetPlayerId(whichPlayer)])
    endif
endfunction

private struct SmartHandler 
    unit orderedUnit
    destructable targetDestructable
    item targetItem
    unit targetUnit
    real targetX = 0
    real targetY = 0

    static method reissue takes nothing returns nothing
        local thistype this = thistype[GetTimerData(GetExpiredTimer())]
        call ReleaseTimer(GetExpiredTimer())
        
        call DisableTrigger(SMARTHANDLER[GetPlayerId(GetOwningPlayer(orderedUnit))])
        if targetDestructable != null then
            call IssueTargetOrder(orderedUnit, "smart", targetDestructable)
        elseif targetItem != null then
            call IssueTargetOrder(orderedUnit, "smart", targetItem)
        elseif targetUnit != null then
            call IssueTargetOrder(orderedUnit, "smart", targetUnit)
        else
            call IssuePointOrder(orderedUnit, "move", targetX, targetY)
        endif
        call EnableTrigger(SMARTHANDLER[GetPlayerId(GetOwningPlayer(orderedUnit))])
        
        call this.destroy()
    endmethod
    
    static method onOrder takes nothing returns boolean
        local thistype this
        local timer t
        if GetIssuedOrderId() == OrderId("smart") then
            set this = thistype.create()
            call SetTimerData(t, this)
            
            set orderedUnit = GetTriggerUnit()
            set targetDestructable = GetOrderTargetDestructable()
            set targetItem = GetOrderTargetItem()
            set targetUnit = GetOrderTargetUnit()
            set targetX = GetOrderPointX()
            set targetY = GetOrderPointY()
            
            call TimerStart(t, 0.0, false, function thistype.reissue)
            set t = null
        endif
        return false
    endmethod
    
    static method onInit takes nothing returns nothing
        local integer i = 0
        loop
            set SMARTHANDLER<i> = CreateTrigger()
            call TriggerRegisterPlayerUnitEvent(SMARTHANDLER<i>, Player(i), whichEvent, Condition(function thistype.onOrder))
            call DisableTrigger(SMARTHANDLER<i>)
            set i = i+1
            exitwhen index == bj_MAX_PLAYER_SLOTS
        endloop
    endmethod
endstruct
endlibrary</i></i></i>


Also, the smart order ability can be reduced to having 1 level and needs to have its options set to have it as a Universal Ability (so it can target spell immune and can be cast while silenced).
 
@Weep
your sample will ruin any map, with any code, since you generate event from trigger registered to this event.

"smart" or right click shoud be used with care (there is no reason to use smart from code anyway, units will 'move' or 'attack') with command cart disabled player may not select more then 1 unit soo this is not issue at all.

structs (arrays) not needed, this system run without problems on single set of variables.

this cannot be enabled or disabled in runtime, if you set custom controls, you may disable control of individual units (remove handler and add ward class) but not players.

@Darthfett

This is not system, this is demomap (sample), it cannot be imported to map, since there is no way to "1click" setup it.

well "fixed" version will come this sunday (311010) this will be demo of castle fight like map.
 
@Weep
your sample will ruin any map, with any code, since you generate event from trigger registered to this event.
OK, so I forgot to put a trigger disable/enable actions in my short GUI example. The point remains that, although unlikely to be used, a trigger ordering units to "smart" some other unit from an order event will overwrite your system's variables. It is a correctable fault.

"smart" or right click shoud be used with care (there is no reason to use smart from code anyway, units will 'move' or 'attack')
Why bother figuring out which will happen with a large set of "if" statements, when you can issue the "smart" order and let the game figure it out? It's not as simple as you might think.

For example, in your original system, you order a unit to attack if it had been smart-ordered onto an enemy. This is incorrect, however: if the enemy is invulnerable, the vanilla game's response is to have the ordered unit move to the enemy, not to attack (which simply presents the error message without the unit moving).

with command cart disabled player may not select more then 1 unit soo this is not issue at all.
Interesting, I didn't notice. This limitation should be mentioned in the code's documentation.

structs (arrays) not needed, this system run without problems on single set of variables.
False; see above. This system is so cool, I don't want to see it graveyarded just because you aren't realizing that flaws, even if rare to encounter, ought to be removed. :(

this cannot be enabled or disabled in runtime, if you set custom controls, you may disable control of individual units (remove handler and add ward class) but not players.
I don't understand what you mean, but if you mean that it doesn't work to enable/disable a player's self-control during the game, it's not true - you just need to reselect the unit for the control cart to update.

This is not system, this is demomap (sample), it cannot be imported to map, since there is no way to "1click" setup it.
Why not make it in such a way that it can?

well "fixed" version will come this sunday (311010) this will be demo of castle fight like map.
What fixes do you intend to make?
 
Everything noted in this thread will be checked and (possibly)fixed.

System will not be moved to arrays, this is not flaw or problem, it will ignore orders given by triggers (experemental methods + hooks).
There is completely no way for player to hit 0second timer limits.

For players who already hook IssueX functions direct arrays version will be included.
(act like structs+timer utils but dont need any additional importing).

Runtime player(enable-disable) and unit(enable-disable) controls will be added.

Experemental player 12-15 AI disabling will be added.

All profs and cons will be listed.
All limits will be listed.
Instal documentation will be included.
Demomap will be included.
 
All profs and cons will be listed.
All limits will be listed.
Instal documentation will be included.
Demomap will be included.

It's good to read :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    You know how when you saw a word like a hundred times over it loses any meaning? That's where I'm at on this now.
  • Varine Varine:
    I had to allergen guides earlier this week and that is SO MUCH just looking through ingredients and trying to figure out if a company is correct
  • Varine Varine:
    Like did you know you can have gluten free products that still technically contain wheat?
  • Varine Varine:
    I did know that but forgot and spent several hours learning why until I remembered I knew that
  • Varine Varine:
    Xanthum gum can be made from wheat, but is processed in a way that no gluten is present, but it still presents a risk for severe wheat allergies that are NOT gluten
  • Varine Varine:
    Do you think the people that answer the phone for that company have any idea about that? Because they do not, nor can they tell me where they get that xanthum gum usually so I can't ask the people that make it, nor do they particularly care if I'm the one risking people's lives and not them.
  • Varine Varine:
    So that was my week building up to today, because that is when I got the menu and had to guess at the actual recipes for two of those days, because again I think he threw this into AI and ran with a lot of it
  • Varine Varine:
    I should have had all of this like a month ago but whatever, it's fine. He's trying a thing, idk it's his menu I don
  • Varine Varine:
    I don't care.
  • Varine Varine:
    Fuck I need more saturday nights off. Turns out I'm much cooler to drunk girls. If I hang out with enough people like that, eventually I'll meet one that likes me sober too
  • Varine Varine:
    idk if anyone has ever done IT. I am not IT but I just got off a 20 minute phone call with the general manager asking me how to make her new computer print. I do adore her, like I know her personally, but I asked three times if the printer was on. She apologized for bothering me, and Chef Ben walked in a few minutes later, turned the printer on apparently, and then called to ask if I was trying to print shit from my house again
  • Varine Varine:
    So I have a newfound appreciation
  • Varine Varine:
    And also I'm going to remove that one from my secondary career options
  • Varine Varine:
    As I get older I'm not thinking I can do this forever anymore, and I'm kind of dead end right now. I get a fine salary and fair raises, like I can easily live my lifestyle on this normally, but I don't know if I can do this in ten years, and I don't think I want to. I don't really have any desire to take over another restaurant, and I don't want to try and own one, and I doubt I'll luck out like I did with that taco place in Texas
  • Varine Varine:
    I have a math degree but that was a while ago and I'm not positive I actually deserved that. It was kind of just given to me I feel like cuz I was in school so long. Like for a bit as a teenager I got real into the mormon thing, and my dad grew up kind of similarly. Much like he fell out of it
  • Varine Varine:
    Anyway he started coming to church with me for a bit, and they gave home the I think Melchizedek? idk how to spell it, but it's the 'upper' priesthood, like he had a whole blessing thing after I got baptized, and it WAS a very neat experience. And the only reason I think they did they did that was cuz he was like late 30s, and that is kind of the age that they have the last chance at that
  • Varine Varine:
    And I mean its not, but like... I'm pretty well set in my lack of religious beliefs, I guess. And I'm a bit younger than my dad would have been then.
  • Varine Varine:
    And then I got real into, he got bored and was like you do you dude, and that's how I got a huge amount of freedom when I started doing drugs as a teenager
  • Varine Varine:
    In hindsight my parents were fantastic. but they were too fucking tired to raise kids like me. And their jobs were easier with better benefits.
  • Varine Varine:
    Anyway idk where I'm going here, but I asked ChatGPT some of the same things and holy shit was it way more strict and just gave me (importantly the wrong) phone number to a hotline
  • Varine Varine:
    TH, I gotta say, though, I'm amazed you keep this up. I feel like there are you and Ghan doing whatever you're doing, Tom posting news, and then me using the chatbox as a journal every once in a while.
  • Varine Varine:
    Thanks for letting me do that, also. I know I'm not using it correctly, but somewhere along the line I went from arguing with Cheshire to using this as a kind of void for my frustrations and hopes. I like to think of the whole thing as an enigma of sorts
  • Varine Varine:
    It's not, you guys could probably blackmail me if you went back far enough. I doubt anyone would, you've always been very kind, and I'm glad to have been a part of all this! I hope you enjoy me too, cuz I'm going to keep doing it.
  • Varine Varine:
    In my defense I was high for a lot of that though
  • V-SNES V-SNES:
    Thanks for sharing @Varine

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top