wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 10-05-2008, 04:09 AM   #1
Tide-Arc Ephemera
Overdoses result in death
 
Tide-Arc Ephemera's Avatar
 
Join Date: Jan 2007
Posts: 2,365

Submissions (3)

Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)

Default [Help] Converting for "efficiency"

Hidden information:
Hello, it's me again! Anyway... I don't code too much so "efficiency" isn't totally asserted, though I just assume Jass > GUI in terms of speed (and power in some cases).

Anyway, here's the original trigger:

Trigger:
Swap Interact
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to (==) Interract
Collapse Actions
Set MovesTaken = (MovesTaken + 1)
Set TempPoint = (Position of (Target unit of ability being cast))
Custom script: set bj_wantDestroyGroup = true
Collapse Unit Group - Pick every unit in (Units within 200.00 of TempPoint) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked unit)) Equal to (==) On
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked unit)) Not equal to (!=) Puzzle Solver
(Unit-type of (Picked unit)) Not equal to (!=) Randomizer
Collapse Then - Actions
Unit - Replace (Picked unit) with a Off using The old unit's relative life and mana
Unit - Change ownership of (Last replaced unit) to Player 12 (Brown) and Change color
Else - Actions
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked unit)) Not equal to (!=) Puzzle Solver
(Unit-type of (Picked unit)) Not equal to (!=) Randomizer
Collapse Then - Actions
Unit - Replace (Picked unit) with a On using The old unit's relative life and mana
Unit - Change ownership of (Last replaced unit) to Player 10 (Light Blue) and Change color
Else - Actions
Custom script: call RemoveLocation(udg_TempPoint)
Set Integer = 0
Set TempGroup = (Units of type Off)
Collapse Unit Group - Pick every unit in TempGroup and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked unit) is hidden) Equal to (==) False
Collapse Then - Actions
Set Integer = (Integer + 1)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Integer Equal to (==) NumLights[Integer2]
Collapse Then - Actions
Set Integer2 = (Integer2 + 1)
Trigger - Run Yay <gen> (checking conditions)
Else - Actions
Custom script: call DestroyGroup(udg_TempGroup)

And here's my Jass trigger:
Collapse JASS:
function Trig_Swap_I_Conditions takes nothing returns boolean
    if GetSpellAbilityId() == 'A000' then
        return true
    endif
    return false
endfunction

function Trig_Swap_I_Actions takes nothing returns nothing
    local integer i = 0
    local integer i2 = 0
    local group g = CreateGroup()
    local unit u = GetTriggerUnit()
    local real x = 0
    local real y = 0
    set udg_MovesTaken = udg_MovesTaken + 1
    call GroupEnumUnitsInRange(g, GetUnitX(u), GetUnitY(u), 200., null)
    loop
    exitwhen u==null
        set u = FirstOfGroup(g)
        if GetUnitTypeId(u) == 'h001' and GetUnitTypeId(u) != 'h002' then
            set x = GetUnitX(u)
            set y = GetUnitY(u)
            call ShowUnit(u, false)
            call KillUnit(u)
            call CreateUnit(Player(9), 'h000', x, y, 270)
        elseif GetUnitTypeId(u) == 'h000' and GetUnitTypeId(u) != 'h002' then
            set x = GetUnitX(u)
            set y = GetUnitY(u)
            call ShowUnit(u, false)
            call KillUnit(u)
            call CreateUnit(Player(11), 'h001', x, y, 270)
        endif
        call GroupRemoveUnit(g, u)
    endloop
    call DestroyGroup(g)
    set u = GetTriggerUnit()
    set g = CreateGroup()
    call GroupEnumUnitsOfType(g, "On", null)
    loop
    exitwhen u==null
        set u = FirstOfGroup(g)
        set i = i + 1
        call GroupRemoveUnit(g, u)
    endloop
    if i == udg_NumLights[udg_Integer2] then
        set udg_Integer2 = udg_Integer2 + 1
    endif
    call DestroyGroup(g)
    set u = null
    set g = null
