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

1 bigger and 2 minor problems

Status
Not open for further replies.

Tzi

Tzi

Level 4
Joined
Jan 7, 2009
Messages
57
Hi there,

I've got a problem with a trigger that's using Maker's "Get the Region that triggers the 'Unit enters Region'-Event"-System *yeah... :eekani:*




  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: local region r
      • Hashtable - Create a hashtable
      • Set RectHash = (Last created hashtable)
      • Set Trig___Region_Entering = Invis Entering <gen>
      • Set rectGrass[0] = Grass0 <gen>
      • For each (Integer A) from 1 to 1, do (Actions)
        • Loop - Actions
          • Custom script: set r = CreateRegion()
          • Custom script: call RegionAddRect(r, udg_rectGrass[bj_forLoopAIndex])
          • Custom script: call TriggerRegisterEnterRegion(udg_Trig___Region_Entering, r, null)
          • Custom script: call SaveRectHandle(udg_RectHash , GetHandleId(r), 0, udg_rectGrass[bj_forLoopAIndex] )
          • -------- Q1: This won't work, huh?^^ --------
          • -------- I want to save the Index of this region for requesting it inside of the Trigger "Invis Entering" --------
          • -------- Then I would be able to look via Integer-Array[saved Index] which team to choose --------
          • -------- Is there any solution? I'd prever the most efficient way, for learning^^ --------
          • Custom script: call SaveIntegerHandle(udg_RectHash, GetHandleId(bj_forLoopAIndex), 0, udg_rectGrass[bj_forLoopAIndex])
          • -------- *Custom Script above* --------
      • Custom script: set r = null
  • Invis Entering
    • Events
      • Unit - A unit enters Grass0 <gen>
    • Conditions
    • Actions
      • Custom script: set udg_Rect = LoadRectHandle(udg_RectHash , GetHandleId(GetTriggeringRegion()) , 0)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • iGrass[0] Equal to (Team number of (Owner of (Triggering unit)))
        • Then - Actions
          • -------- Q2: How to get entering unit for this trigger using JASS? (for the local) --------
          • Custom script: local unit udg_tempUnit = GetEnteringUnit()
          • -------- "GetEnteringUnit()" and "GetTriggerUnit()" are causing errors while saving the map --------
          • Custom script: call UnitAddAbility (udg_tempUnit, 'Apiv')
          • Set iGrass[0] = (Team number of (Owner of tempUnit))
        • Else - Actions
          • -------- Q3: This causes an error while saving the map too... why? --------
          • Custom script: local location udg_P = Location( GetRectCenterX(udg_Rect), GetRectCenterY(udg_Rect))
          • -------- *Custom Script above* --------
          • Unit Group - Pick every unit in (Units within 512.00 of P matching (((Matching unit) belongs to an enemy of (Owner of tempUnit)) Equal to True)) and do (Actions)
            • Loop - Actions
              • Custom script: call UnitRemoveAbility (GetEnumUnit(), 'Apiv')
          • Custom script: set udg_tempUnit = null
          • Custom script: call RemoveLocation(udg_P)
          • Custom script: set udg_P = null
          • Set iGrass[0] = 0
 
Last edited:
Level 11
Joined
Dec 19, 2012
Messages
411
and what's the problem now? you didnt mention anything

His problems is already mentioned inside the trigger.


For efficient way, don't use Integer A,B. Use Integer variable instead. Also, do not use location, use GetLocationX and GetLocationY.
Try to use GetTriggerUnit() all times because its proved to be faster than any other function and also is MUI function.(unless the trigger unit isn't your wanted unit to do actions)

About the Question 1, i think you added a region into rect. Remember region contain rect but not rect contain region. Region can be any shape while rect only can have square and rectangular shape. Try to use region instead of rect ( I not too sure will its work)

About the Question 3 and 2, local functions MUST be created at top before any function. If you wan to declare local function, use Set NAME = (function here)
 
Last edited:
Status
Not open for further replies.
Top