Calling a JASS Function

Malice-

Endlessly Known
Reaction score
38
I found a good JASS Code by Vex from wc3sear.ch, only thing is, I'm not sure how to call it. I got the variables you need down, and I know the event is map initilization, but what is the action to call the code?

This may serve no purpose, but here is the code:
Code:
function CreepRespawn_CampLength takes nothing returns real
    return 500.0
endfunction
 
function CreepRespawn_WaitTime takes nothing returns real
    return 60.0
endfunction
 
function CreepRespawn takes nothing returns gamecache
    if (udg_creepcamps==null) then
        set udg_creepcamps=InitGameCache("creepcamps.c")
    endif
    return udg_creepcamps
endfunction
 
function CreepRespawn_H2I takes handle h returns integer
    return h
    return 0
endfunction
 
function CreepRespawn_GetCamp takes gamecache g, string k returns group
    return GetStoredInteger(g,k,"camp")
    return null
endfunction
 
function RespawnCreepCamp takes nothing returns nothing
    local unit u=GetTriggerUnit()
    local string k=I2S(CreepRespawn_H2I(u))
    local integer typeid = GetUnitTypeId(u)
    local gamecache g=CreepRespawn()
    local group camp=CreepRespawn_GetCamp(g,k)
    local real x=GetStoredReal(g,k,"sx")
    local real y=GetStoredReal(g,k,"sy")
    local real f=GetStoredReal(g,k,"sf")
    local rect r=bj_mapInitialPlayableArea
    if not( HaveStoredReal(g,k,"sx") ) then
    else
        call GroupRemoveUnit(camp,u)
        loop
            exitwhen FirstOfGroup(camp)==null
            call TriggerSleepAction(1)
        endloop
        call PolledWait(CreepRespawn_WaitTime())
        if IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) then
            call SetUnitOwner( u, Player(1), false)
            call ReviveHero( u, x, y, true)
            call SetUnitOwner( u, Player(12), false)
            call GroupAddUnit(camp,u)
        else
            call FlushStoredMission(g,k)
            set u=CreateUnit( Player(12), typeid, x,y,f )
            set k=I2S(CreepRespawn_H2I(u))
            call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl", u, "origin"))
            call StoreReal( g ,k,"sx", x )
            call StoreReal( g ,k,"sy", y )
            call StoreReal( g ,k,"sf", f )
            call StoreInteger(g,k,"camp",CreepRespawn_H2I(camp) )
            call GroupAddUnit(camp,u)
        endif
    endif
    set camp=null
    set u=null
    set g=null
    set r=null
endfunction
 
function StartCreepCampRespawn_Filter takes nothing returns boolean
    return IsUnitOwnedByPlayer( GetFilterUnit(), Player(12) ) and IsUnitInGroup(GetFilterUnit(),bj_groupRemoveGroupDest)
endfunction
 
function StartCreepCampRespawn takes nothing returns trigger
    local trigger t = CreateTrigger()
    local gamecache g=CreepRespawn()
    local boolexpr B=Condition(function StartCreepCampRespawn_Filter)
    local group r=CreateGroup()
    local group aux=CreateGroup()
    local group aux2=CreateGroup()
    local group c
    local unit u
    local string k
    call GroupEnumUnitsOfPlayer(r,Player(12), null)
    set bj_groupRemoveGroupDest=r
    loop
        set u=FirstOfGroup(r)
        exitwhen u==null
        call GroupRemoveUnit(r,u)
        set c=CreateGroup()
        set bj_groupAddGroupDest=c
        call GroupClear(aux)
        loop
            call GroupClear(aux2)
            call GroupEnumUnitsInRange(aux2,GetUnitX(u),GetUnitY(u),CreepRespawn_CampLength(),B)
            call GroupAddGroup(aux2,aux)
            call GroupRemoveUnit(aux,u)
            call GroupRemoveUnit(r,u)
            call GroupAddUnit(c,u)
            set k=I2S(CreepRespawn_H2I(u))
            call StoreReal( g ,k,"sx", GetUnitX(u) )
            call StoreReal( g ,k,"sy", GetUnitY(u) )
            call StoreReal( g ,k,"sf", GetUnitFacing(u) )
            call StoreInteger(g,k,"camp",CreepRespawn_H2I(c) )
            set u=FirstOfGroup(aux)
            exitwhen u==null
        endloop
    endloop
    call DestroyGroup(r)
    call DestroyGroup(aux)
    call DestroyGroup(aux2)
    call DestroyBoolExpr(B)
    set B=null
    set r=null
    set aux=null
    set aux2=null
    call TriggerRegisterPlayerUnitEvent( t, Player(12), EVENT_PLAYER_UNIT_DEATH,null )
    call TriggerAddAction( t, function RespawnCreepCamp )
    return t