endfunction

//===========================================================================
function InitTrig_Swap_I takes nothing returns nothing
    set gg_trg_Swap_I = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Swap_I, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Swap_I, Condition( function Trig_Swap_I_Conditions ) )
    call TriggerAddAction( gg_trg_Swap_I, function Trig_Swap_I_Actions )
endfunction

I had a go at inlining Replace Unit but it didn't turn out very well.

What's meant to happen (and does happen with the GUI one):

1. Person interacts with an object
2. All objects within X (including targeted one) turn from A's to B's and all B's turn into A's

Now what happens with the Jass one is:
1. Person interracts with an object
2. Some (I think it's all of the appropriate ones) turn from A's to B's and all B's turn into A's
3 (if A). Some A's pop up
3 (if B). Some B's pop up

I think it has something to do with my hodge-podge replacement, but could anybody tell me what I've done wrong?

Thanks ahead!


EDIT!
Problem solved over IRC.
__________________
Before asking for help with triggers... read this and check your trigger!

If you're having troubles getting help on WC3C or anywhere at all, please have a look at...
The WRONG way to ask for help and The CORRECT way to ask for help.

Quote:
Originally Posted by Alevice
You may never stop our bioweapon! We mexicans shall rule the third world! Mwahahahahahahaha!
Please acknowledge that I use Mac and avoid suggesting vJass and other tools that don't work on it. Thank you.

Last edited by Tide-Arc Ephemera : 10-05-2008 at 07:36 AM.
Tide-Arc Ephemera is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 10-05-2008, 11:07 AM   #2
Tide-Arc Ephemera
Overdoses result in death
 
Tide-Arc Ephemera's Avatar
 
Join Date: Jan 2007
Posts: 2,365

Submissions (3)

Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)

Default

Sorry to bump a thread so young but I ended up having a new problem along the road...

Collapse JASS:
function Trig_Swap_I_Actions takes nothing returns nothing
    local integer i = 0
    local integer i2 = 0
    local group g = CreateGroup()
    local group g2 = CreateGroup()
    local unit u = GetSpellTargetUnit()
    local real x = 0
    local real y = 0
    set udg_MovesTaken = udg_MovesTaken + 1
    call GroupEnumUnitsInRange(g, GetUnitX(u), GetUnitY(u), 200., null)
    call GroupRemoveUnit(g, gg_unit_E000_0021)
    call KillUnit(GetAttacker())
    loop
    exitwhen u==null
        set u = FirstOfGroup(g)
        if GetUnitTypeId(u) == 'h001' and GetUnitTypeId(u) != 'h002' then
            set x = GetUnitX(u)
            set y = GetUnitY(u)
            call ReplaceUnitBJ(u, 'h000', bj_UNIT_STATE_METHOD_ABSOLUTE)
            call SetUnitOwner(u, Player(9), true)
        elseif GetUnitTypeId(u) == 'h000' and GetUnitTypeId(u) != 'h002' then
            set x = GetUnitX(u)
            set y = GetUnitY(u)
            call ReplaceUnitBJ(u, 'h001', bj_UNIT_STATE_METHOD_ABSOLUTE)
            call SetUnitOwner(u, Player(11), true)
        endif
        call GroupRemoveUnit(g, u)
    endloop
    call DestroyGroup(g)
    set u = GetTriggerUnit()
    call GroupEnumUnitsOfType(g2, 'On', null)
    loop
    exitwhen u == null
        set u = FirstOfGroup(g2)
        if GetUnitTypeId(u) == 'h001' then 
            set i = i + 1
        endif
    endloop
    call BJDebugMsg("Lights: "+I2S(i))
    if i == 0 then
        set udg_Integer2 = udg_Integer2 + 1
    endif
    call DestroyGroup(g)
    set u = null
    set g = null
endfunction

It's telling me that line has an "Expected expression" and I don't know what to do, I had it before but now it's not working for some reason.
__________________
Before asking for help with triggers... read this and check your trigger!

