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 02-19-2007, 10:53 PM   #1
Joker
User
 
Joker's Avatar
 
Join Date: Sep 2006
Posts: 687

Joker will become famous soon enough (32)Joker will become famous soon enough (32)

Default 2 quick questions

1. How do i count the number of units in a unit group? i cant find the native for it.

2. How do i use the CasterCast natives that i see in jasscraft? Are they worth using?
Joker is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 02-19-2007, 10:59 PM   #2
Alevice
It feels good
 
Alevice's Avatar
 
Join Date: Mar 2006
Posts: 1,305

Alevice is a jewel in the rough (190)Alevice is a jewel in the rough (190)Alevice is a jewel in the rough (190)

Default

2. user the caster system by vex. they are not natives though.
__________________
_-|-_

Alevice.jones is SC2 Beta, losers.

Check out my never updated deviantart gallery!!

Kalimdor Raiders (Race Contest #1) Pastebin Page
Cavern Crawlers (Race Contest #2) Pastebin Page
Airship Race Motherfuckers!
Quote:
Originally Posted by http://ajaxian.com/archives/would-you-like-a-_-with-that-new-library-gives-js-what-it-should-have#comment-276203
- Dont solve problems that dont exist.
- Improve the wheel, dont reinvent it.
- Port the wheel if it doesnt exist in your environment.
- Integrate the wheel into your project.
- Make sure you can replace your wooden wheel for a rubber one if someone else invents it.
Alevice is offline   Reply With Quote
Old 02-19-2007, 11:46 PM   #3
Naakaloh
User
 
Naakaloh's Avatar
 
Join Date: Jun 2003
Posts: 619

Submissions (2)

Naakaloh is a jewel in the rough (155)Naakaloh is a jewel in the rough (155)

Spell Making Session 09 WinnerSpell Making Session 05 Winner

Send a message via AIM to Naakaloh
Default

There is no native for it; there is a CountUnitsInGroup bj function.
__________________
"The geeks will play their game."
- Kowalski
Naakaloh is offline   Reply With Quote
Old 02-20-2007, 03:49 AM   #4
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

You could do it like this:
Collapse JASS:
function CountUnitsInGroup takes group G returns integer
    local integer I = 0
    local unit U
    loop
        set U = FirstOfGroup(G)
        exitwhen U == null
        set I = I+1
        call GroupRemoveUnit(G, U)
    endloop
    return I
endfunction
__________________
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 02-20-2007, 09:02 AM   #5
zen87
vJass maniac
 
zen87's Avatar
 
Join Date: May 2006
Posts: 732

Submissions (1)

zen87 has a spectacular aura about (86)zen87 has a spectacular aura about (86)zen87 has a spectacular aura about (86)

Send a message via MSN to zen87
Default

Quote:
Originally Posted by Pyrogasm
You could do it like this:
Collapse JASS:
function CountUnitsInGroup takes group G returns integer
    local integer I = 0
    local unit U
    loop
        set U = FirstOfGroup(G)
        exitwhen U == null
        set I = I+1
        call GroupRemoveUnit(G, U)
    endloop
    return I
endfunction
that will bring to a side effect -.- all the unit will be removed after the counting, i'll suggest to do a copy group and so...

for those CasterCast natives, try search for vex's caster system for more information http://wc3campaigns.net/forumdisplay.php?f=588
__________________
Final Alliance
An RPG like no other
zen87 is offline   Reply With Quote
Old 02-20-2007, 10:07 AM   #6
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

Quote:
Originally Posted by zen87
that will bring to a side effect -.- all the unit will be removed after the counting, i'll suggest to do a copy group and so...
Ah, right. Here's the correct way to do it:
Collapse JASS:
function CountUnitsInGroup takes group G returns integer
    local integer I = 0
    local unit U
    local group G2 = G
    loop
        set U = FirstOfGroup(G2)
        exitwhen U == null
        set I = I+1
        call GroupRemoveUnit(G2, U)
    endloop
    return I
endfunction
__________________
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.

Last edited by Pyrogasm : 02-20-2007 at 10:07 AM.
Pyrogasm is offline   Reply With Quote
Old 02-20-2007, 01:01 PM   #7
shadow1500
STARCRAFT II OMFG
 
shadow1500's Avatar
 
Join Date: Jul 2004
Posts: 1,004

Submissions (9)

shadow1500 is just really nice (306)shadow1500 is just really nice (306)shadow1500 is just really nice (306)

Send a message via ICQ to shadow1500 Send a message via AIM to shadow1500 Send a message via MSN to shadow1500
Default

I don't see why would you want to create a new function for it when the BJ works just fine and does it a lot faster. You have an error in your function:
Collapse JASS:
local group G2 = G
This statement does not clone the group, it sets the reference of G2 to G which would cause your code below to corrupt the original. In order to use this iteration method, you must clone the group by using GroupAddGroup to add the original into a newly created group and then iterate through that one. Also, the clone group must be destroyed and nullified, which you didn't do at the end of your function.
shadow1500 is offline   Reply With Quote
Old 02-20-2007, 08:42 PM   #8
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

Damn. I concede; I've failed.
__________________
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 02-20-2007, 09:42 PM   #9
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Collapse JASS:
function LawlICanCount takes group g returns integer
    set bj_groupCountUnits = 0
    call ForGroup(g, function CountUnitsInGroupEnum)
    return bj_groupCountUnits
endfunction
I like this way better. :P
__________________
Rising_Dusk 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 10:16 PM.


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