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

Pressed and REleased bottons

Status
Not open for further replies.
Level 3
Joined
Apr 9, 2008
Messages
45
I need a manual that explain about the "Player - Player 1 (Red) Releases the Right Arrow key".

Well, it triggers when you release the right arrow key, thus if you press it nothing happens but if you release it (when the button goes up) it triggers.

And i didn't understand the other question.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
What exactly do you want to do? It's difficult to help when one does not know what should be done. Anyway:

  • Trigger 012
    • Events
      • Player - Player 1 (Red) Presses the Left Arrow key
    • Conditions
    • Actions
      • Set Temp_Boolean_1 = True
^Do the same for right arrow, but set Temp_Boolean_2 = true.

Then do the same but for "Player 1 releases left/right arrow key" and set the booleans to false.

Then you have a fifth trigger:

  • Trigger 013
    • Events
    • Conditions
      • Temp_Boolean Equal to True
      • Temp_Boolean_2 Equal to True
    • Actions
Add some event, and the trigger fires if both left- and right arrows are pressed.
 
Thanks for all the guys that helped even thou the massage was massed up.
I want a page that explain everything you can do with Press and Release.
And i want to make it so the player has to press Right and Left, if he does not press anything the hero will take damage, and if he press Any other sequence it will make other action.
The problem is: it need to check 4 players so when i do it, there are 16 triggers working (player 1 up left right down, player 2 , 3 , 4) and I want to make least triggers on as possible.
Note: this triggers will work for 5 seconds on and after go off, so there will be no lag on this thing, only about turning on and off 16 triggers at the same time.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Do it with arrays:

  • Untitled Trigger 012 Copy 2
    • Events
      • Player - Player 1 (Red) Presses the Right Arrow key
      • Player - Player 2 (Blue) Presses the Right Arrow key
      • Player - Player 3 (Teal) Presses the Right Arrow key
    • Conditions
    • Actions
      • Set Temp_Boolean_Array[(Player number of (Triggering player))] = True
 
Level 3
Joined
Apr 9, 2008
Messages
45
I was thinking about doing it this way:
  • Untitled Trigger 004 Copy
    • Events
      • Player - Player 1 (Red) Releases the Left Arrow key
      • Player - Player 1 (Red) Releases the Right Arrow key
      • Player - Player 2 (Blue) Releases the Right Arrow key
      • Player - Player 2 (Blue) Releases the Left Arrow key
      • Player - Player 3 (Teal) Releases the Right Arrow key
      • Player - Player 3 (Teal) Releases the Left Arrow key
      • Player - Player 4 (Purple) Releases the Left Arrow key
      • Player - Player 4 (Purple) Releases the Right Arrow key
    • Conditions
    • Actions
      • Trigger - Turn on red <gen>
  • Untitled Trigger 004
    • Events
      • Player - Player 1 (Red) Presses the Left Arrow key
      • Player - Player 1 (Red) Presses the Right Arrow key
      • Player - Player 2 (Blue) Presses the Right Arrow key
      • Player - Player 2 (Blue) Presses the Left Arrow key
      • Player - Player 3 (Teal) Presses the Right Arrow key
      • Player - Player 3 (Teal) Presses the Left Arrow key
      • Player - Player 4 (Purple) Presses the Left Arrow key
      • Player - Player 4 (Purple) Presses the Right Arrow key
    • Conditions
    • Actions
      • Trigger - Turn off red <gen>
Of course make the action 4 if/then/else functions, but you should be able to do that :)

Demo map attached, but you still have to make the if/then/else function.
 

Attachments

  • something.w3x
    17.9 KB · Views: 40
Level 4
Joined
Oct 18, 2007
Messages
99
Both of you were very creative in this.
I will need both ways for my map.

I still need to make those all triggers work on and off at the same time, I have heard something about a trigger quake , will it help? or there is another way? (16 triggers because of 4 players and +4 for any extra)

Thanks for read.
 
here is a jass code: (rename KM_UP;KM_Down;...)

JASS:
function Trig_Arrows_LEFT_DOWN takes nothing returns nothing
	set udg_KM_Left[GetPlayerId(GetTriggerPlayer())+1] = true
endfunction

function Trig_Arrows_LEFT_UP takes nothing returns nothing
	set udg_KM_Left[GetPlayerId(GetTriggerPlayer())+1] = false
endfunction

function Trig_Arrows_RIGHT_DOWN takes nothing returns nothing
	set udg_KM_Right[GetPlayerId(GetTriggerPlayer())+1] = true
endfunction

function Trig_Arrows_RIGHT_UP takes nothing returns nothing
	set udg_KM_Right[GetPlayerId(GetTriggerPlayer())+1] = false
endfunction

function Trig_Arrows_DOWN_DOWN takes nothing returns nothing
	set udg_KM_Down[GetPlayerId(GetTriggerPlayer())+1] = true
endfunction

function Trig_Arrows_DOWN_UP takes nothing returns nothing
	set udg_KM_Down[GetPlayerId(GetTriggerPlayer())+1] = false
endfunction

function Trig_Arrows_UP_DOWN takes nothing returns nothing
	set udg_KM_Up[GetPlayerId(GetTriggerPlayer())+1] = true
endfunction

function Trig_Arrows_UP_UP takes nothing returns nothing
	set udg_KM_Up[GetPlayerId(GetTriggerPlayer())+1] = false
endfunction

function Trig_Arrows_CreateTrigger takes code actionFunc, playerevent eventId returns nothing
	local trigger t = CreateTrigger()
	local integer PlayerId = 0
	call TriggerAddAction(t, actionFunc)
	loop
		exitwhen PlayerId > 11
		call TriggerRegisterPlayerEvent(t, Player(PlayerId), eventId)
		set PlayerId = PlayerId + 1
	endloop
	set t = null
endfunction

//===========================================================================
function InitTrig_Arrows takes nothing returns nothing
	call Trig_Arrows_CreateTrigger(function Trig_Arrows_LEFT_DOWN, EVENT_PLAYER_ARROW_LEFT_DOWN)
	call Trig_Arrows_CreateTrigger(function Trig_Arrows_LEFT_UP, EVENT_PLAYER_ARROW_LEFT_UP)
	call Trig_Arrows_CreateTrigger(function Trig_Arrows_RIGHT_DOWN, EVENT_PLAYER_ARROW_RIGHT_DOWN)
	call Trig_Arrows_CreateTrigger(function Trig_Arrows_RIGHT_UP, EVENT_PLAYER_ARROW_RIGHT_UP)
	call Trig_Arrows_CreateTrigger(function Trig_Arrows_DOWN_DOWN, EVENT_PLAYER_ARROW_DOWN_DOWN)
	call Trig_Arrows_CreateTrigger(function Trig_Arrows_DOWN_UP, EVENT_PLAYER_ARROW_DOWN_UP)
	call Trig_Arrows_CreateTrigger(function Trig_Arrows_UP_DOWN, EVENT_PLAYER_ARROW_UP_DOWN)
	call Trig_Arrows_CreateTrigger(function Trig_Arrows_UP_UP, EVENT_PLAYER_ARROW_UP_UP)
endfunction
 
Level 12
Joined
Mar 10, 2008
Messages
869
Yeah, rewrite the InitTrig_Arrows and its events to suit your trigger's needs.
That trigger's name is "Arrows", if you can't be bothered editing it then rename your trigger to "Arrows".

Anyway, hell gate, why would he need that?
best_player is probably importing that, knowing nothing of what it is doing or trying to do.
 
Status
Not open for further replies.
Top