If you're having troubles getting help on WC3C or anywhere at all, please have a look at...
The WRONG way to ask for help and The CORRECT way to ask for help.

Quote:
Originally Posted by Alevice
You may never stop our bioweapon! We mexicans shall rule the third world! Mwahahahahahahaha!
Please acknowledge that I use Mac and avoid suggesting vJass and other tools that don't work on it. Thank you.
Tide-Arc Ephemera is offline   Reply With Quote
Old 10-05-2008, 11:48 AM   #3
Flame_Phoenix
retired coder | real ilfe
 
Flame_Phoenix's Avatar
 
Join Date: Mar 2007
Posts: 2,208

Submissions (10)

Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)

Send a message via MSN to Flame_Phoenix
Default

What is 'On' ?? To which unit is it refereeing to ?
Maybe you will have to use something like H2S ... not sure though, need more info.
__________________
Check out my tutorials at:
1-Creating a Hero Tavern
2-Complete Icon Tutorial - ALL about Icons
3-Making a spell in vJass - Practice Session 1
Check out all my current spells at here
Finally, check my project:
Castle vs Castle Flame Edition

Last edited by Flame_Phoenix : 10-05-2008 at 11:48 AM.
Flame_Phoenix is offline   Reply With Quote
Old 10-05-2008, 11:49 AM   #4
Spec
Shadow Daemon
 
Spec's Avatar
 
Join Date: Mar 2008
Posts: 102

Submissions (2)

Spec has a spectacular aura about (118)Spec has a spectacular aura about (118)Spec has a spectacular aura about (118)Spec has a spectacular aura about (118)

Send a message via ICQ to Spec
Default

Because the type of argument is NOT integer, but string:
Collapse JASS:
native GroupEnumUnitsOfType takes group whichGroup, string unitname, boolexpr filter returns nothing
So that should be right variant, of course, if you have such unit name in OE:
Collapse JASS:
call GroupEnumUnitsOfType(g2, "On", null)
__________________
Button Manager v1.8.2 - The icon making tool.

BLP Laboratory v0.5.0 - Texture viewer & converter.
Spec is offline   Reply With Quote
Old 10-05-2008, 11:53 AM   #5
Tide-Arc Ephemera
Overdoses result in death
 
Tide-Arc Ephemera's Avatar
 
Join Date: Jan 2007
Posts: 2,365

Submissions (3)

Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)

Default

Oh shit, I keep forgetting that uses strings. Warghabargle, all the other ones use integers!

Thanks!

EDIT!
New problem!
Collapse JASS:
function Trig_Init_Actions takes nothing returns nothing
    local unit u
    local integer i = 3
    local integer i2 = 21
    call GroupEnumUnitsInRect(udg_AllStage, gg_rct_FourthStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[5], gg_rct_FourthStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[3], gg_rct_FourthStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[2], gg_rct_ThirdStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[1], gg_rct_SecondStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[0], gg_rct_FirstStage, null)
    set udg_NumLights[3] = 96
    set udg_NumLights[2] = 65
    set udg_NumLights[1] = 40
    set udg_NumLights[0] = 21
    loop
        call GroupRemoveGroup(udg_StageLevel[i - 1], udg_StageLevel[i])
        set i = i - 1
    exitwhen i == 0
    endloop
    call GroupRemoveGroup(udg_StageLevel[0], udg_StageLevel[5])
    loop
        set u = FirstOfGroup(udg_StageLevel[5])
        call ShowUnitHide(u)
        call GroupRemoveUnit(udg_StageLevel[5], u)
    exitwhen u == null
    endloop
     
     // ....

endfunction

I have a grid of On lights, it's meant to hide the lights that aren't part of the first stage. Thing is, this trigger isn't hiding them. The GUI equivalent did.

