[General] Modifying these triggers.

Status
Not open for further replies.
Level 15
Joined
Oct 29, 2012
Messages
1,474
I got these triggers so a unit jumps repeatedly smoothly . Well this is the best 2D jump triggers. But I need them to be working just if a player presses Up button . Any helps please ?
  • Init Constants
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Sound - Play SadMystery <gen>
      • Sound - Set the music list to UndeadX1 <gen>, starting with a random song
      • Sound - Set the music list to OrcX1 <gen>, starting with a random song
      • Set g_Acceleration = 981.00
      • Set h_JumpHight = 640.00
      • Set t_TimeStep = 0.03
      • Set const_X_Speed = 200.00
  • Set Velocity and Position
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 0 to NumberOfJumpers, do (Actions)
        • Loop - Actions
          • Set Jumpers_Y_Velocity[(Integer A)] = (Jumpers_Y_Velocity[(Integer A)] - (g_Acceleration x t_TimeStep))
          • -------- Set the new position --------
          • Unit - Move Jumpers[(Integer A)] instantly to ((Position of Jumpers[(Integer A)]) offset by ((Jumpers_X_Velocity[(Integer A)] x t_TimeStep), (Jumpers_Y_Velocity[(Integer A)] x t_TimeStep)))
  • Horizontal Regions
    • Events
      • Unit - A unit enters H1 <gen>
      • Unit - A unit enters H2 <gen>
      • Unit - A unit enters H3 <gen>
      • Unit - A unit enters H4 <gen>
      • Unit - A unit enters H5 <gen>
      • Unit - A unit enters H6 <gen>
      • Unit - A unit enters H7 <gen>
      • Unit - A unit enters H8 <gen>
      • Unit - A unit enters H9 <gen>
      • Unit - A unit enters H10 <gen>
      • Unit - A unit enters H11 <gen>
      • Unit - A unit enters H12 <gen>
      • Unit - A unit enters H13 <gen>
      • Unit - A unit enters H14 <gen>
      • Unit - A unit enters H15 <gen>
    • Conditions
    • Actions
      • For each (Integer A) from 0 to NumberOfJumpers, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Entering unit) Equal to Jumpers[(Integer A)]
            • Then - Actions
              • -------- Find THE ground (if it hits the ground) --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Jumpers_Y_Velocity[(Integer A)] Less than 0.00
                • Then - Actions
                  • Set Jumpers_Y_Velocity[(Integer A)] = (Square root(((2.00 x g_Acceleration) x h_JumpHight)))
                  • Sound - Play PriestMissileHit1 <gen> at 100.00% volume, attached to Jumpers[(Integer A)]
                  • Sound - Stop (Last played sound) After fading
                • Else - Actions
                  • Set Jumpers_Y_Velocity[(Integer A)] = (0.00 - Jumpers_Y_Velocity[(Integer A)])
                  • Sound - Play DryadMissile2 <gen> at 100.00% volume, attached to Jumpers[(Integer A)]
                  • Sound - Stop (Last played sound) After fading
            • Else - Actions
  • Vertical Regions
    • Events
      • Unit - A unit enters V1 <gen>
      • Unit - A unit enters V2 <gen>
      • Unit - A unit enters V3 <gen>
      • Unit - A unit enters V4 <gen>
      • Unit - A unit enters V5 <gen>
      • Unit - A unit enters V6 <gen>
    • Conditions
    • Actions
      • For each (Integer A) from 0 to NumberOfJumpers, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Entering unit) Equal to Jumpers[(Integer A)]
            • Then - Actions
              • Set Jumpers_X_Velocity[(Integer A)] = (0.00 - Jumpers_X_Velocity[(Integer A)])
              • Sound - Play NecromancerMissileHit1 <gen> at 100.00% volume, attached to Jumpers[(Integer A)]
              • Sound - Stop (Last played sound) After fading
            • Else - Actions
Please help . The triggers are in the attachment .
 

Attachments

  • TestyMap.w3x
    18.8 KB · Views: 41
Level 15
Joined
Oct 29, 2012
Messages
1,474
stop using integer A/B also stop using entering unit.
use ur own integer. use triggering unit. they are both faster and more efficient than wat u r using.
Eh ! I forgot them because I was using them since a long time . However thank you for this info .
just use the player presses up arrow event. then trigger ur actions. if he needs to be in the region to jump then do a boolean check and check if triggering unit is in region

Well That's my problem . When pressing up ,I create a boolean . But this sytem is actually made when the unit jumps repeatedly . I can't stop them because I don't understand how his mathimatic functions go . If it was a flying height system , I would use Power^2 function . Bah , This is a movement system from point (X,Y) to another .
I would be very happy if some one makes it work when A PLAYER PRESSES up button . I give +rep , and I mention in credits .
 
well u need a trigger that runs on player presses up button to jump. then u need a trigger that stops the unit from jumping preferably a trigger that runs when player depresses the up button.

u should make ur own system it would be a lot better. u could manage it exactly how u want to do it.

