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 > Resources > Code Resources > vJass Spells
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 08-14-2007, 04:59 AM   #31
Av3n
Roar!
 
Av3n's Avatar


Project Leader: TBR
Project Member: PoC
 
Join Date: May 2006
Posts: 1,854

Submissions (7)

Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)

Hero #4 extra-official winner2008 Spell olympics - Fire - BronzeHero Contest #3 - 3rd Place

Default

*Busy playin pokemon* Well I come on Msn more frequetly then... And on the weekends then. Thx agn cohadar, I'll test tht version out etc. I'll see what I can do as well.

-Av3n
__________________

Thanks to FatherTime for the sig
.:
Current ProjectsSubmissions
Power of CorruptionMy Terrain
The Black RoadMy Resources
Strikeforce
Twitter
Av3n is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 08-14-2007, 07:26 AM   #32
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)

Default

That last version I submitted is working OK but here is the problem.

It is very hard to understand/modify and it is no longer the same spell
because so many spell data/behavior has changed.
I also personally don't like it.

Here is what you should do:
Remember your first version that used loops?
Well it was the right way to do it actually,
but it was hard because you had to do loops manually
and code eventually became too complicated
and you could not manage it in the end.

Well inspired by this difficulties I made Cool-Coll system,
witch saves you from writing the loop code manually,
so I think you should rewrite your spell in the way you did originally
but with using Collections.

I think it will take you less than half an hour for that,
because you already did it without collections,
and with collection it will be a piece of cake.

Just download the Collections system map,
take a look at that Life Drain spell to see how to use collection
and you will complete Web in no time.
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.

Last edited by cohadar : 08-14-2007 at 07:29 AM.
cohadar is offline   Reply With Quote
Old 08-27-2007, 01:01 PM   #33
blu_da_noob
Nonchalant
 
blu_da_noob's Avatar


Respected User
 
Join Date: Mar 2006
Posts: 1,933

Submissions (2)

blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)

[Quicksilver #2] - 2nd Place[Quicksilver#1] 1st place

Send a message via MSN to blu_da_noob
Default

The first thing cohader submitted would have exactly the same problem as every other one. The problem is that when you have more than one web out the invisibility will be removed if it is not in range of any one (1) of the webs even if it is in range of any number of other ones (ok not strictly true, it depends on the order the webs are iterated through, but generally speaking it will have this bug).

The linked list etc solution is a good one. There may be an easier solution though. You need to store all the units which currently have a web out. Before you loop through the webs, loop through all of those units and store some a boolean on them (some how? unituserdata could be used temporarily, but it would still override if it was being used..., could use positive/negative as a sign bit maybe) which starts as false. Then loop through your webs and if the owner is in range of a web, set that boolean on the owner to true (otherwise do nothing). Then at the end loop through all the owners again and add the invis ability if the boolean is true, otherwise remove it.

edit: ok actually easier way
Loop through all the owners and remove the invis abilities. Loop through webs and if an owner is within range of his/her web, add invis ability, otherwise do nothing.
__________________

Last edited by blu_da_noob : 08-27-2007 at 01:06 PM.
blu_da_noob is offline   Reply With Quote
Old 08-27-2007, 11:27 PM   #34
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

Quote:
Loop through all the owners and remove the invis abilities. Loop through webs and if an owner is within range of his/her web, add invis ability, otherwise do nothing.
Removing the invis ability on the units repeatedly will cause units to stutter as they lose auto-acquiring of the owner and then reacquire the owner. I had a similar problem with one of the spells I've made in the past. You'll want to do this --

If any given owner has the invis ability, leave it on them. Then loop through all webs owner by owner and if an owner is in range of any of them set some boolean to true (Since this is instant and you'd probably achieve this through ForGroup() you could use temp globals to transmit the boolean between function calls) and then if that boolean is true leave invis on the owner (Or add it if they didn't already have it) and if false remove it.

That's the easiest way I'd go about achieving it.
__________________
Rising_Dusk is offline   Reply With Quote
Old 08-28-2007, 05:46 AM   #35
blu_da_noob
Nonchalant
 
blu_da_noob's Avatar


Respected User
 
Join Date: Mar 2006
Posts: 1,933

Submissions (2)

blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)blu_da_noob is just really nice (398)