Trigger:
Initialization
Collapse Events
Map initialization
Conditions
Collapse Actions
Set StageLevel[6] = (Units in FourthStage <gen>)
Set StageLevel[5] = (Units in FourthStage <gen>)
Set StageLevel[3] = (Units in FourthStage <gen>)
Set StageLevel[2] = (Units in ThirdStage <gen>)
Set StageLevel[1] = (Units in SecondStage <gen>)
Set StageLevel[0] = (Units in FirstStage <gen>)
Set NumLights[3] = 96
Set NumLights[2] = 65
Set NumLights[1] = 40
Set NumLights[0] = 21
Unit Group - Remove Puzzle Solver 0021 <gen> from StageLevel[6]
Collapse For each (Integer A) from 0 to 5, do (Actions)
Collapse Loop - Actions
Unit Group - Remove Puzzle Solver 0021 <gen> from StageLevel[(Integer A)]
Collapse For each (Integer A) from 0 to 2, do (Actions)
Collapse Loop - Actions
Unit Group - Remove all units of StageLevel[(Integer A)] from StageLevel[3]
Collapse For each (Integer A) from 0 to 1, do (Actions)
Collapse Loop - Actions
Unit Group - Remove all units of StageLevel[(Integer A)] from StageLevel[2]
Unit Group - Remove all units of StageLevel[0] from StageLevel[1]
Unit Group - Remove all units of StageLevel[0] from StageLevel[6]
Collapse Unit Group - Pick every unit in StageLevel[6] and do (Actions)
Collapse Loop - Actions
Unit - Hide (Picked unit)

.....
__________________
Before asking for help with triggers... read this and check your trigger!

If you're having troubles getting help on WC3C or anywhere at all, please have a look at...
The WRONG way to ask for help and The CORRECT way to ask for help.

Quote:
Originally Posted by Alevice
You may never stop our bioweapon! We mexicans shall rule the third world! Mwahahahahahahaha!
Please acknowledge that I use Mac and avoid suggesting vJass and other tools that don't work on it. Thank you.

Last edited by Tide-Arc Ephemera : 10-06-2008 at 05:06 AM.
Tide-Arc Ephemera is offline   Reply With Quote
Old 10-05-2008, 12:43 PM   #6
Malf
I LIKE PIZZA! | >
 
Malf's Avatar
 
Join Date: Sep 2007
Posts: 625

Submissions (2)

Malf has a spectacular aura about (92)Malf has a spectacular aura about (92)Malf has a spectacular aura about (92)Malf has a spectacular aura about (92)

Send a message via AIM to Malf
Default

Collapse JASS:
call GroupEnumUnitsInRect(udg_AllStage, gg_rct_FourthStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[5], gg_rct_FourthStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[3], gg_rct_FourthStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[2], gg_rct_ThirdStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[1], gg_rct_SecondStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[0], gg_rct_FirstStage, null)

Those will crash Macs. Don't use null, use a function that returns true instead.
__________________
Malf is offline   Reply With Quote
Old 10-05-2008, 01:00 PM   #7
Flame_Phoenix
retired coder | real ilfe
 
Flame_Phoenix's Avatar
 
Join Date: Mar 2007
Posts: 2,208

Submissions (10)

Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)

Send a message via MSN to Flame_Phoenix
Default

Rep all people who helped ya xD

Quote:
Those will crash Macs. Don't use null, use a function that returns true instead.
So, that why, warcraft wouldn't be played in macs, because they would always be crashing. I think that the bad thing is using "Filter(null)".. i think "null" is ok, not sure though.
__________________
Check out my tutorials at:
1-Creating a Hero Tavern
2-Complete Icon Tutorial - ALL about Icons
3-Making a spell in vJass - Practice Session 1
Check out all my current spells at here
Finally, check my project:
Castle vs Castle Flame Edition
Flame_Phoenix is offline   Reply With Quote
Old 10-05-2008, 01:09 PM   #8
Tide-Arc Ephemera
Overdoses result in death
 
Tide-Arc Ephemera's Avatar
 
