• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

Keyboard Events

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2013
Messages
1,105
I'm having a problem with my trigger and I'm not entirely sure why it doesn't work. I believe Owner of OwnerDetector 0013 <gen> Presses the Up Arrow Key is not working. Because I put a Print message to test and it wasn't firing, but I don't know why.

  • Mana Ball
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mana Ball
    • Actions
      • Set ManaBall_Caster = (Casting unit)
      • Set ManaBall_DetectOwner = (Owner of ManaBall_Caster)
      • Unit - Change ownership of OwnerDetector 0013 <gen> to ManaBall_DetectOwner and Change color
      • Unit - Create 1 Ball for (Owner of ManaBall_Caster) at ((Position of ManaBall_Caster) offset by 100.00 towards 90 degrees) facing Default building facing degrees
      • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
      • Set ManaBall_Dummy = (Last created unit)
      • Camera - Lock camera orientation for (Owner of ManaBall_Caster) to ManaBall_Dummy, offset by (0.00, 0.00)
      • Wait 0.10 seconds
      • Trigger - Turn on Mana Ball Up <gen>
      • Wait 10.00 seconds
      • Unit - Change ownership of OwnerDetector 0013 <gen> to Neutral Passive and Change color
      • Trigger - Turn off Mana Ball Up <gen>
  • Mana Ball Up
    • Events
      • Player - (Owner of OwnerDetector 0013 <gen>) Presses the Up Arrow key
    • Conditions
    • Actions
      • Unit - Move ManaBall_Dummy instantly to ((Position of ManaBall_Dummy) offset by 12.00 towards 90.00 degrees)
 
Level 17
Joined
Aug 19, 2007
Messages
1,380
I am a bit tired so excuse me if I overlook something obvious. But maybe you are holding the up arrow key while the trigger Mana Ball Up is still turned off, instead of pressing the up arrow key as soon as the trigger Mana Ball Up is turned on (so release it and than press it). Try tapping the up arrow key very fast, as see if that does something.

Also positions leak (move to) and the offset leaks too.
 
Level 6
Joined
Oct 1, 2012
Messages
166
He said that the trigger doesn't work at all, as he said he made debug massages and they did not show up.

I can't see the problem, but I'd recommend making debug triggers like -debug massage returning index of player being the owner of OwnerDetector 0013 <gen>, maybe there's the problem.

Debug massages are very helpful, I use the all the time.
 
Level 5
Joined
Jun 14, 2009
Messages
106
Events are predefined from the start of the game, i.e. they are defined before any trigger runs. So even if you define OwnerDetector in another trigger, its value in the event will still be null and the second trigger will not work. That is the reason why the game does not let you use your own variables for units in events.

You can either bypass this by referring directly to the player, or use the add event action in the first trigger to create the event after you defined the unit in the second trigger. I'd recommend the former as I don't think there is a way to remove events after you add them.
 
Status
Not open for further replies.
Top