[Quicksilver #2] - 2nd Place[Quicksilver#1] 1st place

Send a message via MSN to blu_da_noob
Default

Yeah that's the first solution I had in that post :P
Ignore the edit then. I'm sure there is some obscure unit data field you can use as a boolean.
__________________
blu_da_noob is offline   Reply With Quote
Old 09-04-2007, 07:24 AM   #36
Av3n
Roar!
 
Av3n's Avatar


Project Leader: TBR
Project Member: PoC
 
Join Date: May 2006
Posts: 1,854

Submissions (7)

Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)

Hero #4 extra-official winner2008 Spell olympics - Fire - BronzeHero Contest #3 - 3rd Place

Default

Hey guys i manage to fix up something that does work. Right now it relies on buff checking, and I've no longer using speelbook for certain reasons.

Here's the code right now:
Collapse JASS:
scope Web
// Web v4.00 Thrid Release By Av3n
//
// Please visit [url]www.wc3campaigns.net[/url] and [url]www.clancbs.com[/url] for more updates of this spell
//
// Requires
// - JASSHelper preprocessor by Vexorian
// - Collections by cohadar
//
// Credits to moyack, cohadar, blu_da_noob, Rising_Dusk and Anitarf 
// for the suggestions that changed my spell.

globals
    private integer sid = 'A002' //Web's spell id based on Healing Ward
    private integer aid = 'A001' //Web's aura checker id based on Devotion Aura
    private integer wid = 'e000' //Web's dummy unit type
    private integer bid = 'B001' //Web's aura checker buff id
    private real cr = 0.1 //Check rate
    //Below are important are not to be touched
    private integer array spells
    private integer amount = 0
endglobals

private function Setup_Abi takes nothing returns nothing
    set spells[1] = 'A000' //Regen
    set spells[2] = 'A003' //Permhide
  // Set your spells to add here.
  //An example to add a new spell is like this
  // set spells[3] = 'A005'
  //then set amount = 3. remeber to change the array value as well in powers of 1 and don't start at 0
  // i.e
  // set spells[1] = 'A001'
  // set spells[2] = 'A002'
  // set amount = 2
  //The 'amount' specifies how much spells are added so any number after the 'amount' won't be added
    set amount = 2
endfunction

//! runtextmacro COLLECTION("Web")
private struct Web
    unit c = null
    unit w = null
    integer l = 0
endstruct

globals
    private timer WebTimer = CreateTimer()
    private integer WebCount = 0
endglobals

private function Web_Periodic takes nothing returns nothing
    local Web dat
    call IteratorWeb.reset()
    loop
        exitwhen IteratorWeb.noNext()
        set dat = IteratorWeb.next()
        if GetWidgetLife(dat.w) < 0.405 then
            set bj_forLoopAIndex = 0
            loop
                exitwhen bj_forLoopAIndex > amount
                call UnitRemoveAbility(dat.c,spells[bj_forLoopAIndex])
                set bj_forLoopAIndex = bj_forLoopAIndex + 1
            endloop
            set WebCount = WebCount - 1
            call dat.destroy()
            call IteratorWeb.remove()
        elseif GetUnitAbilityLevel(dat.c,bid) > 0 then
            set bj_forLoopAIndex = 0
            loop
                exitwhen bj_forLoopAIndex > amount
                call UnitAddAbility(dat.c,spells[bj_forLoopAIndex])
                call SetUnitAbilityLevel(dat.c,spells[bj_forLoopAIndex],dat.l)
                set bj_forLoopAIndex = bj_forLoopAIndex + 1
            endloop
        else
            set bj_forLoopAIndex = 0
            loop
                exitwhen bj_forLoopAIndex > amount
                call UnitRemoveAbility(dat.c,spells[bj_forLoopAIndex])
                set bj_forLoopAIndex = bj_forLoopAIndex + 1
            endloop    
        endif
    endloop
    if WebCount == 0 then
        call PauseTimer(WebTimer)
    endif
endfunction

private function Conditions takes nothing returns boolean
    return GetUnitTypeId(GetSummonedUnit()) == wid
endfunction

private function Actions takes nothing returns nothing
    local Web dat = Web.create()
    set dat.c = GetSummoningUnit()
    set dat.w = GetSummonedUnit()
    set dat.l = GetUnitAbilityLevel(dat.c,sid)
    call UnitAddAbility(dat.w,aid)
    call CollectionWeb.add(dat)
    if WebCount == 0 then
        call TimerStart(WebTimer,cr,true,function Web_Periodic)
    endif
    set WebCount = WebCount + 1
endfunction