Join Date: Jan 2007
Posts: 2,365

Submissions (3)

Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)

Default

Quote:
Originally Posted by Malf
Collapse JASS:
call GroupEnumUnitsInRect(udg_AllStage, gg_rct_FourthStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[5], gg_rct_FourthStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[3], gg_rct_FourthStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[2], gg_rct_ThirdStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[1], gg_rct_SecondStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[0], gg_rct_FirstStage, null)

Those will crash Macs. Don't use null, use a function that returns true instead.

I've seen this used EVERYWHERE. Not to sound accusing, but where's the support for your statement?

EDIT!
Also, I think I'd know where Mac would crash. Also, what would these trick functions look like?
__________________
Before asking for help with triggers... read this and check your trigger!

If you're having troubles getting help on WC3C or anywhere at all, please have a look at...
The WRONG way to ask for help and The CORRECT way to ask for help.

Quote:
Originally Posted by Alevice
You may never stop our bioweapon! We mexicans shall rule the third world! Mwahahahahahahaha!
Please acknowledge that I use Mac and avoid suggesting vJass and other tools that don't work on it. Thank you.

Last edited by Tide-Arc Ephemera : 10-05-2008 at 01:09 PM.
Tide-Arc Ephemera is offline   Reply With Quote
Old 10-05-2008, 03:00 PM   #9
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Malf is incorrect. That does not cause a crash; the culprit is this:
Collapse JASS:
function Filter takes nothing returns nothing
    call Blah()
endfunction

call GroupEnumUnitsInRect(udg_TempGroup, udg_MyRect, Condition(function Filter))
However, the null boolexpr argument does cause a slight leak, if you remember the thread by grim001 a while back. I'd link to it but I'm literally running out the door right now.
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 10-05-2008, 03:11 PM   #10
Tide-Arc Ephemera
Overdoses result in death
 
Tide-Arc Ephemera's Avatar
 
Join Date: Jan 2007
Posts: 2,365

Submissions (3)

Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)

Default

I've read that but he was running it at like 1000 times per second right? Unless my puzzle takes 5 days to finish and you're taking like 2 moves per second, it's highly unlikely that it will matter in my map.
__________________
Before asking for help with triggers... read this and check your trigger!

If you're having troubles getting help on WC3C or anywhere at all, please have a look at...
The WRONG way to ask for help and The CORRECT way to ask for help.

Quote:
Originally Posted by Alevice
You may never stop our bioweapon! We mexicans shall rule the third world! Mwahahahahahahaha!
Please acknowledge that I use Mac and avoid suggesting vJass and other tools that don't work on it. Thank you.
Tide-Arc Ephemera is offline   Reply With Quote
Old 10-05-2008, 03:17 PM   #11
Spec
Shadow Daemon
 
Spec's Avatar
 
Join Date: Mar 2008
Posts: 102

Submissions (2)

Spec has a spectacular aura about (118)Spec has a spectacular aura about (118)Spec has a spectacular aura about (118)Spec has a spectacular aura about (118)

Send a message via ICQ to Spec
Default

Try this, it would work, if I understood problem)
Collapse JASS:
function RemoveUnits takes nothing returns nothing
  call GroupRemoveUnit(udg_StageLevel[5], GetEnumUnit())
endfunction
    
function HideUnits takes nothing returns nothing
  call ShowUnit(GetEnumUnit(), false)
endfunction
    
function Trig_Init_Actions takes nothing returns nothing
  local integer i = 0
  call GroupEnumUnitsInRect(udg_AllStage,      gg_rct_FourthStage, null)
  call GroupEnumUnitsInRect(udg_StageLevel[5], gg_rct_FirstStage,  null) // note the difference
  call GroupEnumUnitsInRect(udg_StageLevel[3], gg_rct_FourthStage, null)
  call GroupEnumUnitsInRect(udg_StageLevel[2], gg_rct_ThirdStage,  null)
  call GroupEnumUnitsInRect(udg_StageLevel[1], gg_rct_SecondStage, null)
  call GroupEnumUnitsInRect(udg_StageLevel[0], gg_rct_FirstStage,  null)
  loop
    set i = i + 1
    exitwhen i > 3
    call ForGroup(udg_StageLevel[i], function RemoveUnits) 
  endloop
  call ForGroup(udg_StageLevel[5], function HideUnits)
  call DestroyGroup(udg_StageLevel[5])
  // . . .
