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
 
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.
 
is it possible to have WEU and WE at same time?
anyway i m searching for answer for the question above :banghead:
 
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
 
the problem is i cannot use 2 triggers to enable local variables mate
 
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?
 
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?
 
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.
 
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 :(
 
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.
 
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.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top