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

Mind Control trigger

Status
Not open for further replies.
Level 4
Joined
Aug 2, 2019
Messages
30
Hi, could you help? i really, really sucks at triggers i dont even know to to make this part "(Target unit of ability being cast)". I was looking but i couldn't find a correct value,
pls help.


  • [LIST]
  • [*][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/events.gif[/IMG]Events
  • [LIST]
  • [*][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/joinbottom.gif[/IMG][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/unit.gif[/IMG]Unit - A unit starts the effect of an ability
  • [/LIST]
  • [*][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/cond.gif[/IMG]Conditions
  • [LIST]
  • [*][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/joinbottom.gif[/IMG][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/if.gif[/IMG](Ability being cast) equal to CONTROL
  • [/LIST]
  • [*][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/actions.gif[/IMG]Actions
  • [LIST]
  • [*][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/join.gif[/IMG][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/page.gif[/IMG]Custom script: local unit udg_MC_Unit
  • [*][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/join.gif[/IMG][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/page.gif[/IMG]Custom script: local player udg_MC_Player
  • [*][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/join.gif[/IMG][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/set.gif[/IMG]Set MC_Unit = (Target unit of ability being cast)
  • [*][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/join.gif[/IMG][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/set.gif[/IMG]Set MC_Player = (Owner of MC_Unit)
  • [*][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/join.gif[/IMG][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/zzz.gif[/IMG]Wait 10.00 game-time seconds
  • [*][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/join.gif[/IMG][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/unit.gif[/IMG]Unit - Change owner of MC_Unit to MC_Player and change color
  • [*][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/join.gif[/IMG][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/comment.gif[/IMG]-------- might not need these lines, but my suspicion is you will: --------
  • [*][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/join.gif[/IMG][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/page.gif[/IMG]Custom script: set udg_MC_Unit = null
  • [*][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/joinbottom.gif[/IMG][IMG]https://www.hiveworkshop.com/styles/default/ratory/trigger_legacy/page.gif[/IMG]Custom script: set udg_MC_Player = null
  • [/LIST]
  • [/LIST]
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
We can't understand that.
Once you've got that sorted out, (Target unit of ability being cast) is one of many Unit Event Responses. So if your Condition/Action is in relation to Units then you'll find it listed in there as one of the many available functions.
 
Level 4
Joined
Aug 2, 2019
Messages
30
Ups, sorry, i hadn't saw this mistake till now. It's not my script i didn't even copy it propely, so there is the photo of Pyrogams's script.
Ok, but today i understand when making a variable u can aslo pick type, which i miss, i use it, but i still cant chose (Target unit of ability being cast)
Zrzut ekranu (150).png
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
Example.png


So MC_Unit is a Unit variable and MC_Player is a Player variable. You have to create these Variables yourself.

You will have different Functions/Presets available to use for each Variable type.

If you don't see (Target unit of ability being cast) under the Function category then your variable is NOT a Unit variable.
 
Last edited:
Level 4
Joined
Aug 2, 2019
Messages
30
Jesus, thank you. that explain a lot.
Now i have to deal with error, but i will probably look for anserws on original page.
Appreciated



Zrzut ekranu (151).png
 
Level 4
Joined
Aug 2, 2019
Messages
30
  • mindcontrol
    • Events
      • Unit - Royal Archmage 0011 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to mind control
    • Actions
      • Custom script: local unit udg_MC_Player
      • Custom script: local unit udg_MC_Unit
      • Set MC_Player = (Owner of MC_Unit)
      • Set MC_Unit = (Target unit of ability being cast)
      • Wait 10.00 game-time seconds
      • Unit - Change ownership of MC_Unit to MC_Player and Change color
      • Custom script: set udg_MC_Unit = null
      • Custom script: set udg_MC_Player = null
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
This (what you did):
  • Custom script: local unit udg_MC_Player
Is not the same as this:
  • Custom script: local player udg_MC_Player

You're also setting MC_Player first when it should happen AFTER you set MC_Unit:
  • Set MC_Player = (Owner of MC_Unit)
  • Set MC_Unit = (Target unit of ability being cast)
Change it to this:
  • Set MC_Unit = (Target unit of ability being cast)
  • Set MC_Player = (Owner of MC_Unit)

When I said that your trigger needed to be an exact copy I meant EXACT.

Understand that Triggers execute from top to bottom, so the order is very important!
 
Last edited:
Level 4
Joined
Aug 2, 2019
Messages
30
Dear god thank you now at least the game is working.
But trigger doesn't work as intented, unit wont change to his original owner.
I will keep looking for a better solution.
Anyway, thank you very much for "turtorial" of trigger, i didnt know that positon of viariable its important. thx
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
Dear god thank you now at least the game is working.
But trigger doesn't work as intented, unit wont change to his original owner.
I will keep looking for a better solution.
Anyway, thank you very much for "turtorial" of trigger, i didnt know that positon of viariable its important. thx
Post your trigger so we can see why it doesn't work.
 
Level 4
Joined
Aug 2, 2019
Messages
30
I mean, it works, no errors, but i am taking pernament control of a unit, not temporarily

  • mindcontrol
    • Events
      • Unit - Royal Archmage 0011 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to mind control
    • Actions
      • Custom script: local player udg_MC_Player
      • Custom script: local unit udg_MC_Unit
      • Set MC_Unit = (Target unit of ability being cast)
      • Set MC_Player = (Owner of MC_Unit)
      • Wait 10.00 game-time seconds
      • Unit - Change ownership of MC_Unit to MC_Player and Change color
      • Custom script: set udg_MC_Unit = null
      • Custom script: set udg_MC_Player = null
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
You'll only get Errors when making a mistake with Jass code (Custom script). There's many reasons why a trigger wouldn't work that wouldn't show an error.

So I read Pyrogasm's post again and he mentions why this might not work. It's because the unit has already changed ownership from the Mind Control ability by the time the trigger runs. In other words, we're setting MC_Player too late, the unit has already changed ownership.

Here's a solution that could work in this particular case, assuming that you only have one unit with this Mind Control ability:

Create a new trigger and a new Player variable called MC_PlayerBefore:
  • Mind Control Before
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to mind control
    • Actions
      • Set MC_PlayerBefore = (Owner of (Target unit of ability being cast))
Notice how the Event is BEGINS casting an ability. This will run before the effects of the ability actually happen.

Now in your original mindcontrol trigger you need to make a slight change to MC_Player:
  • Set MC_Player = MC_PlayerBefore

That should fix it. MC_Player will now be equal to MC_PlayerBefore, which was Set BEFORE the target's ownership changed from the effects of the ability.
 
Level 4
Joined
Aug 2, 2019
Messages
30
and it doesnt work

  • mindcontrolbefore
    • Events
      • Unit - Royal Archmage 0011 <gen> Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to mind control
    • Actions
      • Set MC_PlayerBefore = (Owner of (Target unit of ability being cast))
  • mindcontrol
    • Events
      • Unit - Royal Archmage 0011 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to mind control
    • Actions
      • Custom script: local player udg_MC_Player
      • Custom script: local unit udg_MC_Unit
      • Set MC_Unit = (Target unit of ability being cast)
      • Set MC_Player = MC_PlayerBefore
      • Wait 10.00 game-time seconds
      • Unit - Change ownership of MC_Unit to MC_Player and Change color
      • Custom script: set udg_MC_Unit = null
      • Custom script: set udg_MC_Player = null
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
Disable all of the Custom script stuff (right click on them and uncheck Enable Function). See if it works then.

Edit: I tested the triggers and everything works fine for me. My triggers:
  • cast before
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Set VariableSet MC_PlayerBefore = (Owner of (Target unit of ability being cast))
  • cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: local unit udg_MC_Target
      • Custom script: local player udg_MC_Player
      • Set VariableSet MC_Target = (Target unit of ability being cast)
      • Set VariableSet MC_Player = MC_PlayerBefore
      • Wait 10.00 game-time seconds
      • Unit - Change ownership of MC_Target to MC_Player and Change color

Maybe this method doesn't work on older versions of Warcraft 3. I see you're not on the latest patch.

Just to clarify, you're casting this ability with Royal Archmage 0011, correct? It has to be that specific unit for your triggers to work.
 
Last edited:
Level 4
Joined
Aug 2, 2019
Messages
30
OK,
its still refuse to work
Set VariableSet MC_PlayerBefore- it cunfusing but it must a mistake while while writing
I have copied your triger( i turn off my trigers) but i don't know how he suposed to know on which ablity should be used
  • mindcontrolbefore2
    • Events
      • Unit - Royal Archmage 0011 <gen> Begins casting an ability
    • Conditions
    • Actions
      • Set MC_PlayerBefore = (Owner of (Target unit of ability being cast))
  • mindcontrole2
    • Events
      • Unit - Royal Archmage 0011 <gen> Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: local unit udg_MC_Target
      • Custom script: local player udg_MC_Player
      • Set MC_Target = (Target unit of ability being cast)
      • Set MC_Player = MC_PlayerBefore
      • Wait 10.00 game-time seconds
      • Unit - Change ownership of MC_Unit to MC_Player and Change color
I also double checkd my triggers (with and without custom scripts) and still nothing
  • mindcontrol
    • Events
      • Unit - Royal Archmage 0011 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to mind control
    • Actions
      • Custom script: local player udg_MC_Player
      • Custom script: local unit udg_MC_Unit
      • Set MC_Unit = (Target unit of ability being cast)
      • Set MC_Player = MC_PlayerBefore
      • Wait 10.00 game-time seconds
      • Unit - Change ownership of MC_Unit to MC_Player and Change color
      • Custom script: set udg_MC_Unit = null
      • Custom script: set udg_MC_Player = null
  • mindcontrolbefore
    • Events
      • Unit - Royal Archmage 0011 <gen> Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to mind control
    • Actions
      • Set MC_PlayerBefore = (Owner of (Target unit of ability being cast))
custom scripts are turn off, it show them enabled on this site
 
Status
Not open for further replies.
Top