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

Improving spawn/combat system.

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
See, I have this. It's my combat system. I made it thinking of console RPG gameplay, where all the units are in battle, and all of them are always together.

When a unit enters a 'Danger' area, it's added to that area group (Wood[0]). And units in that group have a chance to engage combat with WoodCreeps.

The thing is, this system works with groups. If there's 1 hero standing in the combat area, the rest can walk through the Woods without engaging combat, since there's already people in combat. I can't think of a way to avoid that, so players can engage combat even if there's people already in combat without abusing this.

  • Unit enters Wood
    • Events
      • Unit - A unit enters WoodActv <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • ((Triggering unit) is in Wood[0]) Equal to False
    • Actions
      • Set TempForce = (Player group((Triggering player)))
      • Unit Group - Add (Triggering unit) to Wood[0]
      • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
      • Custom script: call ClearTextMessages()
      • Game - Display to TempForce the text: Entering: |cfffff70...
      • Custom script: endif
      • Custom script: call DestroyForce(udg_TempForce)
It adds the hero to Wood[0].

  • Combat System
    • Events
      • Time - SpawnTimer expires
    • Conditions
    • Actions
      • -------- WOOD --------
      • Set Wood[1] = (Units in WoodCombat <gen> matching (((Owner of (Matching unit)) Equal to Neutral Hostile) and (((Matching unit) is alive) Equal to True)))
      • Set Wood[2] = (Units in WoodCombat <gen> matching (((Matching unit) is A Hero) Equal to True))
      • Set Wood[3] = (Units in WoodEscape <gen> matching (((Matching unit) is A Hero) Equal to True))
      • Floating Text - Change text of TexTags[1] to (Creeps Left: + ( |cffffd700 + ((String((Number of units in Wood[1]))) + |r))) using font size 10.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to (Random integer number between 0 and (12 + (2 x (Number of units in Wood[0]))))
          • (Number of units in Wood[2]) Equal to 0
        • Then - Actions
          • Unit Group - Pick every unit in Wood[0] and do (Actions)
            • Loop - Actions
              • Set A = (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (A has buff Safety ) Equal to False
                  • (A has buff Dead ) Equal to False
                • Then - Actions
                  • Set TempPlayer = (Owner of A)
                  • Set Temp_Int = (Player number of TempPlayer)
                  • Set Temp_HeroPos[Temp_Int] = (Position of A)
                  • Set Temp_RandomHeroSpawn[Temp_Int] = (Random point in WoodSpawn <gen>)
                  • Unit - Move A instantly to Temp_RandomHeroSpawn[Temp_Int]
                  • Custom script: if GetLocalPlayer() == udg_TempPlayer then
                  • Sound - Play DamnBeasts <gen>
                  • Custom script: endif
                  • Unit Group - Remove A from Wood[0]
                  • Unit Group - Add A to Wood[2]
                • Else - Actions
              • Custom script: call RemoveLocation(udg_Temp_RandomHeroSpawn[udg_Temp_Int])
          • -------- Spawning the Creeps --------
          • For each (Integer A) from 1 to (Random integer number between 1 and 3), do (Actions)
            • Loop - Actions
              • Set Temp_PointArray[1] = (Random point in WoodSpawn <gen>)
              • Unit - Create 1 WoodCreeps[(Random integer number between 1 and 9)] for Neutral Hostile at Temp_PointArray[1] facing Default building facing degrees
              • Custom script: call RemoveLocation(udg_Temp_PointArray[1])
        • Else - Actions
      • -------- WOOD CLEANING --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Number of units in Wood[2]) Equal to (Number of units in Wood[3])
              • (Number of units in Wood[2]) Equal to 0
        • Then - Actions
          • Unit Group - Pick every unit in Wood[2] and do (Actions)
            • Loop - Actions
              • Set A = (Picked unit)
              • Set TempPlayer = (Owner of A)
              • Set Temp_Int = (Player number of TempPlayer)
              • Unit - Move A instantly to Temp_HeroPos[Temp_Int]
              • Unit - Create 1 DummySafetyCaster for Neutral Passive at Temp_HeroPos[Temp_Int] facing Default building facing degrees
              • Unit - Order (Last created unit) to Human Priest - Inner Fire A
              • Unit - Remove (Last created unit) from the game
              • Custom script: call RemoveLocation(udg_Temp_HeroPos[udg_Temp_Int])
              • Unit Group - Remove A from Wood[2]
              • Unit Group - Add A to Wood[0]
          • Unit Group - Pick every unit in Wood[1] and do (Actions)
            • Loop - Actions
              • Unit - Remove (Picked unit) from the game
          • Item - Pick every item in WoodCombat <gen> and do (Actions)
            • Loop - Actions
              • Item - Remove (Picked item)
          • Destructible - Pick every destructible in WoodCombat <gen> and do (Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Hide birth animation)
        • Else - Actions
      • -------- WOOD LEAKS --------
      • Custom script: call DestroyGroup(udg_Wood[1])
      • Custom script: call DestroyGroup(udg_Wood[2])
      • Custom script: call DestroyGroup(udg_Wood[3])
If you wan't to check how it works, you can download the Gsu'h Will RPG (Beta) in my signature, go through the first easy quest and enter the woods. (There's a desync with the first quest I'm working on, so... can only be tested with 1 player)
 
Status
Not open for further replies.
Top