Links to the relevant part of my video tutorial is provided for each step (since this is a very brief/no-explanation text tutorial).
In mine, I am using a new map with players set to 2.
I placed a Zealot for player 1 and 2 and then several zerglings (spread out) for player 15 (Hostile).
Open data editor.
Cameras tab.
Click on Default Camera.
Remove zoom levels.
Set Initial Parameter's distance down to about 27.
Units tab.
Find and click on Zergling (our monster unit).
Go to 'Unit - Flags' and double-click.
Uncheck 'Cannot be Clicked'
Uncheck 'Cannot be Highlighted'
Check 'Unselectable'
Now find/click-on Zealot (our to-be hero unit).
Go to 'Ability - Abilities+' and double-click.
Add these three abilities: High Templar - Psi Storm, Ghost - Sniper, and Sentry - Guardian Shield (No need to add them to the command card).
Set Behavior - Response field to No response.
Set Combat - Default Acquire Level to None
Open Unit - Flags
Uncheck Cannot be Highlighted.
Check Unselectable.
Now in the object explorer for the Zealot, scroll down to his weapon, Zealot - Psi Blades.
Double-Click on Weapon - Scan Filters and uncheck all 4 boxes.
Then scroll back up the object explorer to the top and click on his ability: Ghost - Sniper.
Now double-click on Cost - Cost+.
Click on the first row.
Scroll down and change Cooldown's 'Time Use' to 0.1. (basically a minimum cast time).
Then change Energy value under Vitals to be 0 rather than 25. (I set it to 0 for this tutorial. You'd have to give your zealot energy and then set this number properly in the future).
Now double-click on Stats - Cast Start Time.
Remove the number and hit OK.
Click on his next relevant ability: High Templar - Psi Storm.
Under cost again... set time-use under Cooldown to 0.1 and set Energy under Vitals to 0.
On Ability - Commands +, click on Execute row and then hit the red-x at bottom-right of requirements section.
Remove the Stats - Cast Finish Time number.
Next ability is his Sentry - Guardian Shield one.
Just set the Cost-Cost+ again to be 0.1 and 0 for cooldown and vitals.
Open the trigger editor.
Clear the actions from Melee Initialization first.
Add a new global variable: Heroes = No Unit <Unit[2]>
New folder: Move & Attack
New Record: Move and Attack Info
Variables
Left Pressed = false <Boolean>
Unit Clicked = false <Boolean>
Move Direction = 0.0 <Real>
Target Unit = No Unit <Unit>
New Record Variable: Player Move and Attack Info <Move and Attack Info[2]>
New folder: Spells
New Record: Spell Info
Variables
Right Pressed = false <Boolean>
Right Mouse Position = No Point <Point>
Unit Highlighted = false <Boolean>
Highlighted Unit = No Unit <Unit>
Right Mouse Spell = No Ability Command <Ability Command>
Right Mouse Spell Requires Target = false <Boolean>
Right Mouse Spell Requires Ground = false <Boolean>
Right Mouse Spell Cooldown = 0.0 <Real>
New Record Variable: Player Spell Info <Spell Info[2]>
For my triggers I am just pasting them into here. If you want explanation/back-story watch the video.
Now click back onto Melee Initialization.
Here is the list of actions to make:
UI-Disablemousedragselectionfor(Allplayers)UI-HidegameUIfor(Allplayers)Player-Makeallplayersin(ActivePlayers)treateachotherasAllyVariable-SetHeroes[1]=Zealot[45.91,37.45]Variable-SetHeroes[2]=Zealot[47.27,36.58]PlayerGroup-Pickeachplayerin(ActivePlayers)anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Controllerofplayer(Pickedplayer))==UserThenCamera-Panthecameraforplayer(Pickedplayer)to(PositionofHeroes[(Pickedplayer)])over0.0secondswithExistingVelocity%initialvelocity,10%deceleration,andDoNotusesmartpanningCamera-Followforplayer(Pickedplayer)(Unitgroup(Heroes[(Pickedplayer)]))withthecameraandClearCurrentTargetCamera-Lockcamerainputforplayer(Pickedplayer)Variable-SetPlayerSpellInfo[(Pickedplayer)].RightMouseSpell=HighTemplar-HighTemplar-PsionicStormVariable-SetPlayerSpellInfo[(Pickedplayer)].RightMouseSpellRequiresTarget=falseVariable-SetPlayerSpellInfo[(Pickedplayer)].RightMouseSpellRequiresGround=trueVariable-SetPlayerSpellInfo[(Pickedplayer)].RightMouseSpellCooldown=0.5UI-Display"Psi Storm set to right-mouse."for(Playergroup((Pickedplayer)))toSubtitleareaElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Statusofplayer1)!=PlayingThenUnit-RemoveHeroes[1]fromthegameElseGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Statusofplayer2)!=PlayingThenUnit-RemoveHeroes[2]fromthegameElse
Now under the Move & Attack folder:
New trigger: Mouse Down Left.
EventsUI-PlayerAnyPlayerclicksLeftmousebuttonDown.LocalVariablesCamTarget=(Currentcameratargetofplayer(Triggeringplayer))<Point>MouseClicked=(Point((MouseXpositionclickedintheworld),(MouseYpositionclickedintheworld)))<Point>ConditionsPlayerSpellInfo[(Triggeringplayer)].Right Pressed == false
Actions
Variable - Set Player Move and Attack Info[(Triggeringplayer)].Left Pressed = true
Variable - Set Player Move and Attack Info[(Triggeringplayer)].Move Direction = (Angle from Cam Target to Mouse Clicked)
EventsUI-PlayerAnyPlayermovesmouse.LocalVariablesCamTarget=(Currentcameratargetofplayer(Triggeringplayer))<Point>MouseClicked=(Point((MouseXpositionintheworld),(MouseYpositionintheworld)))<Point>ConditionsActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfPlayerMoveandAttackInfo[(Triggeringplayer)].Left Pressed == true
Then
Variable - Set Player Move and Attack Info[(Triggeringplayer)].Move Direction = (Angle from Cam Target to Mouse Clicked)
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Player Spell Info[(Triggeringplayer)].Right Pressed == true
Then
Variable - Set Player Spell Info[(Triggeringplayer)].Right Mouse Position = Mouse Clicked
Else
EventsUI-PlayerAnyPlayerpresses1(Key)keyUpwithshiftAllow,controlAllow,altAllowLocalVariablesConditions(Controllerofplayer(Triggeringplayer))==UserActionsVariable-SetPlayerSpellInfo[(Triggeringplayer)].RightMouseSpell=HighTemplar-HighTemplar-PsionicStormVariable-SetPlayerSpellInfo[(Triggeringplayer)].RightMouseSpellRequiresTarget=falseVariable-SetPlayerSpellInfo[(Triggeringplayer)].RightMouseSpellRequiresGround=trueVariable-SetPlayerSpellInfo[(Triggeringplayer)].RightMouseSpellCooldown=0.5UI-Display"Psi Storm set to right-mouse."for(Playergroup((Triggeringplayer)))toSubtitlearea
New trigger: Change to Spell 2 (Snipe)
EventsUI-PlayerAnyPlayerpresses2(Key)keyUpwithshiftAllow,controlAllow,altAllowLocalVariablesConditions(Controllerofplayer(Triggeringplayer))==UserActionsVariable-SetPlayerSpellInfo[(Triggeringplayer)].RightMouseSpell=Ghost-SniperRoundVariable-SetPlayerSpellInfo[(Triggeringplayer)].RightMouseSpellRequiresTarget=trueVariable-SetPlayerSpellInfo[(Triggeringplayer)].RightMouseSpellCooldown=0.6UI-Display"Snipe set to right-mouse."for(Playergroup((Triggeringplayer)))toSubtitlearea
New trigger: Change to Spell 3 (Guardian Shield)
EventsUI-PlayerAnyPlayerpresses3(Key)keyUpwithshiftAllow,controlAllow,altAllowLocalVariablesConditions(Controllerofplayer(Triggeringplayer))==UserActionsVariable-SetPlayerSpellInfo[(Triggeringplayer)].RightMouseSpell=Sentry-GuardianShieldVariable-SetPlayerSpellInfo[(Triggeringplayer)].RightMouseSpellRequiresTarget=falseVariable-SetPlayerSpellInfo[(Triggeringplayer)].RightMouseSpellRequiresGround=falseVariable-SetPlayerSpellInfo[(Triggeringplayer)].RightMouseSpellCooldown=0.5UI-Display"Guardian Shield set to right-mouse."for(Playergroup((Triggeringplayer)))toSubtitlearea
New Action Definition: Cast Spell Loop.
(Note: in the video I missed one action which is the 'Wait' action. I do correct myself later, but it's correctly in the text version below if you need...)
Options:ActionReturnType:(None)ParametersPlayer=0<Integer>GrammarText:CastSpellLoop(Player)HintText:(None)CustomScriptCodeLocalVariablesActionsGeneral-While(Conditions)aretrue,do(Actions)ConditionsAndConditionsPlayerSpellInfo[Player].Right Pressed == true
(Heroes[Player] is alive) == true
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Player Spell Info[Player].Right Mouse Spell Requires Target == true
Then
General - If (Conditions) then do (Actions) else do (Actions)
If
Player Spell Info[Player].Unit Highlighted == true
Then
Unit - Order Heroes[Player] to (Player Spell Info[Player].Right Mouse Spell targeting Player Spell Info
[Player].Highlighted Unit) (Replace Existing Orders)
Else
UI - Display "Need a target!" for (Player group(Player)) to Error area
Sound - Play UI_GenericError (1) for (Player group(Player)) (at 75.0% volume, skip the first 0.0 seconds)
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Player Spell Info[Player].Right Mouse Spell Requires Ground == true
Then
Unit - Order Heroes[Player] to (Player Spell Info[Player].Right Mouse Spell targeting Player Spell Info
[Player].Right Mouse Position) (Replace Existing Orders)
Else
Unit - Order Heroes[Player] to (Player Spell Info[Player].Right Mouse Spell) (Replace Existing Orders)
General - Wait Player Spell Info[Player].Right Mouse Spell Cooldown Real Time seconds
New trigger: Mouse Down Right.
EventsUI-PlayerAnyPlayerclicksRightmousebuttonDown.LocalVariablesMouseClicked=(Point((MouseXpositionclickedintheworld),(MouseYpositionclickedintheworld)))<Point>ConditionsPlayerMoveandAttackInfo[(Triggeringplayer)].Left Pressed == false
Actions
Variable - Set Player Spell Info[(Triggeringplayer)].Right Pressed = true
Variable - Set Player Spell Info[(Triggeringplayer)].Right Mouse Position = Mouse Clicked
Cast Spell Loop((Triggering player))
New trigger: Mouse Up Right.
EventsUI-PlayerAnyPlayerclicksRightmousebuttonUp.LocalVariablesPlayer=(Triggeringplayer)<Integer>ConditionsActionsVariable-SetPlayerSpellInfo[(Triggeringplayer)].Right Pressed = false
General - Wait 0.35 Real Time seconds
Unit - Order Heroes[Player] to ( Stop) (Replace Existing Orders)
You can have as many players as Blizz permits. And yes, the method I am using here should suffer from bnet lag as any WASD/mouse triggers do. However, I did some testing a while back and found it's not that bad... and Blizz is improving it constantly it seems.
Check the array sizes? Need to be big enough for the number of players right? You can always do a UI-text Message to print out the triggering player in that trigger. If it's like -1 or 16 then there's definitely an issue lol.
It's almost perfect however, you need to always hold down to move to a location, is there a way to change that?
Example. In diablo when you click far away like almost full screen, your char, will walk there, I dont need to keep it held, he will walk wherever I clicked, I can keep it held down to keep moving and that is what you do normally but once in awhile you just click a spot like lets say I wanna wait near the den of evil so my friend can see me on the map to find it also, instead of holding down the mouse till I get there, I would just click the spot and go there Small addition, but think it would make it better, and perfect replica :).
Oh that must have been a mistake on my part... I thought it stops when you let go of the mouse. I'm guessing it wouldn't be too much work to modify my code though... just make it not order the Hero to Stop when the mouse button is lifted, rather, order him to the mouse's world position?
I was kinda second guesing myself also, So I went and tried D3 beta then also D2 just to make sure, and ya both let you click far away, and you would run to that location without holding it if you wanted to.
I coudlnt get it to work on your map but I'm extreamly bad at this kinda stuff, want to get into though. If its not that much trouble, and seems like it would be easy, if you have the time could you update it? or another version? for my Xmas present?
I actually think Onetwo's way is better. I am basing my project from his move system. I think its better because some units are extremely hard to click on (moving speedling for example). IMO, it's better to just release the mouse button to stop moving if you mis-click rather than having to click somewhere else. But, to each his own I guess.
Rollback Post to RevisionRollBack
The Team - TnTProductions
TnTProductions latest Project - Docking Bay 13
TnTProductions Epic RPG in the making - Psionics: Chaos Rising
Check out our website on wixx! http://bulletbutter.wix.com/tntproductions
Another wonderful tutorial from OneTwoSC. I hate to beat a dead horse, but given that there is still some lag with this system, would you say its playable on Bnet?
If my memory is right from when I was testing this system, it's definitely playable on Bnet. No it won't be Counter Strike quality latency obviously... but it *should* be okay. Up to you really. Just take the tutorial map and publish it privately and go try it out on bnet :D
I just made my own similar system, and I just did that by adding in an action to make the hero move the the mouse clicked location when the mouse is released.
hi, I have been trying to change the abilities you gain by pressing 1, 2 or 3, it doesn't seem to work for me. If anyone found a way to do it please help me
In this tutorial I show how to make pretty accurate Diablo-type controls. It is mostly a trigger tutorial but some data work has to be done for it.
Please note I don't show UI and stuff like that. Just simply:
Map DL link: Link Removed: http://www.mediafire.com/?bf2ll22jzscnlwa
Text Tutorial
Links to the relevant part of my video tutorial is provided for each step (since this is a very brief/no-explanation text tutorial).
In mine, I am using a new map with players set to 2.
I placed a Zealot for player 1 and 2 and then several zerglings (spread out) for player 15 (Hostile).
Open data editor.
Cameras tab.
Click on Default Camera.
Units tab.
Find and click on Zergling (our monster unit).
Now find/click-on Zealot (our to-be hero unit).
Now in the object explorer for the Zealot, scroll down to his weapon, Zealot - Psi Blades.
Double-Click on Weapon - Scan Filters and uncheck all 4 boxes.
Then scroll back up the object explorer to the top and click on his ability: Ghost - Sniper.
Now double-click on Cost - Cost+.
Now double-click on Stats - Cast Start Time.
Click on his next relevant ability: High Templar - Psi Storm.
Next ability is his Sentry - Guardian Shield one.
Open the trigger editor.
Clear the actions from Melee Initialization first.
Add a new global variable: Heroes = No Unit <Unit[2]>
New folder: Move & Attack
New Record: Move and Attack Info
New folder: Spells
New Record: Spell Info
For my triggers I am just pasting them into here. If you want explanation/back-story watch the video.
Now click back onto Melee Initialization.
Here is the list of actions to make:
Now under the Move & Attack folder:
New trigger: Mouse Down Left.
New trigger: Mouse Up Left.
New trigger: Mouse Moved (Also for Spells).
New trigger: Follow Mouse Loop
New trigger: Unit Clicked
NOW onto the Spells folder!
New trigger: Change to Spell 1 (Psi Storm)
New trigger: Change to Spell 2 (Snipe)
New trigger: Change to Spell 3 (Guardian Shield)
New Action Definition: Cast Spell Loop.
(Note: in the video I missed one action which is the 'Wait' action. I do correct myself later, but it's correctly in the text version below if you need...)
New trigger: Mouse Down Right.
New trigger: Mouse Up Right.
New trigger: Highlight Enemy.
New trigger: Unhighlight Enemy.
That's it, thanks guys. Let me know if you need any explanation :D
Works perfectly fine for me. Only got one question: Will this generate any lag or is there a max player count for this system?
@patrickwobben: Go
You can have as many players as Blizz permits. And yes, the method I am using here should suffer from bnet lag as any WASD/mouse triggers do. However, I did some testing a while back and found it's not that bad... and Blizz is improving it constantly it seems.
Reference which I posted months ago: http://www.sc2mapster.com/forums/development/triggers/20388-diablo-style-mouse-tracking/
Just wanted to thanks alot it's very inspirational.
Please keep up the tutorials they help so much :)
@Fullachain: Go
Np good to know.
Would it be possible to have a work around to make things unselectable/unclickable via something else than changing its flags in the data?
Or a way to reenable said flags. In the event we want to "switch heroes" or alternate between an RTS/RPG mode.
@xcorbo: Go
Well I think some people use a repeatedly running trigger to deselect units while leaving the flags on. I personally preferred turning off the flags.
I Get this error : Trigger Error in 'gt_FollowMouseLoop_Func': Trying to access en element past the end of an array. all spells work but i cant move.
@Zeoxy: Go
Check the array sizes? Need to be big enough for the number of players right? You can always do a UI-text Message to print out the triggering player in that trigger. If it's like -1 or 16 then there's definitely an issue lol.
You were right xD. it works now Thanks! :D and continue to do nice tutorials they are so awesome!
It's almost perfect however, you need to always hold down to move to a location, is there a way to change that? Example. In diablo when you click far away like almost full screen, your char, will walk there, I dont need to keep it held, he will walk wherever I clicked, I can keep it held down to keep moving and that is what you do normally but once in awhile you just click a spot like lets say I wanna wait near the den of evil so my friend can see me on the map to find it also, instead of holding down the mouse till I get there, I would just click the spot and go there Small addition, but think it would make it better, and perfect replica :).
@threeleven: Go
Oh that must have been a mistake on my part... I thought it stops when you let go of the mouse. I'm guessing it wouldn't be too much work to modify my code though... just make it not order the Hero to Stop when the mouse button is lifted, rather, order him to the mouse's world position?
I was kinda second guesing myself also, So I went and tried D3 beta then also D2 just to make sure, and ya both let you click far away, and you would run to that location without holding it if you wanted to.
I coudlnt get it to work on your map but I'm extreamly bad at this kinda stuff, want to get into though. If its not that much trouble, and seems like it would be easy, if you have the time could you update it? or another version? for my Xmas present?
I actually think Onetwo's way is better. I am basing my project from his move system. I think its better because some units are extremely hard to click on (moving speedling for example). IMO, it's better to just release the mouse button to stop moving if you mis-click rather than having to click somewhere else. But, to each his own I guess.
@bulletbutter: Go
That mean it wont ever be changed :( ?
Another wonderful tutorial from OneTwoSC. I hate to beat a dead horse, but given that there is still some lag with this system, would you say its playable on Bnet?
@swanky_yankie: Go
If my memory is right from when I was testing this system, it's definitely playable on Bnet. No it won't be Counter Strike quality latency obviously... but it *should* be okay. Up to you really. Just take the tutorial map and publish it privately and go try it out on bnet :D
@OneTwoSC: Go
how would i implement this to your hero selection tutorial?
i have 4players not 2 , and each heroes have diffrent spells....
- how would i set it up so it work with hero selection. ( one from your tutorial )
- for 4 players
- how do i make it so it knows what spells to give to each hero?( deppending on hero selection )
any help would be apreciated :)
@OneTwoSC: Go
I just made my own similar system, and I just did that by adding in an action to make the hero move the the mouse clicked location when the mouse is released.
hi, I have been trying to change the abilities you gain by pressing 1, 2 or 3, it doesn't seem to work for me. If anyone found a way to do it please help me