endfunction
 
Well, I'll try that. I am fine with using triggers, but completly oblivious to JASS. This is my first JASS code used in a map. If what you just gave me doesn't work I am not sure I will be able to find what does, lol. Where do I look in the code to find this?
 
if you don't know what it does, why are you using it? or are you just curious? It could very well require certain units be created and setup in the object editor, and unless you have that information already you might not be able to get the trigger to work.

It's strange code that, the trigger gets registered at the bottom of the function...

hmm...this might be over even my head...
 
Ok well... I know what the code does. All the creep camps in your map will respawn automatically after a set amount of seconds, The function detects the creepcamps so all the members of a creep camp respawn at the same time.

But anways, the calling function, that Ryoko mentioned is right. Its just that it makes no sense to me. How would that tiny line work, when that whole code that i just showed you isnt even in the map anywhere? Is there somewhere in the editor that allows me to put that entire code into the map?
 
Okay.

You take all of vexorians stuff.

Create a blank trigger. Convert it to custom, and paste his stuff in. NOW its in your map.

Then from your map init, do the call function I showed you.

All functions are loaded when the map loads, so it knows where to find them.

// when you save your map, world editor builds the 'load list'.

Darg: World edit is like that, for whatever reason it puts all the children functions and condition functions in front of the main beef. Dunno why. Order is irrelevant though, because it loads them all when the map is loaded.
 
Okay... I got the function into the map, but I'm still getting the same error. It comes up and says this:
 
Hey, malice. I pointed this out in AIM, but the error is in this line:

call GroupEnumUnitsInRange(aux2,GetUnitX(u),GetUnitY(u),CreepRespawn_CampLe ngth(),B)

I wonder why Vex had this hole in his code and why others did not have trouble. I suppose they figured out the same :D

It, obviously, is just a simple spelling error. Apparently there is something strange about typing this in the thing because it has the same spelling error even when I fix it :D

Hole in the computer too.

Well, just look for where I put the asterisks and backspace those two spaces between Le and ngth. Then it will work.

--------------

