(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Modding > World Editor Help Zone

World Editor Help Zone Need help with Blizzard's World Editor? Ask general questions about its features and use in this forum. README!

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 05-13-2007, 07:04 AM   #1 (permalink)
 
Marcelo Hossomi's Avatar

Brazil Fan
 
Join Date: Dec 2005
Posts: 415

Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)


Problem with Handle Var

Hello everyone!
I've been trying to make a spell that increases level with each attack. Ya, it's easy so far, but I also want to create Wisps around the hero for each level.

I'm using KaTTaNa's Local Handle Variables. I'm having trouble to keep the Group in the Attacker:

    local group G = GetHandleGroup(Caster, "Group")
    local integer Counters = GetHandleInt(Caster, "Counters")
    local unit U
    set Counters = Counters + 1

    if G == null then
        set G = CreateGroup()
    endif

    set U = CreateUnit(GetOwningPlayer(Caster), 'e001', GetUnitX(Caster), GetUnitY(Caster), 72 * I)
    call GroupAddUnit(G, U)
    call SetHandleHandle(Caster, "Group", G)
    call SetHandleInt(Caster, "Counters", Counters)
    set G = null
    set U = null

G = Group of Wisps
Counters = Number of Wisps
e001 = Wisp

When G is null, the unit is added normally, but from the second attack on, the group has no units. The variable Counters is kept normally.

I've been trying this spell since a year ago =/
Thanks for your time
Hossomi
__________________

YIN-YANG BATTLE - remaking
too disorganized!

WIZARDS ARENA - active
TERRAINiii - HEROESiiii - EVENTSiiii

Marcelo Hossomi is offline  
Old 05-13-2007, 02:16 PM   #2 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

First note: you don't need a unit variable.

Second note: handles are only referenced with the Handle Vars, thus you shouldn't need to reattach them

Third note: the reference shouldn't asplode unless you run FlushHandleLocals() or just attach 'null' to "Group"

Fourth note: it's more efficient to store g as CreateGroup() when you create the group rather than running an if-statement every interval.

The code should come out something like this (assuming G was also attached as CreateGroup(), not null)

call GroupAddUnit(GetHandleGroup(Caster,"Group"),CreateUnit(GetOwningPlayer(Caster),'e001',GetUnitX(Caster),GetUnitY(Caster),72*I))
call SetHandleInt(Caster,"Counters",GetHandleInt(Caster,"Counters")+1)

(this assumes you don't reuse Counters in that execution. If you do, you can do the following instead of the above Counters line)

local integer Counters = GetHandleInt(Caster,"Counters")+1
call SetHandleInt(Caster,"Counters",Counters)
//do other stuff with Counters here

EDIT: Please post in the JASS forum next time you have a JASS question ><. It helps keep the forums to order, and you'll also probably get more help there
PurplePoot is offline  
Old 05-13-2007, 06:50 PM   #3 (permalink)
 
Marcelo Hossomi's Avatar

Brazil Fan
 
Join Date: Dec 2005
Posts: 415

Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)


I guess you are getting tired of trying to help me xD

I'll try everything you said (you answered other three questions I was going to ask at once =P)

Indeed, thank you for helping me since wc3search!
Sorry for the inconvenience =P

EDIT:

Oh God... Here's the whole function:
function AddCounter takes nothing returns nothing
    local unit Caster = GetEventDamageSource()
    local integer Counters = GetHandleInt(Caster, "Counters") + 1

    call DestroyTrigger(GetTriggeringTrigger())
    call BJDebugMsg(I2S(Counters)) // Shows Counters, which is alright

    if Counters > 5 then
        return
    endif

    call GroupAddUnit(GetHandleGroup(Caster, "Group"), CreateUnit(... 'e001' ...))
    call BJDebugMsg(I2S(CountUnitsInGroup(GetHandleGroup(Caster, "Group")))) //Shows always 0
    call SetHandleInt(Caster, "Counters", Counters)
    set Caster = null
endfunction

This way it seems that the units are never added to the group. However, why should the "GroupAddUnit" be not working?

If I write this way...
function AddCounter takes nothing returns nothing
    local unit Caster = GetEventDamageSource()
    local integer Counters = GetHandleInt(Caster, "Counters") + 1

    call DestroyTrigger(GetTriggeringTrigger())
    call BJDebugMsg(I2S(Counters)) // Shows Counters, which is alright

    if Counters > 5 then
        return
    endif

    if GetHandleGroup(Caster, "Group") == null then
        call SetHandleHandle(Caster, "Group", CreateGroup())
    endif

    call GroupAddUnit(GetHandleGroup(Caster, "Group"), CreateUnit(... 'e001' ...))
    call BJDebugMsg(I2S(CountUnitsInGroup(GetHandleGroup(Caster, "Group")))) //Shows 1 for the first attack, then 0
    call SetHandleInt(Caster, "Counters", Counters)
    set Caster = null
