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

[Trigger] Does this trigger leak also is it fine can it make crash?

Status
Not open for further replies.
Level 11
Joined
Jul 17, 2013
Messages
544
Hi i have two question frist is whats that function and what does it do? i found it in my map idk if me did it by mistake or my friendfunction CreateUnitsInRectRandom takes player id, integer unitid, rect whichRect, integer number returns nothing
local integer i = 0
loop
exitwhen i == number
call CreateUnit(id, unitid,GetRandomReal(GetRectMinX(whichRect), GetRectMaxX(whichRect)), GetRandomReal(GetRectMinY(whichRect), GetRectMaxY(whichRect)), GetRandomDirectionDeg())
set i = i + 1
endloop
endfunction
my second question is are those triggers fine? do they leak

  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Give Tribute (hotkey y)
      • (Unit-type of (Target unit of ability being cast)) Equal to TradePort
    • Actions
      • Unit - Remove (Triggering unit) from the game
      • Player - Add 600 to (Owner of (Target unit of ability being cast)) Current gold




  • Untitled Trigger 002 Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Give gold (hotkey y)
      • (Unit-type of (Target unit of ability being cast)) Equal to TradeCenter
    • Actions
      • Unit - Remove (Triggering unit) from the game
      • Player - Add 500 to (Owner of (Target unit of ability being cast)) Current gold
 
JASS:
function CreateUnitsInRectRandom takes player id, integer unitid, rect whichRect, integer number returns nothing
    local integer i = 0
    loop
        exitwhen i == number
        call CreateUnit(id, unitid,GetRandomReal(GetRectMinX(whichRect), GetRectMaxX(whichRect)), GetRandomReal(GetRectMinY(whichRect), GetRectMaxY(whichRect)), GetRandomDirectionDeg())
        set i = i + 1
    endloop
endfunction

This doesn't seem leaky or suspicious to me, except when intercepting the creation of the units, or obtaining the group.
I agree with @Chaosy, both of these triggers are fine.

should i remove it?
No, it's fine.​

Perhaps you could post the map you're working on. That could help us identify the problem.
 
Status
Not open for further replies.
Top