i cant get on pc to be able to modify someones triggers. thats y i say to make ur own. u will learn and then if u get stuck someone will be able to help
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Alright . I really want to make my own system . The jump should look like ( Power ^2 Graphic's Design ) so smooth. I tried hard , I don't how to have this done by using ' Unit - Move Unit Instantly ). But in the triggers I've posted . There what I wanted to see . But I don't know how to change the maths values to make it fit 'Player - Pressed Up ' event .
 
press up to jump change a boolean to true. then move the unit in a jump motion. when player touches the ground check for a boolean. if true continue jump.
when player depresses jump button turn boolean to false.

u will need 3 triggers. one that activates when button is pressed. this one changes boolean and indexes the unit to be jumped. then turns on loop trigger.
the next is the depresses which only changes boolean to false.
the third and final trigger is the loop. this one acts like a spell trigger. u have the indexed units that are jumping so u move them here. then when unit touches ground u de-index that unit.
 

sentrywiz

S

sentrywiz

Why don't you make the event on "Player X releases the Up Key"

That way you avoid all repeatable jumps until the player presses and releases the up key again.
 

sentrywiz

S

sentrywiz

If the player i still pressing on Up button . He will jump repeatedly . When he releases it . The unit stops in the air ...

Make the event "Player releases the up key"

Then simple put a boolean var for example "InAir[Player Number] = true" and put the same requirement on this event so it would be like:

Event - Release Up Key
Conditions - If InAir[X] != true
Actions - Do all jump actions

At the end of the jump trigger, set the InAir[X] = false
This way players can't mash the up button and jump repeatedly until they finish the jump started.
 
^ that is y i said all of this. This is exactly wat u need

press up to jump change a boolean to true. then move the unit in a jump motion. when player touches the ground check for a boolean. if true continue jump.
when player depresses jump button turn boolean to false.

u will need 3 triggers. one that activates when button is pressed. this one changes boolean and indexes the unit to be jumped. then turns on loop trigger.
the next is the depresses which only changes boolean to false.
the third and final trigger is the loop. this one acts like a spell trigger. u have the indexed units that are jumping so u move them here. then when unit touches ground u de-index that unit.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
I don't think it's easy to explain . The Problem is in the 'loop' trigger . I made booleans and everythings starts good . But , The jump loop trigger doesn't work as I want . It's made by another guy where the unit is created in the air ( far from the ground even its 2D) . Then the unit starts falling first . But What i need that when a player presses Up . the unit jumps above . This seems to be working nicely ( it's the jump system that is repeated once the unit touches the ground ). I gave it a boolean . and when a player presses up . the unit moves in the opposite angle ( down ) . I tried to make the constants negative . but it makes it unreal . where the unit jumps with an ascending speed instead of a descending speed . then the unit falls slowly . Shit , It sounds that I won't solve this . LOOK TRIGGERS :
  • Init Constants
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each Integer Variable from 1 to 4, do (Actions)
        • Loop - Actions
          • Set g_Acceleration[Integer] = 1.00
          • Set h_JumpHight[Integer] = 140.00
          • Set t_TimeStep[Integer] = 0.03
          • Set const_X_Speed[Integer] = 200.00
  • Jump On
    • Events
      • Player - Player 1 (Red) Presses the Up Arrow key
      • Player - Player 2 (Blue) Presses the Up Arrow key
      • Player - Player 3 (Teal) Presses the Up Arrow key
      • Player - Player 4 (Purple) Presses the Up Arrow key
    • Conditions
    • Actions
      • -------- Checks so the player is standing at stable ground: --------
      • Set _tempPointJE_2D = (Position of _Hero_2D[(Player number of (Triggering player))])
      • Set _tempPointJE2_2D = (_tempPointJE_2D offset by _BlockDistance2_2D towards _AngleGravity_2D[(Player number of (Triggering player))] degrees)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain type at _tempPointJE2_2D) Equal to _GroundStable_2D
        • Then - Actions
          • Set _Jumper_Boolean[(Player number of (Triggering player))] = True
          • Set _TimerJump_2D[(Player number of (Triggering player))] = _HeightJump_2D
          • Sound - Play player_jump <gen> at 100.00% volume, attached to _Hero_2D[(Player number of (Triggering player))]
          • Custom script: call SetUnitAnimationByIndex(udg__Hero_2D[GetConvertedPlayerId(GetTriggerPlayer())], 9)
        • Else - Actions
      • -------- -------------------------------------------------- Remove Leaks ----------------------------------------- --------
      • Custom script: call RemoveLocation( udg__tempPointJE_2D )
      • Custom script: call RemoveLocation( udg__tempPointJE2_2D )
  • Jump Off
    • Events
      • Player - Player 1 (Red) Releases the Up Arrow key
      • Player - Player 2 (Blue) Releases the Up Arrow key
      • Player - Player 3 (Teal) Releases the Up Arrow key
      • Player - Player 4 (Purple) Releases the Up Arrow key
    • Conditions
    • Actions
      • Set _Jumper_Boolean[(Player number of (Triggering player))] = False
  • Set Velocity and Position
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set _JUMPINGp_2D = 1
      • For each Integer2 Variable from 0 to NumberOfJumpers, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • _Jump_2D[_JUMPINGp_2D] Equal to True
            • Then - Actions
              • Set TempJumperPoint[_JUMPINGp_2D] = (Position of _Hero_2D[_JUMPINGp_2D])
              • Set Jumpers_Y_Velocity[_JUMPINGp_2D] = (Jumpers_Y_Velocity[_JUMPINGp_2D] - (g_Acceleration[_JUMPINGp_2D] x t_TimeStep[_JUMPINGp_2D]))
              • -------- Set the new position --------
              • Unit - Move _Hero_2D[_JUMPINGp_2D] instantly to (TempJumperPoint[_JUMPINGp_2D] offset by ((Jumpers_X_Velocity[_JUMPINGp_2D] x t_TimeStep[_JUMPINGp_2D]), (Jumpers_Y_Velocity[_JUMPINGp_2D] x t_TimeStep[_JUMPINGp_2D])))
              • Custom script: call RemoveLocation(udg_TempJumperPoint[udg__JUMPINGp_2D])
            • Else - Actions
      • Set _JUMPINGp_2D = (_JUMPINGp_2D + 1)

WHAT IS WRONG IN THE TRIGGERS ABOVE? The Unit jumps in 270 angle instead of 90 . other thing . making the values negative makes it worse . Please help . If there is any math function for this , let me know thanks .
 
Status
Not open for further replies.
Top