function InitTrig_Web takes nothing returns nothing
    local trigger t = CreateTrigger()
    call Setup_Abi()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SUMMON)
    call TriggerAddCondition(t, Condition( function Conditions ) )
    call TriggerAddAction(t, function Actions )
    set t = null
endfunction
endscope

I will continue this for no aura checking and owner only webs.
These are goals i want to achieve for this spell before saying it is at its final state.

-Av3n
__________________

Thanks to FatherTime for the sig
.:
Current ProjectsSubmissions
Power of CorruptionMy Terrain
The Black RoadMy Resources
Strikeforce
Twitter
Av3n is offline   Reply With Quote
Old 09-08-2007, 12:21 AM   #37
Av3n
Roar!
 
Av3n's Avatar


Project Leader: TBR
Project Member: PoC
 
Join Date: May 2006
Posts: 1,854

Submissions (7)

Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)

Hero #4 extra-official winner2008 Spell olympics - Fire - BronzeHero Contest #3 - 3rd Place

Default

*Bump* anything i should fix up in the code posted above? Is it near approvable? Comments? Im just curious right now

-Av3n
__________________

Thanks to FatherTime for the sig
.:
Current ProjectsSubmissions
Power of CorruptionMy Terrain
The Black RoadMy Resources
Strikeforce
Twitter
Av3n is offline   Reply With Quote
Old 09-08-2007, 12:44 AM   #38
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Could you post the map?? How is the IteratorWeb struct?? the code looks fine, but it's incomplete to evaluate.
moyack is offline   Reply With Quote
Old 09-08-2007, 12:55 AM   #39
Av3n
Roar!
 
Av3n's Avatar


Project Leader: TBR
Project Member: PoC
 
Join Date: May 2006
Posts: 1,854

Submissions (7)

Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)

Hero #4 extra-official winner2008 Spell olympics - Fire - BronzeHero Contest #3 - 3rd Place

Default

Ok I'll will and here it is

-Av3n
Attached Files
File Type: w3x Web -.w3x (38.5 KB, 13 views)
__________________

Thanks to FatherTime for the sig
.:
Current ProjectsSubmissions
Power of CorruptionMy Terrain
The Black RoadMy Resources
Strikeforce
Twitter
Av3n is offline   Reply With Quote
Old 09-12-2007, 03:21 PM   #40
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)

Default

A couple of small improvements:

Collapse JASS:
scope Web
// Web v4.00 Thrid Release By Av3n
//
// Please visit [url]www.wc3campaigns.net[/url] and [url]www.clancbs.com[/url] for more updates of this spell
//
// Requires
// - JASSHelper preprocessor by Vexorian
// - Collections by cohadar
//
// Credits to moyack, cohadar, blu_da_noob, Rising_Dusk and Anitarf 
// for the suggestions that changed my spell.

globals
    private integer sid = 'A002' //Web's spell id based on Healing Ward
    private integer aid = 'A001' //Web's aura checker id based on Devotion Aura
    private integer wid = 'e000' //Web's dummy unit type
    private integer bid = 'B001' //Web's aura checker buff id
    private real AoE = 150. //Web's AoE should match the aura fields and spell fields AoE
    private real cr = 0.1 //Check rate
    //Below are important are not to be touched
    private integer array spells
    private integer amount = 0
endglobals

private function Setup_Abi takes nothing returns nothing
    set spells[1] = 'A000' //Regen
    set spells[2] = 'A003' //Permhide
  // Set your spells to add here.
  //An example to add a new spell is like this
  // set spells[3] = 'A005'
  //then set amount = 3. remeber to change the array value as well in powers of 1 and don't start at 0
  // i.e
  // set spells[1] = 'A001'
  // set spells[2] = 'A002'
  // set amount = 2
  //The 'amount' specifies how much spells are added so any number after the 'amount' won't be added
    set amount = 2
endfunction

// <---- Updated collections to v2.1c ----> //
//! runtextmacro COLLECTION("Web", "private")
private struct Web
    unit c = null
    unit w = null
    integer l = 0
endstruct

globals
    private timer WebTimer = CreateTimer()
    //private integer WebCount = 0  // <--- You don't need web counter, size of collection does the same
endglobals

