Jass Question about functions and looping

mems

Memory Lapse
Reaction score
24
Question 1:
----------------------------------------
i have a function:
Code:
function DemageUnits takes unit Tar, unit Cast returns nothing
        call UnitDamageTargetBJ( Cast, GetEnumUnit(), 50.00, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL )
        call SetUnitPositionLoc( GetEnumUnit(), PolarProjectionBJ(GetUnitLoc(Tar), 200.00, AngleBetweenPoints(GetUnitLoc(Tar), GetUnitLoc(GetEnumUnit()))) )
endfunction

and im calling it there:
Code:
call ForGroupBJ( GetUnitsInRectAll(RectFromCenterSizeBJ(GetUnitLoc(Target), 200.00, 200.00)), function DemageUnits(Target, Caster) )

Simply this supposed to be a true usage according to edit-->Convert to Custom tex. Only thingthat i did is making DemageUnits() take variables instead of using Global(udg) variables. and i call them with sending them local variables when i need them. BUT when im trying to save the trigger it gives error and says:
Expected '
I have tryed to check the whole trigger and functions 1 by 1 on a syntax checker and it says there is a pharse error on line:
call ForGroupBJ( GetUnitsInRectAll(RectFromCenterSizeBJ(GetUnitLoc(Target), 200.00, 200.00)), function DemageUnits(Target, Caster) )
at or near ( and )

simply its becouse of "DemageUnits(Target, Caster)"
This function ForGroupBJ() is picking all units around 200x200 Target and does DemageUnits function
In DemageUnits function is moves picked unit away from Target and Deals 50 Demage from Caster to picked unit.
i could not find what am i doing wrong :( anyone help me?

Question 2:
------------------------------------------------------------
I made a spell that moves the targeted unit away from casting unit, likes pushing units away from you.
I made the spell with triggers that works really fine for me but have to use 2 triggers for this spell and i wanted to do it in 1 trigger to enable the local variables. Couse with out them spell will be useless.

Simply i used an initially off trigger which runs every 0.03 gametime seconds and continue running untill i turn off it on main spell trigger which makes the unit slide.

But when i try to do it in 1 trigger in a loop i get a bad effect couse
wait(0.01) is takes too much also waiting in game time with same value does not has a differnt effect and unit warps from 1 point to another slow like hell which makes the spell nothing. Here is what have i tried with triggers:
Code:
For each (Integer A) from 1 to 30, do (Actions)
    Loop - Actions
        Unit - Move target instantly to ((Position of target) offset by 20.00 towards angel degrees), facing point
        Wait 0.01 seconds

but if i use the single line (unit move) in another trigger on events every 0.03 gametime it slides the unit perfectly fast

My question is is there a way to have a fast loop with jass. I have an idea but i dont know how to do it if anyone can help;

I will make the (move line) a function(it also includes loads of other actions) and will create a timer and try to mix it with one shot timer something like:
call Timer(Timer, 0.03, true MoveFunction(Parameters))

Becouse of the other problem that i asked above i could not use that style or test it too also i dont know how to use the timer functions in Jass nor in Triggers alot :( i need an urgent help please

Ps: yes I have readed the Jass Manual site
Ps: I dont use WEU Please don't tell me about slide function :( also i want my spell can be opened edited and used by everyone else so i will not dl WEU
 
S

ShaiTan-Enk

Guest
Well since you're writing the spell with JASS, it's highly likely that anyone who would understand it anyway would be a mapmaker, and therefore have WEU. And I believe if you use WEU functions and then turn the entire trigger into JASS, it's openable in the regular editor because it's all JASS.

So you might as well get WEU and make it easy on yourself :D
I don't know JASS, or I'd be able to help. Sorry.
 

mems

Memory Lapse
Reaction score
24
is it possible to have WEU and WE at same time?
anyway i m searching for answer for the question above :banghead:
 
S

ShaiTan-Enk

Guest
Yes it is, you can open either one. WEU doesn't affect WE at all unless you open WEU. It's like it creates a new WE with the WEU options, but it doesn't change the original WE.

I have an idea for your second question, which is this - when you want a unit to slide, turn on the trigger that works every .03 gametime, and at the same time turn on a trigger that works every .9 gametime. The .03 trigger moves it, and the .9 trigger turns off the .03 trigger and itself :D

Maybe that will work, GL
 

mems

Memory Lapse
Reaction score
24
the problem is i cannot use 2 triggers to enable local variables mate
 
S

ShaiTan-Enk

Guest
That's a good point. But only one of them would be enabling/using the local variable, the other one would just be shutting off the first one. It's like having a timed trigger.

Or am I just not understanding that that still affects the local variables?
 

mems

Memory Lapse
Reaction score
24
okay let me explane why i need only 1 trigger and what enables disables local variables.

Simply
Trigger starts
a unit casts an ability
im doing something
then turning on moving trigger,
wait sometime
Then turnin of the moving trigger
im doing something more here
trigger ends

I have the hero with that spell and another user has it too. I take all tingies in variables couse its needed to be.
When i cast this spell, My Caster variable defines my hero. with this variable i make demage, movement and needed points and angles.

But even after me another player casted this spell too then Caster variable now defines the other player so all my actions will continue according to other player. demage will be done by other player unit will warph around silly points becouse of the angel and points and also his target unit will move and get demaged and moving around silly positions some units are stunned forever some units are moving forever OMG thats a Chaos!

Okay local variables are to solve this kind of problems then i use local variables to mke this spell with in 2 triggers. I casted the spell actions made and the trigger turned on. But even after me another one casted this spell and turned off on the trigger that i have turned off or still running. Again Chaos my targeted unit will move and warp around again continuesly again and again.... Also u again need at least 2 global variables to control 2 triggers couse triggers cannot know the other triggers local variables so how the second trigger will move my unit?.. get it now?

I have downloded WEU. I used the slide ability i have changed it to custom text OMG there is a function called MakeUnitSlide there is not a function in WE and in game .j Libraries. So this map cannot be opened with WE again. I searched inside of the editor finded the MakeUnitSlide function. it uses another function called Smash and when i looked inside it it does what exacltly i have doing with 2 triggers! And it uses tricked Global variables. And it slides the unit across inside cliffs, outside from playeble map area and camera bounds! this function is even buggy with its tricked global variables and it adds about 200kb waste .j file to my map for only a single buggy function!...

Come on none of you know about Jass?
 
D

dArKzEr0

Guest
Mems, for the sliding one, you don't need variables at all. I managed to make the spell all in one trigger and without variables, and it looks pretty snazzy if you ask me, considering you would normally need two triggers to make the push look "smooth". Anyway, I'll PM it to you now.
 

mems

Memory Lapse
Reaction score
24
none of this calltriggersleepaction()'s will give mte smooty of the spell i think its about handle variables and CountDownTimer couse count down timer will run as fast as a trigger IMO but i dunno how to use them :(
 

xPheRe

New Member
Reaction score
43
The ForGroup params are a unit-group and a callback function.
Then for each unit in the unit-group, it stores the unit in a global (this one is get with the GetEnumUnit() func) and then calls the callback function.
The sintax of the callback is a function with no parameters.
It means it's impossible to have params in the callback function like you are trying to do.
At least without using globals or other stuff like Game Caches.
 

mems

Memory Lapse
Reaction score
24
Game Caches?
handles.. OMG how i could'nt i think that
ty wery much i think i can do this spell YAY!

Edit:
i made the spell and finished it. thanks to all peope who are trying to help me and thanks to game cache! :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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
    +2
  • 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