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

Few selection commands

Status
Not open for further replies.
Level 5
Joined
Jun 21, 2011
Messages
119
Hellow hive. I have a little problem with triggers.
I'm trying to make a few commands to my map:


#1 Players select his own unit and writes -kill, then unit dies. :goblin_boom:

#2 Player selects his own unit and writes -sleep, then trigger creates a sleep effect overhead of triggering unit, if unit moves then sleep efect disappears. :goblin_boom:


I've tried to make it, but i have no idea. If som1 help i'll giive + rep.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Hellow hive. I have a little problem with triggers.
I'm trying to make a few commands to my map:


#1 Players select his own unit and writes -kill, then unit dies. :goblin_boom:

#2 Player selects his own unit and writes -sleep, then trigger creates a sleep effect overhead of triggering unit, if unit moves then sleep efect disappears. :goblin_boom:


I've tried to make it, but i have no idea. If som1 help i'll giive + rep.
  • slect kill
    • Events
      • Player - Player 1 (Red) types a chat message containing -kill as An exact match
    • Conditions
    • Actions
      • Set TempUnitGroup = (Units currently selected by (Triggering player))
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to (Triggering player)
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions
      • Custom script: call DestroyGroup( udg_TempUnitGroup )
  • select sleep
    • Events
      • Player - Player 1 (Red) types a chat message containing -sleep as An exact match
    • Conditions
    • Actions
      • Custom script: local real x
      • Custom script: local real y
      • Custom script: local effect f = AddSpecialEffectTarget("Abilities\\Spells\\Undead\\Sleep\\SleepTarget.mdl", udg_unit, "overhead")
      • Set TempUnitGroup = (Units currently selected by (Triggering player))
      • Set unit = (Random unit from TempUnitGroup)
      • Custom script: call DestroyGroup( udg_TempUnitGroup )
      • Custom script: loop
      • Custom script: exitwhen x!=GetUnitX(udg_unit) and y!=GetUnitY(udg_unit)
      • Wait 0.50 seconds
      • Custom script: set x = GetUnitX(udg_unit)
      • Custom script: set y = GetUnitY(udg_unit)
      • Custom script: endloop
      • Custom script: call DestroyEffect(f)
      • Custom script: set f = null
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
(first try it and tell me if work or no since mostly i check allways my triggers but atm i just tested the syntax when i saved, but i think must work, so hurry try it and tell if u got problem)

a thing, i added only for player 1, but if u want do for other players too then just add event for player 2 and rest too near player 1 event :)
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Hmm, the 2nd selection skill not working. Could you try with no custom scripts? (or with JASS/vJASS?)

its jass but very simple. make a trigger with ''sleep command'' name, convert to custom text and replace the text with this and must work

or just copy trigger from uploaded map

JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    local player p = GetTriggerPlayer()
    local unit u = GroupPickRandomUnit(GetUnitsSelectedAll(p))
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local effect f = AddSpecialEffectTarget("Abilities\\Spells\\Undead\\Sleep\\SleepTarget.mdl", u, "overhead")
    loop
        exitwhen x!=GetUnitX(u) and y!=GetUnitY(u)
        set x = GetUnitX(u)
        set y = GetUnitY(u)
        call TriggerSleepAction(0.50)
    endloop
    call DestroyEffect(f)
    set f = null
    set p = null
    set u = null
endfunction

//===========================================================================
function InitTrig_sleep_command takes nothing returns nothing
    set gg_trg_sleep_command = CreateTrigger( )
    call TriggerRegisterPlayerChatEvent( gg_trg_sleep_command, Player(0), "-sleep", true )
    call TriggerAddAction( gg_trg_sleep_command, function Trig_Untitled_Trigger_001_Actions )
endfunction
 

Attachments

  • sleep.w3m
    16.5 KB · Views: 34
Status
Not open for further replies.
Top