Help with first real vjass attempt

BRUTAL

I'm working
Reaction score
118
well i decided to give jass another shot.
im trying to recreate my spell 'ice trap' in vjass, so far im getting there.
a few question though; in the loop function i put the sleep function so the units arent all created instantly, but its rather slow >< whys that?
so how do you make a like..periodic event type of function within the trigger cause ive noticed vjass spells are made in one trigger, like a meathook.
do i need to use a system like ,tt? whatever that is? ><
anyways heres my trigger
JASS:
scope IceTrap initializer Init

//   ________________________________________
// ||                                        ||
// || Modify below                           ||
// ||________________________________________||

globals
    private constant integer Spellid = &#039;A001&#039;      // Raw code of Ice Trap ability
    private constant integer Dummyid = &#039;h007&#039;     // Raw code of Ice Trap ability
    private constant real MaxUnits   = 360       // Number of units made to complete the circle
    private constant real AOE        = 290      //Base AOE of spell, each level AOE gets bigger
endglobals
  
//   ________________________________________
// ||                                        ||
// || Do not modify                          ||
// ||________________________________________||

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == Spellid
endfunction

function Actions takes nothing returns nothing
    local unit ITCaster = GetSpellAbilityUnit()
    local real ITDuration = (6 + (3 * I2R(GetUnitAbilityLevelSwapped(&#039;A001&#039;, ITCaster))))
    local location ITTargetPoint = GetSpellTargetLoc()
    local real ITTimer = 0
    local real ITAngle = ( GetUnitFacing(ITCaster) + 140.00 )    
    local location ITTargetPos = PolarProjectionBJ(ITTargetPoint, ( AOE + ( I2R(GetUnitAbilityLevelSwapped(&#039;A001&#039;, ITCaster)) * 20.00 ) ), ITAngle)
    local rect ITCreateRect = RectFromCenterSizeBJ(ITTargetPoint, 100.00, 100.00)
    call SetUnitFacingToFaceLocTimed( ITCaster, ITTargetPoint, 0 )
    call AddWeatherEffectSaveLast( ITCreateRect, &#039;SNls&#039; )
    call EnableWeatherEffect( GetLastCreatedWeatherEffect(), true )
    call RemoveRect ( ITCreateRect )
    loop
        exitwhen ITTimer == MaxUnits
            set ITTimer = (ITTimer + 10)
            set ITTargetPos = PolarProjectionBJ(ITTargetPoint, ( AOE + ( I2R(GetUnitAbilityLevelSwapped(&#039;A001&#039;, ITCaster)) * 20.00 ) ), (ITAngle + ITTimer ))
            call CreateNUnitsAtLocFacingLocBJ( 1, Dummyid, GetOwningPlayer(ITCaster), ITTargetPos, ITTargetPoint )
            call UnitAddAbilityBJ( &#039;A002&#039;, GetLastCreatedUnit() )
            call SetUnitAbilityLevelSwapped( &#039;A002&#039;, GetLastCreatedUnit(), GetUnitAbilityLevelSwapped(&#039;A001&#039;, ITCaster) )
            call IssueImmediateOrderBJ( GetLastCreatedUnit(), &quot;immolation&quot; )
            call UnitApplyTimedLifeBJ( ( ITDuration), &#039;BTLF&#039;, GetLastCreatedUnit() )
            call SetTerrainPathableBJ( ITTargetPos, PATHING_TYPE_WALKABILITY, false )
            call TriggerSleepAction(0.01)
        endloop        
endfunction


//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Condition(function Conditions))
    call TriggerAddAction(t, function Actions)
endfunction

endscope


also, how would i go about making the pathing walkable after the amount of time it takes for the units created in a circle to die?

again this is my first attempt at jass, so if something is wrong help is welcome : o
 

Kenny

Back for now.
Reaction score
202
TriggerSleepActions dont go as low as 0.01 i believe. They stop at like 0.10 or something. If you want to create them one after another you will need a timer, and with that an attachment system, or you could use a static timer loop.

On another note: this spell seems very similar to my Earth Prison spell i just submitted, i would say check it out, but if you are just beginning jass you might not get too much out of it.

Oh and 360 units for a cirlce is freaking huge, and it may cause lag. I got it down to 25 as long as all units have 32 collision size.
 

BRUTAL

I'm working
Reaction score
118
oh i see
but i submitted this spell in gui in july D:
ah that actually is wrong, i didnt fix it really so people would think that
its actually 36 units cause;
JASS:
exitwhen ITTimer == MaxUnits
            set ITTimer = (ITTimer + 10)

:p

edit*
nvm, i thought when you referenced your spell you were saying i copied you or such XD but you ment to see how you did it, right? : o
 

Kenny

Back for now.
Reaction score
202
IMO TSA's and PolledWaits are gay, stay away from them, its just as easy to do everything via a timer if you know what you are doing. Also TSA's and PolledWaits are crap for online play because they wait through lag and delay or something like that. At least thats what i've heard.

EDIT:

No they are not accurate, well at least not very, while timers are very precise.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
They may be "gay", but some of us, I for one, find timers confusing (at least for now).
Although BRUTAL, you may want to get someone to help you attach a timer for this, as this is sort've dependant on that wait.
 

BRUTAL

I'm working
Reaction score
118
i see
i'll look into timers and such, but i just learned basic jass so its probably going to be confusing :p
but, how do you remove leaks from a local variable in jass, example a point variable
call RemoveLocation (name of local point variable) ?
 

WolfieeifloW

WEHZ Helper
Reaction score
372
I believe that's how you do it, yes (that's how I do it anyways :eek: ) .
Also, don't forget to null units ;) !
 
Reaction score
341
how do you remove leaks from a local variable in jass, example a point variable
call RemoveLocation (name of local point variable) ?

call RemoveLocation(localname)

Remember there is no udg_ unless it is a variable created by the GUI variable editor.

And you null pretty much any local variable that leaks at the end of your function.
 

Kenny

Back for now.
Reaction score
202
Also, don't forget to null units

Not just units, locations, effects, timers, destructables and much more.

Oh and:

nvm, i thought when you referenced your spell you were saying i copied you or such XD but you ment to see how you did it, right?

Yes i was just refering you too it because it may help.

EDIT:

Beat me too it...
 

BRUTAL

I'm working
Reaction score
118
yeayea, locals dont need udg_
i just got a syntax error for putting the 'call RemoveLocation ITTargetPos' inside the loop : s
JASS:
loop
        exitwhen ITTimer == MaxUnits
            set ITTimer = (ITTimer + 10)
            set ITTargetPos = PolarProjectionBJ(ITTargetPoint, ( AOE + ( I2R(GetUnitAbilityLevelSwapped(&#039;A001&#039;, ITCaster)) * 20.00 ) ), (ITAngle + ITTimer ))
            call CreateNUnitsAtLocFacingLocBJ( 1, Dummyid, GetOwningPlayer(ITCaster), ITTargetPos, ITTargetPoint )
            call UnitAddAbilityBJ( &#039;A002&#039;, GetLastCreatedUnit() )
            call SetUnitAbilityLevelSwapped( &#039;A002&#039;, GetLastCreatedUnit(), GetUnitAbilityLevelSwapped(&#039;A001&#039;, ITCaster) )
            call IssueImmediateOrderBJ( GetLastCreatedUnit(), &quot;immolation&quot; )
            call UnitApplyTimedLifeBJ( ( ITDuration), &#039;BTLF&#039;, GetLastCreatedUnit() )
            call SetTerrainPathableBJ( ITTargetPos, PATHING_TYPE_WALKABILITY, false )
            call RemoveLocation ITTargetPos 
            call TriggerSleepAction(0.01)
        endloop
 

WolfieeifloW

WEHZ Helper
Reaction score
372
You should look into changing all those BJ's into their natives also.
I could probably help you with some of that, if you want.
 
General chit-chat
Help Users
  • Ghan Ghan:
    Howdy
  • 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
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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