• 🏆 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] Can any pros teach me?

Status
Not open for further replies.
Level 3
Joined
Jan 31, 2008
Messages
66
Trigger For Currently Selected Units

Hi i'm a newbie in this website, and i've been learning how to to program a map using triggers.... i wanted to create a cheat trigger, which is like this:
Events:
A player types a chat message containing (Empty String) as a substring
Conditions:
(Substring((Entered Chat String), 1, 6)) Equal to (Substring(-invul, 1, 6))
Actions:
Set Temp_Group[(Player Number Of (Triggering Player))] = (Units currently selected by (Triggering Player))
Unit Group - Pick every unit in Temp_Group[(Player Number Of (Triggering Player))] and do (Unit - Make (Picked Unit) Invulnerable)
Unit Group - Destroy unit group Temp_Group[(Player Number Of (Triggering Player))]

This works very well in single player mode, but when i go online, the trigger gets messed up.... the units that i did not selected currently also became invulnerable when i type -invul.... how? i'm very troubled now, help is greatly appreciated....
 
Last edited:
Level 3
Joined
Jan 31, 2008
Messages
66
ok because there are some cheat packs out there which can select the unit properly.... causing no problems, so i jsut wanna find out if there are any pros out there who can teach mi how to make a trigger that will not be buggy... because i made a trigger to kill the selected unit in multiplayer, and end up killing myself when i intended to kill the creeps... :cry:
 
Level 3
Joined
Jan 31, 2008
Messages
66
oooh so if my trigger is like this:
Kill
Events
Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
Player - Player 2 (Blue) types a chat message containing <Empty String> as A substring
Player - Player 3 (Teal) types a chat message containing <Empty String> as A substring
Player - Player 4 (Purple) types a chat message containing <Empty String> as A substring
Player - Player 5 (Yellow) types a chat message containing <Empty String> as A substring
Player - Player 6 (Orange) types a chat message containing <Empty String> as A substring
Player - Player 7 (Green) types a chat message containing <Empty String> as A substring
Player - Player 8 (Pink) types a chat message containing <Empty String> as A substring
Player - Player 9 (Gray) types a chat message containing <Empty String> as A substring
Player - Player 10 (Light Blue) types a chat message containing <Empty String> as A substring
Player - Player 11 (Dark Green) types a chat message containing <Empty String> as A substring
Player - Player 12 (Brown) types a chat message containing <Empty String> as A substring
Conditions
(Substring((Entered chat string), 1, 5)) Equal to (Substring(-kill, 1, 5))
Actions
Set Temp_Group[(Player number of (Triggering player))] = (Units currently selected by (Triggering player))
Set Temp_Unit[(Player number of (Triggering player))] = (First unit of group Temp_Group[(Player number of (Triggering player))])
Unit - Explode Temp_Unit[(Player number of (Triggering player))]
Unit Group - Remove Temp_Unit[(Player number of (Triggering player))] from Temp_Group[(Player number of (Triggering player))]
Unit Group - Destroy unit group Temp_Group[(Player number of (Triggering player))]
so where do i add the custom script? and do u think my trigger like this works?
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
  • Events
    • Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
    • Player - Player 2 (Blue) types a chat message containing <Empty String> as A substring
    • Player - Player 3 (Teal) types a chat message containing <Empty String> as A substring
    • Player - Player 4 (Purple) types a chat message containing <Empty String> as A substring
    • Player - Player 5 (Yellow) types a chat message containing <Empty String> as A substring
    • Player - Player 6 (Orange) types a chat message containing <Empty String> as A substring
    • Player - Player 7 (Green) types a chat message containing <Empty String> as A substring
    • Player - Player 8 (Pink) types a chat message containing <Empty String> as A substring
    • Player - Player 9 (Gray) types a chat message containing <Empty String> as A substring
    • Player - Player 10 (Light Blue) types a chat message containing <Empty String> as A substring
    • Player - Player 11 (Dark Green) types a chat message containing <Empty String> as A substring
    • Player - Player 12 (Brown) types a chat message containing <Empty String> as A substring
  • Conditions
    • (Substring((Entered chat string), 1, 5)) Equal to (Substring(-kill, 1, 5))
  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • Custom script: call SyncSelections()
    • Unit Group - Pick Every Unit Currently Selected by (Triggering Player) and do Actions
      • Loop Actions
        • Unit - Explode (Picked Unit)
no leaks, no bugs
 
Level 3
Joined
Jan 31, 2008
Messages
66
erm i think i figured out why.... syncselections dun wokr for my trigger, but i found a better one.... :grin: tnks for your help anyway
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Need_O2, I heard from a friend a while ago that SyncSelections is the reason that the function doesn't work in the first place.

[jass=Here's the raw selection enum function]function GetUnitsSelectedAll takes player whichPlayer returns group
local group g = CreateGroup()
call SyncSelections()
call GroupEnumUnitsSelected(g, whichPlayer, null)
return g
endfunction[/code]

So, you could always just do this: (have a global unit group called EnumGroup)

  • Actions
    • Custom script: set udg_EnumGroup = CreateGroup()
    • Custom script: call GroupEnumUnitsSelected(udg_EnumGroup,<a player>,null)
    • Unit Group - Pick Every Unit in EnumGroup and do Actions
    • -------- etc --------
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
You are right I totally forgot that (I remembered 1 week after I posted the post... damn english)

I think that is the thing that (SyncSelections) causes selection bugs anyway
 
Level 3
Joined
Jan 31, 2008
Messages
66
wow purplepoot u read my mind dude.... ^_^ i found it out when i was looking at the cheat pack from other sites.... anyway, can u guys help mi with one thing again.... u know there's a default ability called ghost in all maps rite? when u give it to a unit, it will make it invisible forever, no matter what u do, even if u attack or move, u won't get visible.... so the question is, is there any trigger to prevent detection of ur unit when it has the ghost ability and someone is using a form of ward or item which makes it detect invisible units? if anyone knows about this, please teach mi.... so that i can make my unit purely invisible and no one can ever find see mi... ^_^
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
This is %99 GUI

and you can remove locust
ShowUnit(<unit>,false)
UnitRemoveAbility(<unit>,'Aloc')
ShowUnit(<unit>,true)
 
Level 3
Joined
Jan 31, 2008
Messages
66
erm ghost read my mind... yup i'm creating a cheat whereby when i type -ghostunit, i will give the unit i'm selecting an ability called "ghost".... but i know that when other people use some sort of item or skill (for example true sight or the gem of true sight if i'm not wrong) and they can see invisible units rite? i'm jsut thinknig is there any way to prevent other people from seeing me.... i tried the 100% transparency method, doesn't work because u will still be able to see a shadow on the ground, and the enemy will also be able to click on my hero... anyone can help mi? gladly appreciated... oh yar and can anyone tell mi what's the thundergod wrath ability in dota based on? i mean based on which basic ability... :xxd:
 
Status
Not open for further replies.
Top