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

[Trigger - Jass]Add abilities to selected unit

Status
Not open for further replies.
Level 3
Joined
Feb 14, 2013
Messages
26
Event
Player chat message
Actions
Get selected unit by trigger player
Display text: Name of selected unit is: ....
Add abilities to unit

Someone help please.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
1. Post triggers properly: http://www.hiveworkshop.com/forums/miscellaneous-tutorials-456/how-easily-post-triggers-163285/
2. This is GUI not JASS

edit:
  • names
    • Events
      • Player - Player 1 (Red) types a chat message containing names as An exact match
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: (Name of selected unit is: + (Name of (Picked unit)))
          • Unit - Add Battle Roar to (Picked unit)
 
Level 3
Joined
Feb 14, 2013
Messages
26
Thank you i found the work jass code
JASS:
function GetUnitsSelectByPlayer takes player p returns group
    local group output=CreateGroup()
	set selection[index]=CreateGroup()
	call GroupAddGroup(selection[GetPlayerId(p)],output)
	return output
endfunction

function Trig_add_Actions takes nothing returns nothing
    local unit selectedUnit = FirstOfGroup(GetUnitsSelectByPlayer(GetTriggerPlayer()))
    call DisplayTextToPlayer(GetTriggerPlayer(),0,0, GetUnitName(selectedUnit))
    call UnitAddAbility(selectedUnit, 'A0CI')
endfunction

function InitTrig_add takes nothing returns nothing
    set gg_trg_add = CreateTrigger()
    call TriggerRegisterPlayerChatEvent( gg_trg_add, Player(0), "add", true )
    call TriggerAddAction( gg_trg_add, function Trig_add_Actions )
endfunction
 
Last edited:
Status
Not open for further replies.
Top