private function Web_Periodic takes nothing returns nothing
    local Web dat
    call IteratorWeb.reset()
    loop
        exitwhen IteratorWeb.noNext()
        set dat = IteratorWeb.next()
        if GetWidgetLife(dat.w) < 0.405 then
            set bj_forLoopAIndex = 0
            loop
                exitwhen bj_forLoopAIndex > amount
                call UnitRemoveAbility(dat.c,spells[bj_forLoopAIndex])
                set bj_forLoopAIndex = bj_forLoopAIndex + 1
            endloop
            call dat.destroy()
            call IteratorWeb.remove()
        elseif GetUnitAbilityLevel(dat.c,bid) > 0 or IsUnitInRange(dat.c,dat.w,AoE) then
            set bj_forLoopAIndex = 0
            loop
                exitwhen bj_forLoopAIndex > amount
                call UnitAddAbility(dat.c,spells[bj_forLoopAIndex])
                call SetUnitAbilityLevel(dat.c,spells[bj_forLoopAIndex],dat.l)
                set bj_forLoopAIndex = bj_forLoopAIndex + 1
            endloop
        else
            set bj_forLoopAIndex = 0
            loop
                exitwhen bj_forLoopAIndex > amount
                call UnitRemoveAbility(dat.c,spells[bj_forLoopAIndex])
                set bj_forLoopAIndex = bj_forLoopAIndex + 1
            endloop    
        endif
    endloop
    
    //if WebCount == 0 then
    if CollectionWeb.size() == 0 then
        call PauseTimer(WebTimer)
    endif
endfunction

private function Conditions takes nothing returns boolean
    return GetUnitTypeId(GetSummonedUnit()) == wid
endfunction

private function Actions takes nothing returns nothing
    local Web dat = Web.create()
    set dat.c = GetSummoningUnit()
    set dat.w = GetSummonedUnit()
    set dat.l = GetUnitAbilityLevel(dat.c,sid)
    call UnitAddAbility(dat.w,aid)
    call CollectionWeb.add(dat)
    
    //if WebCount == 0 then
    if CollectionWeb.size() == 0 then    
        call TimerStart(WebTimer,cr,true,function Web_Periodic)
    endif
endfunction

function InitTrig_Web takes nothing returns nothing
    local trigger t = CreateTrigger()
    call Setup_Abi()
    
    // Collections don't really need to be initialized manually
    // But doing this prevents lag when they are first time used
    // size of collection should be power of 2 for best initialization performance    
    call CollectionWeb.init(16)
    
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SUMMON)
    call TriggerAddCondition(t, Condition( function Conditions ) )
    call TriggerAddAction(t, function Actions )
    set t = null
endfunction
endscope

but it is only cosmetics, spell works fine in general.
I would approve it if I could.
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.
cohadar is offline   Reply With Quote
Old 09-13-2007, 07:35 AM   #41
Av3n
Roar!
 
Av3n's Avatar


Project Leader: TBR
Project Member: PoC
 
Join Date: May 2006
Posts: 1,854

Submissions (7)

Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)

Hero #4 extra-official winner2008 Spell olympics - Fire - BronzeHero Contest #3 - 3rd Place

Default

Thx alot for updating Collections I got the idea of using the collection fields more when I started to make abilities for Wc3WoW.

Oh you forgot to update the test map lol

-Av3n
__________________

Thanks to FatherTime for the sig
.:
Current ProjectsSubmissions
Power of CorruptionMy Terrain
The Black RoadMy Resources
Strikeforce
Twitter

Last edited by Av3n : 09-13-2007 at 07:38 AM.
Av3n is offline   Reply With Quote
Old 09-13-2007, 11:10 PM   #42
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

I've checked your spell, and it's now working perfectly.

Just a minor thing. in the JESP manifest, you put the spell name as " Create Web", please change it to "web" because it's actually the spell name :P

Because it's a minor fix, I'll approve right now.

*Approved*

EDIT: Now that I realized.... I've checked the file of this post. PLEASE put this file in the first post and update the code, because this is the one I approve.

Last edited by moyack : 09-13-2007 at 11:16 PM.
moyack is offline   Reply With Quote
Old 09-13-2007, 11:18 PM   #43
cohadar
master of fugue
 
cohadar's Avatar
 
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)

Default

Congrats Av3n you made it into JESP repository :D

You should also update your first post,
people expect to find the latest version there.
__________________
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.
cohadar is offline   Reply With Quote
Old 09-13-2007, 11:22 PM   #44
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

I am moving this back to submit a resource until it is confirmed it got the correct file is in the first post.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 09-13-2007, 11:25 PM   #45
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Thanks Vexorian :)
moyack 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 01:35 PM.


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

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