It has come to my conclusion this is just a stupid wrapping of all forum code pretty much that ruins this :(

Anyway, this will solve the problem.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    Mayo also has vinegar. Vinegar is a very important part of it, it's effectively a delivery method FOR vinegar but hidden
    +1
  • Varine Varine:
    It's a neat ingredient. But yeah it's eggs. But a LOT of people think eggs count as dairy because of the fucking food pyramid the US keeps trying to make a thing
  • Varine Varine:
    I think on the new one they did change it, but idk. I don't really care whatever the government is doing right now because it's consistently absurd. Like what is RFK doing in charge of health anything? I love the bear story because WTF was that, but also, pretty much every time he talks it's WTF. Like even his voice sounds microwaved
    +1
  • Varine Varine:
    The pyramid is fucking dumb as shit, no matter how you arrange it.
  • Varine Varine:
    It's actually remarkably easy to make mayonnaise though. Fun fact, it USED to kind of be a French mother sauce. I believe that Careme considered it one, it may have been aioli but that has also built a different meaning than it used to. An aioli is just mayonnaise I mixed with other shit typically, I didn't start it don't come at me
  • Varine Varine:
    It's very hard to do it on a large scale though
  • Varine Varine:
    Depending on how you pour the oil the consistency can vary wildly, but that's true for most emulsions. I can only make about two quarts at a time with my robo coup, and if I have to make several in series because I forgot to order it becomes really obvious even when I do it. We have to wait and mix them all together to make sure we have the same thing.
  • Varine Varine:
    Hollandaise is also kind of like that, emulsions require a very steady hand to do exactly the same every time.
  • Varine Varine:
    Luckily I live in an age with electricity so it's way fucking faster, but when I was just a boy trying to find my place I had some hardcore chefs that made use do things like that by hand. It is WAY easier to get right by hand because you control it and can feel it, but it takes soooooo much longer. And on the scale a modern kitchen requires... I serve 400-500 guests on average per day right now, if I had 100 then we could do things way better
  • Varine Varine:
    But we can't do that. In the winter yeah, but I HAVE to get people through here right now so I can afford the staff that we CAN do that. We have about 100 days of summer, and if that summer doesn't make us what it will, then I can't operate the other most of the year with my staff. The owner is talking about closing two days a week to cut down on labor, I told him he should cut down on vacations and it did not go great. I do think I won though, I have to keep my fucking core staff and they have to be gainfully employed
  • Varine Varine:
    Sure some of them might take a second job, but I can't just cut my entire staff to unlivable hours, nor can I can cut them off all winter if I want them to come back.
  • Varine Varine:
    And also, there is no fucking way I'm pulling these hours come september. I only do this right now because I have to, the second I don't have to be the one doing it I won't be
  • Varine Varine:
    I have a 5 person core staff in the kitchen, not including me or Chef Ben
  • Varine Varine:
    Though two of those people are likely not making it this year. One of them has been replaced, the other I am kind of trying to. He's being a giant bitch, today I had to get onto him because in the three hours before I left he had taken like thirty minutes for cigarette breaks
  • Varine Varine:
    And he was also complaining to me the other day that he was out of weed so couldn't smoke any before work that day, and was confused about why I was annoyed he was telling me, his boss, that he is smoking weed everyday before work.
    +1
  • Varine Varine:
    Like yeah I can tell. I don't need to fucking know.
  • Varine Varine:
    So now he's getting scrutinized and will not be top of the list. I know I don't have the smartest people but I do expect them to have some common fucking sense
  • Varine Varine:
    I did do a rare thing for me and hire a girl last month without warning. Everyone was made at me because I started her at like 21, but she worked with me before and I was like don't care. She made 19 at her old job and I wanted her to come work with me, she is the best
    +1
  • Varine Varine:
    I'm going to get her a raise at the end of the summer. She wants to go to school again, but I want her to still work with me so.... she kind of can just tell me what the price is. I can go to 25 if she keeps up. I need to get her onto line more, that's what she wants, but I need her where she is and it's not fair that she doesn't get the little bit of raise that comes with it. She can do it no problem, I've worked with her there.
  • Varine Varine:
    It's just hard to move and train people unnecessarily right now. And also the line fucking sucks, it's not any more fun. This is turn and burn so I have the bankroll, and everyone suffers for it
  • Varine Varine:
    Eventually we'll get it balanced, we'
  • Varine Varine:
    we're starting online orders and stuff, but I also turn that off all the time because I barely keep up trying to be the best at Sysco shit
  • Varine Varine:
    I think it's gonna be a good fall and winter though. We're going to have a good staff, they will get along, they will be able to manage the workload and the complications, they know how to really cook this year, like every person on line knows their steak temps. Some of them use thermometers a lot and they don't always use them right, but they do know how to do it. Failure, especially in this field, is the only way to get better. They'll get it
  • Varine Varine:
    They won't get feel down while they do the thermometer, but we didn't have an instant read probe when I was learning. Like they did but god knows how off it is, you HAD to do it by feel. Even if the chef was fine with me bringing my own, it takes too long. Poke and know
  • The Helper The Helper:
    420 threads in the Artificial Intelligence forum :)

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top