endfunction

There will be 1 unit in the group, but from the second attack on, it seems that the group has not been initialized, because the DebugMsg will return 0. Why did the previous unit disappear?

Thanks for your time again... Actually you're losing your patience, I think...
__________________

YIN-YANG BATTLE - remaking
too disorganized!

WIZARDS ARENA - active
TERRAINiii - HEROESiiii - EVENTSiiii


Last edited by Marcelo Hossomi; 05-13-2007 at 08:30 PM.. Reason: Imma noob
Marcelo Hossomi is offline  
Old 05-13-2007, 08:44 PM   #4 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

Try posting the function that initializes the damage trigger for that as well

Quote:
Thanks for your time again... Actually you're losing your patience, I think...
What gave you that impression? ><
PurplePoot is offline  
Old 05-13-2007, 11:10 PM   #5 (permalink)
 
Marcelo Hossomi's Avatar

Brazil Fan
 
Join Date: Dec 2005
Posts: 415

Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)


Here's the initial function:
function Counters takes nothing returns nothing
    local trigger T = CreateTrigger()
    call TriggerAddAction( T, function AddCounter )
    call TriggerRegisterUnitEvent( T, GetTriggerUnit(), EVENT_UNIT_DAMAGED )
    set T = null
endfunction

Quote:
Originally Posted by PurplePoot View Post
What gave you that impression? ><
It wasn't you, but I hate to keep asking the same thing for so much time =/
At wc3search my topic filled three pages with your posts and mine xD
__________________

YIN-YANG BATTLE - remaking
too disorganized!

WIZARDS ARENA - active
TERRAINiii - HEROESiiii - EVENTSiiii

Marcelo Hossomi is offline  
Old 05-14-2007, 12:07 AM   #6 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

As I said, with my way, that should be

function Counters takes nothing returns nothing
    local trigger T = CreateTrigger()
    call TriggerRegisterUnitEvent(T,GetTriggerUnit(),EVENT_UNIT_DAMAGED)
    call TriggerAddAction(T,function AddCounter)
    call SetHandleHandle(T,"Group",CreateGroup()
    set T = null
endfunction
Since mine skipped out on the if/then
PurplePoot is offline  
Old 05-14-2007, 07:31 PM   #7 (permalink)
 
Marcelo Hossomi's Avatar

Brazil Fan
 
Join Date: Dec 2005
Posts: 415

Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)Marcelo Hossomi has little to show at this moment (30)


I did as you said but, no use =/
I think you meant call SetHandleHandle(GetAttacker(), "Group", CreateGroup()) or am I wrong? Because I don't see why to do this to the trigger, since it will be destroyed =P

Greatest EDIT of my life:
MAN IT WORKS =D
I don't even know what I changed xD
But it works =D

(Thanks³)² PurplePoot =P
Yin-Yang will protect you for your life and eternity!
__________________

YIN-YANG BATTLE - remaking
too disorganized!

WIZARDS ARENA - active
TERRAINiii - HEROESiiii - EVENTSiiii


Last edited by Marcelo Hossomi; 05-14-2007 at 08:13 PM..
Marcelo Hossomi is offline  
Old 05-14-2007, 08:35 PM   #8 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

Whoopsie, yeah, I did.
PurplePoot is offline  
Old 05-15-2007, 11:02 PM   #9 (permalink)
Spell and Map Moderator
 
Dr Super Good's Avatar

The Helpful Personage
 
Join Date: Jan 2005
Posts: 4,269

Dr Super Good is a name known to all (691)Dr Super Good is a name known to all (691)Dr Super Good is a name known to all (691)Dr Super Good is a name known to all (691)


This should be in the triggers(JASS) section not in the WEHZ.
Dr Super Good is offline  
Old 05-15-2007, 11:49 PM   #10 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

Quote:
Originally Posted by PurplePoot
EDIT: Please post in the JASS forum next time you have a JASS question ><. It helps keep the forums to order, and you'll also probably get more help there
><
PurplePoot is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[JASS] Handle Var Systems Homicide13 Triggers & Scripts 8 11-03-2007 09:30 AM
[JASS] Trouble with handle variables Trashbite Triggers & Scripts 3 09-10-2007 04:30 AM
moderators who handle how they like to do it? dhk_undead_lord Off-Topic 16 01-13-2007 12:23 PM
[JASS] Item Handle Dr.Nitro Triggers & Scripts 2 12-03-2005 12:52 AM
[JASS] explain handle? wikidme Triggers & Scripts 4 09-29-2004 06:24 PM

All times are GMT. The time now is 04:58 AM.






Your link here 
Mortgages | Magazine Subscriptions | Banruptcy | Remortgages | Mobile Phones
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Copyright©Ralle