Spell Problems

simonake

New Member
Reaction score
72
I have 2 problems occuring with this trigger. (I started vJass tonight...Means it's my first spell)

1. When I click syntax check, it tells me that the text is out of function

2. My spell might contain mistakes, I wanted to know if there was leaks, defaults.
Obiously + rep if you help me finding bugs :D


JASS:

scope Mass Entangle Root initializer Init

globals
    private integer SPELL_LEVEL
    private player OWNER
endglobals
function C takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction
function CG takes nothing returns boolean
    return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction
function G takes nothing returns nothing
    local player a = OWNER
    local integer i = SPELL_LEVEL
    local unit genum = GetEnumUnit()
    local location gl = GetUnitLoc( genum)
    set dummy = CreateUnitAtLoc( a, 'h000', gl, 0.00)
    call UnitAddAbility( dummy, 'A001')
    call SetUnitAbilityLevel( dummy, 'A001, i)
    call IssueTargetOrder( dummy, "entangle", genum)
call RemoveLocation( gl)
 set a = null
 set genum = null
 set gl = null
 
endfunction
function A takes nothing returns nothing
    local unit c = GetTriggerUnit()
    local location cl = GetUnitLoc( c)
    local unit dummy
    set SPELL_LEVEL = GetUnitAbilityLevel( c, 'A000')
    set OWNER = GetOwningPlayer( c)
    local real range = 250.00 * I2R( l )
    local group inrange = GetUnitsInRangeOfLocMatching( range, cl, Condition( function CG)
    call ForGroup( inrange, function G)
 call RemoveLocation( cl)
  set c = null
  set inrange = null
  set cl = null
endfunction
//===========================================================================
function InitTrig_Mass_Entangle_Root takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function C ))
    call TriggerAddAction( t, function A )
endfunction

endscope
 

WolfieeifloW

WEHZ Helper
Reaction score
372
First off.
If this is 'simple' why can't you fix it?

And don't use the Syntax Check button.
It fails.

And why are you using locations :p ?
JASS is X/Y.
 

Sevion

The DIY Ninja
Reaction score
413
What is the exact error you get (If I had a penny for every time I said that... I'd be poor as fuck, but I'd have something... Maybe a candy bar)

Edit: Bah. No refresh == fail.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Yeah, Locations leak.
X/Y doesn't.

And cool.

And I'd help you but I have to do my King Lear essay soo... :p .
Sorry.


EDIT: Refresh wasn't originally set to fail Sevion.
So it's "...refresh = fail" :p .
 

Sevion

The DIY Ninja
Reaction score
413
Locations only leak if you don't remove the location and set the variable to null.
 

simonake

New Member
Reaction score
72
One more thing, I cannot play them. When I start wc3, I cannot play these maps -_- wtf?

There was no error -_- when i saved, everything went good.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
X/Y's don't leak no matter what you do :p .
It's only smart to use something that can't hurt you no matter what ;) .
 

Sevion

The DIY Ninja
Reaction score
413
Save then do Control + F9.

It may be an issue of you saving then scrolling around in the script or something.
 

Romek

Super Moderator
Reaction score
964
> scope Mass Entangle Root initializer Init
Scope names can't have spaces.
Also, you seem to be missing alot of ending brackets.

Every '(' needs a ')'.

Also, the 'Syntax Check' button doesn't support vJass, and requires the entire map script. Useless, really.
 

Sevion

The DIY Ninja
Reaction score
413
ROMY! Why did you have to see the obvious and make me miss it? :(

You used an illusion spell on me... T_T'

If you're parsing vJASS, use Save. Nothing else calls JassHelper unless you do it through the Command Prompt etc... But I think you'd rather use Save.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
After I read, I just feel it is bad coded. You haven't handle Jass properly, why go on to vJass?

Error : InitTrig_Mass_Entangle_Root
Correction : Init

Use this, this is fully MUI and better than yours 1 :
JASS:
scope MassEntangleRoot initializer Init

private function Cond takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function Act takes nothing returns nothing
    local unit c = GetTriggerUnit()
    local location cl = GetUnitLoc( c)
    local unit dummy
    local integer lv = GetUnitAbilityLevel( c, 'A000')
    local player p = GetOwningPlayer( c)
    local real range = 250. * lv
    local group inrange = CreateGroup()
    local unit temp
    call GroupEnumUnitsInRangeOfLoc(inrange,cl,range,null)
	
    loop
	set temp = FirstOfGroup(inrange)
    exitwhen temp == null
	if IsUnitEnemy(temp,p) == true then
	    set dummy = CreateUnit( p, 'h000', GetUnitX(temp),GetUnitY(temp), 0.00)
            call UnitAddAbility( dummy, 'A001')
	    call SetUnitAbilityLevel( dummy, 'A001', lv)
	    call IssueTargetOrder( dummy, "entangle", temp)
	    call UnitApplyTimedLife(dummy, 'BTLF', 1.2)
        endif
    endloop
	
    call DestroyGroup(inrange)
    call RemoveLocation( cl)
    set c = null
    set inrange = null
    set cl = null
    set dummy = null
    set p = null
    set temp = null
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( t, Condition( function Cond))
    call TriggerAddAction( t, function Act)
    set t = null
endfunction

endscope
 

Romek

Super Moderator
Reaction score
964
> ROMY! Why did you have to see the obvious and make me miss it?
Illusion Spell.

> You used an illusion spell on me... T_T'
Level 4 ;D

> After I read, I just feel it is bad coded. You haven't handle Jass properly, why go on to vJass?
vJass is an extension of Jass, and it makes Jassing easier.
There's no problem with learning about scopes and encapsulation before learning Jass fully. Init_Trig_Name functions suck. As do prefixes.

> Use this, this is fully MUI and better than yours 1 :
The point is that he learns how to do it himself, not gets other people to do it.
In fact, your one's pretty bad too. You don't remove units from the group in the FoG loop. So you'll hit the op. limit, and crash the thread.
You could also use a global group, to avoid destroying the groups.
 

Viikuna

No Marlo no game.
Reaction score
265
And that code sucks too. It would be way better, if you used only one global group and one global dummy unit + filterfunc for doing actions intead of FirstOfGroup loop.

Ans yea, you should learn vJass and normal Jass features side by side. Normal Jass alone is actually pretty horrible sometimes.
 

Tom Jones

N/A
Reaction score
437
Haha global unit for group enumeration, y'all've lost your marbles :D:nuts::confused: And just like that I used my smiley quota for the next month.
 

Viikuna

No Marlo no game.
Reaction score
265
Whats wrong with using global dummy unit for casting those entangling roots?

:confused: ( Me uses smileys too )
 

Tom Jones

N/A
Reaction score
437
There is nothing wrong with it, it's just utterly pointless.

Not to say that I never done it, I actually do it whenever I can:
JASS:
struct whatever
    unit u
    ...

    method ...
        call GroupEnumUnitsInRect(...)
        loop
            set whatever(0).u = FirstOfGroup(...)
            exitwhen whatever(0).u == null
            ...
            call GroupRemoveUnit(...,whatever(0).u)
        endloop
    endmethod
endstruct
 

Viikuna

No Marlo no game.
Reaction score
265
Since it is an AoE spell, and CreateUnit is probably the slowest native there is, it is efficient.

And you can also do all your actions in filterfunc, so you dont have to even do that loop.
 

Tom Jones

N/A
Reaction score
437
We're speaking past each other, I thought you meant using a global unit a enumeration unit.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top