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

[Trigger] Some Questions

Status
Not open for further replies.
Level 9
Joined
Jul 24, 2007
Messages
308
i have some questions and mostly about leaks, they are:
1 - should i type: Custom script:
  • Custom script: set bj_wantDestroyGroup = false
after i want to stop it from destroying groups?

2 - why does this location be removed and become center of playable map area (this be used many times in game) :
  • Set CameraLoc = Region
  • Player Group - Pick every player in (All players matching (((Matching player) slot status) Equal to Is playing)) and do (Actions)
    • Loop - Actions
      • Unit - Create 1 Just Another Unit for (Picked player) at (Random point in CameraLoc) facing 180.00 degrees
      • Set UnitV[(Player number of (Picked player))] = (Last created unit)
  • Custom script: call RemoveRect(udg_CameraLoc)
the variable CameraLoc becomes center of playable map area on 2nd use! should i make it array or..?

3 - how to enable/disable sending signals being displayed on minimap in-game?
 
Last edited:
Level 6
Joined
Mar 2, 2006
Messages
306
1) setting bj_wantDestroyGroup to true only affects ONE bj-function call. it is then reset to false and you need to set it to true again for the next call. no effect on native functions.

2) ouch. that is just wrong. first of all, you leak a player group (natively called "force") which should have been saved and destroyed with DestroyForce. then you leak a point (created from a region) in unit create call. save it and destroy it with RemoveLocation function.

so should you remove the region (=rect) in the end? depends. if (in first line) you assigned a function result (=newly created object) to it, then yes. if you assigned an existing region to it, then no. that's what "fixing leaks" is.

up there, "Random point in someregion" is a function that returns a point (also called location). also, "All players matching somecondition" is a function returning a player group - a new object of type player group which you should remove.
 
Level 9
Joined
Jul 24, 2007
Messages
308
OMG, LAST QUESTION, WHY DOES THIS POINT FUCK MY REGION?
  • Set AnotherPoint = (Random point in RegionInPlayableMapArea <gen>)
  • Hero - Instantly revive (Dying unit) at AnotherPoint, Show revival graphics
  • Custom script: call RemoveLocation(udg_AnotherPoint)
RegionInPlayableMapArea is a region existing on map,
on the 2nd use of the point, ITS REMOVED FOR EVER!

edit: and if i use bj_wantdestroygroup, will it remove the unit?
like pick every unit in area and do : order unit to move there, should i use bj_want destroy group here?
 
Last edited:
Level 7
Joined
Nov 12, 2005
Messages
299
The part you posted is OK, better show the whole trigger.

> will it remove the unit?
No, the only time when you shouldn't destroy the group is when it's something predefined - for example if you put some group in a variable on map initialization and keep using it through the map then you shouldn't destroy it as that will prevent you from using it further.
 
Level 9
Joined
Jul 24, 2007
Messages
308
ok here is the trigger:
  • Revive SM 2
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
    • Actions
      • Wait 10.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Dying unit)) Equal to Player 2 (Blue)
              • (Owner of (Dying unit)) Equal to Player 4 (Purple)
              • (Owner of (Dying unit)) Equal to Player 6 (Orange)
              • (Owner of (Dying unit)) Equal to Player 8 (Pink)
              • (Owner of (Dying unit)) Equal to Player 10 (Light Blue)
              • (Owner of (Dying unit)) Equal to Player 12 (Brown)
        • Then - Actions
          • Set AnotherPoint = (Random point in Region1 <gen>)
          • Hero - Instantly revive (Dying unit) at AnotherPoint, Show revival graphics
          • Custom script: call RemoveLocation(udg_AnotherPoint)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Dying unit)) Equal to Player 1 (Red)
              • (Owner of (Dying unit)) Equal to Player 3 (Teal)
              • (Owner of (Dying unit)) Equal to Player 5 (Yellow)
              • (Owner of (Dying unit)) Equal to Player 7 (Green)
              • (Owner of (Dying unit)) Equal to Player 9 (Gray)
              • (Owner of (Dying unit)) Equal to Player 11 (Dark Green)
        • Then - Actions
          • Set AnotherPoint = (Random point in Region2 <gen>)
          • Hero - Instantly revive (Dying unit) at AnotherPoint, Show revival graphics
          • Custom script: call RemoveLocation(udg_AnotherPoint)
        • Else - Actions
when my hero revived, he is revived in Center of playable map area! not Region1 nor Region2
 
Level 13
Joined
Nov 20, 2006
Messages
553
  • Events
    • Unit - A unit Dies
  • Conditions
    • ((Dying unit) is A Hero) Equal to True
  • Actions
    • Wait 10.00 seconds
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Dying unit) belongs to an ally of Player 1 (Red)) Equal to True
      • Then - Actions
        • Set AnotherPoint1 = (Random point in Rect1 <gen>)
        • Hero - Instantly revive (Dying unit) at AnotherPoint1, Show revival graphics
        • Camera - Pan camera for (Owner of (Dying unit)) to AnotherPoint1 over 0.00 seconds
        • Custom script: call RemoveLocation(udg_AnotherPoint1)
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Dying unit) belongs to an ally of Player 2 (Blue)) Equal to True
          • Then - Actions
            • Set AnotherPoint2 = (Random point in Rect2 <gen>)
            • Hero - Instantly revive (Dying unit) at AnotherPoint2, Show revival graphics
            • Camera - Pan camera for (Owner of (Dying unit)) to AnotherPoint2 over 0.00 seconds
            • Custom script: call RemoveLocation(udg_AnotherPoint2)
          • Else - Actions
            • Do nothing
 
Level 6
Joined
Mar 2, 2006
Messages
306
you should not use dying unit after a 10 seconds wait. ever. try replacing it with triggering unit then run the map.

usual sequence when you need to wait would be something like this:
  • Custom Script - local unit LMyHero = GetTriggerUnit() // put this as the first action
  • Wait 10 game-time seconds
  • Custom Script - set udg_MyGlobalVarUnit = LMyUnit
  • Custom Script - set LMyUnit = null
  • ... and now you use the global var for the rest of the trigger
 
Level 9
Joined
Jul 24, 2007
Messages
308
aye, i'll ask something else and its maybe the thing that fucks the region! and its:
i dont only use the revive point(in region 1,2) only to revive heroes, i use it to spawn units(in region 1,2) ... but they use diffrent variables, should i make a region special for reviving heroes/spawn units ?!

Note* : both points in same place of region!
 
Last edited:
Level 6
Joined
Mar 2, 2006
Messages
306
if you use these couple of points through entire game, don't create/destroy them 1000 times. create them (set a = center point of region x) in map initialization and don't touch them. bug fixed and map optimized.
 
Status
Not open for further replies.
Top