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

[Spell] Combat System

Status
Not open for further replies.
Level 12
Joined
Feb 11, 2008
Messages
809
I am making a new combat system to mimic the one in the pokemon games so far it is working out quite well and is looking great but for some reason whenever i run my test trigger for the first time it lags for like 5 seconds before you can use your arrow keys and i cant figure out why. heres my triggers;

  • Combat Start
    • Events
      • Player - Player 1 (Red) types a chat message containing -test as An exact match
    • Conditions
    • Actions
      • Set TriggerPlayer = (Player number of (Triggering player))
      • Set InCombat[TriggerPlayer] = True
      • Set TargetPokemon[TriggerPlayer] = (Random unit from (Units owned by Player 5 (Yellow)))
      • Player Group - Remove (Triggering player) from TriggerPlayerGroup[0]
      • Player Group - Add (Triggering player) to TriggerPlayerGroup[1]
      • Cinematic - Turn cinematic mode On for TriggerPlayerGroup[1]
      • Cinematic - Enable user control for TriggerPlayerGroup[1]
      • Cinematic - Send transmission to TriggerPlayerGroup[1] from a (Triggering player) (Unit-type of TrainersHero[TriggerPlayer]) named (Name of TrainersHero[TriggerPlayer]) at (Center of (Playable map area)): Play No sound and display CombatText[0]. Modify duration: Add 0.00 seconds and Wait
      • Trigger - Add to Combat Controller <gen> the event (Player - (Triggering player) Presses the Left Arrow key)
      • Trigger - Add to Combat Controller <gen> the event (Player - (Triggering player) Presses the Right Arrow key)
      • Trigger - Add to Combat Controller <gen> the event (Player - (Triggering player) Presses the Down Arrow key)
      • Trigger - Add to Combat Controller <gen> the event (Player - (Triggering player) Presses the Up Arrow key)
      • Trigger - Add to Combat Option <gen> the event (Player - (Triggering player) skips a cinematic sequence)
  • Combat Controller
    • Events
    • Conditions
      • InCombat[(Player number of (Triggering player))] Equal to (==) True
    • Actions
      • Set TriggerPlayer = (Player number of (Triggering player))
      • -------- Moving Left --------
      • Custom script: if GetTriggerEventId() == EVENT_PLAYER_ARROW_LEFT_DOWN then
      • Set CombatIndex[TriggerPlayer] = (CombatIndex[TriggerPlayer] - 1)
      • Custom script: endif
      • -------- Moving Right --------
      • Custom script: if GetTriggerEventId() == EVENT_PLAYER_ARROW_RIGHT_DOWN then
      • Set CombatIndex[TriggerPlayer] = (CombatIndex[TriggerPlayer] + 1)
      • Custom script: endif
      • -------- Moving Down --------
      • Custom script: if GetTriggerEventId() == EVENT_PLAYER_ARROW_DOWN_DOWN then
      • Set CombatIndex[TriggerPlayer] = (CombatIndex[TriggerPlayer] + 2)
      • Custom script: endif
      • -------- Moving Up --------
      • Custom script: if GetTriggerEventId() == EVENT_PLAYER_ARROW_UP_DOWN then
      • Set CombatIndex[TriggerPlayer] = (CombatIndex[TriggerPlayer] - 2)
      • Custom script: endif
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CombatIndex[TriggerPlayer] Less than (<) 0
          • Then - Actions
            • Set CombatIndex[TriggerPlayer] = 0
          • Else - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • CombatIndex[TriggerPlayer] Greater than (>) 3
              • Then - Actions
                • Set CombatIndex[TriggerPlayer] = 3
              • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CombatIndex[TriggerPlayer] Equal to (==) 0
          • Then - Actions
            • Cinematic - Send transmission to TriggerPlayerGroup[1] from a (Triggering player) (Unit-type of TrainersHero[TriggerPlayer]) named (Name of TrainersHero[TriggerPlayer]) at (Center of (Playable map area)): Play No sound and display CombatText[0]. Modify duration: Add 0.00 seconds and Wait
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CombatIndex[TriggerPlayer] Equal to (==) 1
          • Then - Actions
            • Cinematic - Send transmission to TriggerPlayerGroup[1] from a (Triggering player) (Unit-type of TrainersHero[TriggerPlayer]) named (Name of TrainersHero[TriggerPlayer]) at (Center of (Playable map area)): Play No sound and display CombatText[1]. Modify duration: Add 0.00 seconds and Wait
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CombatIndex[TriggerPlayer] Equal to (==) 2
          • Then - Actions
            • Cinematic - Send transmission to TriggerPlayerGroup[1] from a (Triggering player) (Unit-type of TrainersHero[TriggerPlayer]) named (Name of TrainersHero[TriggerPlayer]) at (Center of (Playable map area)): Play No sound and display CombatText[2]. Modify duration: Add 0.00 seconds and Wait
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CombatIndex[TriggerPlayer] Equal to (==) 3
          • Then - Actions
            • Cinematic - Send transmission to TriggerPlayerGroup[1] from a (Triggering player) (Unit-type of TrainersHero[TriggerPlayer]) named (Name of TrainersHero[TriggerPlayer]) at (Center of (Playable map area)): Play No sound and display CombatText[3]. Modify duration: Add 0.00 seconds and Wait
          • Else - Actions
  • Combat Option
    • Events
    • Conditions
      • InCombat[(Player number of (Triggering player))] Equal to (==) True
    • Actions
      • Set TriggerPlayer = (Player number of (Triggering player))
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CombatIndex[TriggerPlayer] Equal to (==) 0
          • Then - Actions
            • Animation - Play (First unit of group MainPokemon[TriggerPlayer])'s attack animation
            • Cinematic - Send transmission to TriggerPlayerGroup[1] from a (Triggering player) (Unit-type of TrainersHero[TriggerPlayer]) named (Name of TrainersHero[TriggerPlayer]) at (Center of (Playable map area)): Play No sound and display CombatText[0]. Modify duration: Add 0.00 seconds and Wait
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CombatIndex[TriggerPlayer] Equal to (==) 1
          • Then - Actions
            • Cinematic - Send transmission to TriggerPlayerGroup[1] from a (Triggering player) (Unit-type of TrainersHero[TriggerPlayer]) named (Name of TrainersHero[TriggerPlayer]) at (Center of (Playable map area)): Play No sound and display CombatText[1]. Modify duration: Add 0.00 seconds and Wait
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CombatIndex[TriggerPlayer] Equal to (==) 2
          • Then - Actions
            • Unit - Order TrainersHero[TriggerPlayer] to Human Blood Mage - Banish TargetPokemon[TriggerPlayer]
            • Cinematic - Send transmission to TriggerPlayerGroup[1] from a (Triggering player) (Unit-type of TrainersHero[TriggerPlayer]) named (Name of TrainersHero[TriggerPlayer]) at (Center of (Playable map area)): Play No sound and display CombatText[2]. Modify duration: Add 0.00 seconds and Wait
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CombatIndex[TriggerPlayer] Equal to (==) 3
          • Then - Actions
            • Set InCombat[(Player number of (Triggering player))] = False
            • Set CombatIndex[TriggerPlayer] = 0
            • Cinematic - Turn cinematic mode Off for TriggerPlayerGroup[1]
            • Player Group - Remove (Triggering player) from TriggerPlayerGroup[1]
            • Cinematic - Send transmission to TriggerPlayerGroup[1] from a (Triggering player) (Unit-type of TrainersHero[TriggerPlayer]) named (Name of TrainersHero[TriggerPlayer]) at (Center of (Playable map area)): Play No sound and display CombatText[3]. Modify duration: Add 0.00 seconds and Wait
          • Else - Actions
please and thank you if someone can help me figure this out!

also the CombatText[] are all set in the map init trigger so you will not see them being set.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Well you don't have to add the events every time there is a battle (you should do this at map init and turn on/off the trigger if there's a battle, leave boolean check as it is).

You do have location leaks, but those should only slow down the game after a while, they don't really cause lag spikes (you still have to fix those though :p).
Maybe it's the objects, though you seemingly don't manipulate them in those triggers.
Would you mind uploading the map?
 
Level 12
Joined
Feb 11, 2008
Messages
809
Well you don't have to add the events every time there is a battle (you should do this at map init and turn on/off the trigger if there's a battle, leave boolean check as it is).

You do have location leaks, but those should only slow down the game after a while, they don't really cause lag spikes (you still have to fix those though :p).
Maybe it's the objects, though you seemingly don't manipulate them in those triggers.
Would you mind uploading the map?

I cant upload the map but i will pm you a pastebin with the map.
 
Status
Not open for further replies.
Top