endfunction
__________________
Button Manager v1.8.2 - The icon making tool.

BLP Laboratory v0.5.0 - Texture viewer & converter.

Last edited by Spec : 10-07-2008 at 07:49 AM.
Spec is offline   Reply With Quote
Old 10-05-2008, 05:31 PM   #12
Tide-Arc Ephemera
Overdoses result in death
 
Tide-Arc Ephemera's Avatar
 
Join Date: Jan 2007
Posts: 2,365

Submissions (3)

Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)

Default

I need StageLevel[5] to be the opposite of [0], so you're almost right there.

Also, from what I've heard, ForGroup calls are evil. I'll give it a shot when I get World Editor access.

EDIT!
Now this may sound like a really silly off topic request, but could somebody get me a benchmark for both square root and power?
Yes, I am aware of how stupid this is but that's why it's tiny-text!
__________________
Before asking for help with triggers... read this and check your trigger!

If you're having troubles getting help on WC3C or anywhere at all, please have a look at...
The WRONG way to ask for help and The CORRECT way to ask for help.

Quote:
Originally Posted by Alevice
You may never stop our bioweapon! We mexicans shall rule the third world! Mwahahahahahahaha!
Please acknowledge that I use Mac and avoid suggesting vJass and other tools that don't work on it. Thank you.

Last edited by Tide-Arc Ephemera : 10-05-2008 at 05:47 PM.
Tide-Arc Ephemera is offline   Reply With Quote
Old 10-05-2008, 06:09 PM   #13
Flame_Phoenix
retired coder | real ilfe
 
Flame_Phoenix's Avatar
 
Join Date: Mar 2007
Posts: 2,208

Submissions (10)

Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)

Send a message via MSN to Flame_Phoenix
Default

Quote:
I need StageLevel[5] to be the opposite of [0], so you're almost right there.

Also, from what I've heard, ForGroup calls are evil. I'll give it a shot when I get World Editor access.
No, ForGroup is, by all means, the fastest and more efficient(?) way you can do stuff with units in groups. Vex made a benchmark an year ago that shows that ForGroup is even faster than the "f = FirstOfGroup(g)" thing.

About the benchmark, I know a benchmark for Pow, but not for Square.
Anyway, this test may help you creating your own benchmark(see the last posts):
http://www.wc3campaigns.net/showthread.php?t=102881
__________________
Check out my tutorials at:
1-Creating a Hero Tavern
2-Complete Icon Tutorial - ALL about Icons
3-Making a spell in vJass - Practice Session 1
Check out all my current spells at here
Finally, check my project:
Castle vs Castle Flame Edition

Last edited by Flame_Phoenix : 10-05-2008 at 06:11 PM.
Flame_Phoenix is offline   Reply With Quote
Old 10-05-2008, 06:57 PM   #14
the-thingy
User
 
Join Date: Feb 2006
Posts: 172

the-thingy will become famous soon enough (30)the-thingy will become famous soon enough (30)

Default

Quote:
No, ForGroup is, by all means, the fastest and more efficient(?) way you can do stuff with units in groups
You could go one step further and handle everything within the GroupEnum filter, and return false, which would be faster still - probably not alot of difference (unless you drool over maximum possible efficiency) but it does shorten the code and make it a little neater

Last edited by the-thingy : 10-05-2008 at 07:00 PM.
the-thingy is offline   Reply With Quote
Old 10-06-2008, 03:39 AM
Litany
This message has been deleted by Litany.
Old 10-06-2008, 03:45 AM   #15
Tide-Arc Ephemera
Overdoses result in death
 
