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

[Solved] BlzGetTriggerPlayerMouse problems

Status
Not open for further replies.
Level 20
Joined
Jul 12, 2010
Messages
1,717
alright guys so I'm having problems with these:

native BlzGetTriggerPlayerMouseX
native BlzGetTriggerPlayerMouseY
native BlzGetTriggerPlayerMousePosition

Triggers for testing:
  • Test
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blink
    • Actions
      • Custom script: set udg_Point = BlzGetTriggerPlayerMousePosition()
      • Special Effect - Create a special effect at Point using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit - Move (Triggering unit) instantly to Point
      • Custom script: call RemoveLocation(udg_Point)

I guess I must be using it wrong?

Because this doesn't work either:
  • Test 2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blink 2
    • Actions
      • Custom script: set udg_X = BlzGetTriggerPlayerMouseX()
      • Custom script: set udg_Y = BlzGetTriggerPlayerMouseY()
      • Set VariableSet Point = (Point(X, Y))
      • Special Effect - Create a special effect at Point using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit - Move (Triggering unit) instantly to Point
      • Custom script: call RemoveLocation(udg_Point)
They fail to get mouse position or X/Y and instead return center of playable map.

Only when using it with a mouse detection system I can get it to work:
  • Detect Mouse
    • Events
      • Player - Player 1 (Red) issues Mouse Move event
    • Conditions
    • Actions
      • Set VariableSet PlayerMouse_X = (Mouse Position X for Triggered Mouse Event)
      • Set VariableSet PlayerMouse_Y = (Mouse Position Y for Triggered Mouse Event)
  • Test 3
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blink 3
    • Actions
      • Set VariableSet Point = (Point(PlayerMouse_X, PlayerMouse_Y))
      • Special Effect - Create a special effect at Point using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit - Move (Triggering unit) instantly to Point
      • Custom script: call RemoveLocation(udg_Point)

So I guess it's an easy work-around to have a system save the X/Y of the mouse and just use that when you have to but I was wondering if there is a way to just get the X/Y only when needed.

I'm also afraid of performance issues when saving X/Y of all players when there is a mouse move because that's pretty much all the time when playing.
 

Attachments

  • Blink Test.w3m
    12.9 KB · Views: 30
Level 6
Joined
Aug 28, 2015
Messages
213
it's how blizz always handled their things, it's like to try to get triggering unit by a multieboard button press event will return nothing too.
to the performance I don't really think this will have to much of an impact to change 2 real values...
If you still too concerned about it you could add buffer like min distance or refresh interval, I would start a timer that sets a in the move event checked Boolean back or something like this.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
I guess I must be using it wrong?
Yes. The mouse event responses make no sense for that event. There was no mouse event issued for it to return the X/Y/Position of.
They fail to get mouse position or X/Y and instead return center of playable map.
The mouse event responses make no sense for that event. There was no mouse event issued for it to return the X/Y/Position of.
Only when using it with a mouse detection system I can get it to work:
Yes because then the event response makes sense. It is designed to go with the mouse event to return data about the event.

The reason for this is because the mouse coordinates have to be synchronized. The event handles all that.
 
Level 18
Joined
Jan 1, 2018
Messages
728
I think you're looking for these:
JASS:
constant native GetSpellTargetLoc           takes nothing returns location
constant native GetSpellTargetX				takes nothing returns real
constant native GetSpellTargetY				takes nothing returns real
 
Level 6
Joined
Aug 28, 2015
Messages
213
2 reals is not a big deal but with full players it's 24x2 = 48 reals getting updated every millisecond (give or take)
True and I'm not that much into all the behind the scenes to know how often the xy gets updated but I'm still pretty confident that the computer we use nowadays are more then good to handle the worst case of 48 reals variables.

I understand that more efficient and streamlined is wishful but in the end having something working is the best result and the most of the times people breaking their head over the less important point.
For me have nice code doesn't mean have the fastest executive one it's for me have the one that is the best human and machine interpretationable one, where you can build on top of or even find a better solution and refactore it after you gained more knowledge.
 
Status
Not open for further replies.
Top