Tide-Arc Ephemera's Avatar
 
Join Date: Jan 2007
Posts: 2,365

Submissions (3)

Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)Tide-Arc Ephemera is a jewel in the rough (206)

Default

I just need that tidbit for something else and I don't want to start a new topic about it. I'll get to work on my triggers now.

EDIT!
Pheonix, your link is broken.

EDIT!
Oh shit I am so sorry, I had "Run ON Map Initialization" unchecked, it was checked when I started but wasn't later on.
+Rep to whoever helped a mistaken problem

EDIT!
Apparently I'm not out of the woods yet.

Collapse JASS:
function Trig_Init_Actions takes nothing returns nothing
    local integer i = 4
    local integer i2 = 0
    local unit u
    local group g = CreateGroup()
    call GroupEnumUnitsInRect(udg_AllStage, gg_rct_FifthStage, null)
    call GroupEnumUnitsInRect(udg_StageLevel[5], gg_rct_FifthStage, null )
    call GroupEnumUnitsInRect(udg_StageLevel[4], gg_rct_FifthStage, null )
    call GroupEnumUnitsInRect(udg_StageLevel[3], gg_rct_FourthStage, null )
    call GroupEnumUnitsInRect(udg_StageLevel[2], gg_rct_ThirdStage, null )
    call GroupEnumUnitsInRect(udg_StageLevel[1], gg_rct_SecondStage, null )
    call GroupEnumUnitsInRect(udg_StageLevel[0], gg_rct_FirstStage, null )

    loop
        call GroupRemoveGroup(udg_StageLevel[i - 1], udg_StageLevel[i])
        set i = i - 1
    exitwhen i == 0
    endloop
    call GroupRemoveGroup(udg_StageLevel[0], udg_StageLevel[5])

    call BJDebugMsg("AllStage = " + I2S(CountUnitsInGroup(udg_AllStage)))
    call BJDebugMsg("Stage[0] = " + I2S(CountUnitsInGroup(udg_StageLevel[0])))
    call BJDebugMsg("Stage[1] = " + I2S(CountUnitsInGroup(udg_StageLevel[1])))
    call BJDebugMsg("Stage[2] = " + I2S(CountUnitsInGroup(udg_StageLevel[2])))
    call BJDebugMsg("Stage[3] = " + I2S(CountUnitsInGroup(udg_StageLevel[3])))
    call BJDebugMsg("Stage[4] = " + I2S(CountUnitsInGroup(udg_StageLevel[4])))
    call BJDebugMsg("Stage[5] = " + I2S(CountUnitsInGroup(udg_StageLevel[5])))

    loop
        set u = FirstOfGroup(udg_StageLevel[5])
        call ShowUnit(u, false)
        call GroupRemoveUnit(udg_StageLevel[5], u)
    exitwhen u==null
    endloop

    call DestroyGroup(udg_StageLevel[5])

    // .....

endfunction


Problems:
- Units STILL not hiding (for some god-knows-why reason)
- Groups have the following number of units in them
AllStage = 96
Stage[0] = 8
Stage[1] = 13
Stage[2] = 0
Stage[3] = 0
Stage[4] = 0
Stage[5] = 0 <-- That's why things aren't hiding, but I don't know why that's 0. Heck, even when I don't do anything to it it's zero.
__________________
Before asking for help with triggers... read this and check your trigger!

If you're having troubles getting help on WC3C or anywhere at all, please have a look at...
The WRONG way to ask for help and The CORRECT way to ask for help.

Quote:
Originally Posted by Alevice
You may never stop our bioweapon! We mexicans shall rule the third world! Mwahahahahahahaha!
Please acknowledge that I use Mac and avoid suggesting vJass and other tools that don't work on it. Thank you.

Last edited by Tide-Arc Ephemera : 10-06-2008 at 05:09 AM.
Tide-Arc Ephemera is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 08:22 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services