Kindly turn into Jass Please n Thanks!

xoxdragonxox

New Member
Reaction score
1
I have a trigger that i would like to be made in JASS because Jass runs smoother and better :) not vjass i dont use NewGen :( and I'd really, and i mean really appreciate it if anyone could redo this in jass and not use hashtables please, Im pretty sure this can be done without hashtables!

Trigger:
  • On and Off
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to FollowFootman
    • Actions
      • Item - Remove (Item being manipulated)
      • Set T_Angle = (Facing of (Triggering unit))
      • Set T_Loc = (Position of (Triggering unit))
      • Set T_Loc2 = (T_Loc offset by 500.00 towards T_Angle degrees)
      • Unit - Create 1 footman for (Owner of (Triggering unit)) at T_Loc2 facing T_Angle degrees
      • Set T_Light = (Last created unit)
      • Unit - Turn collision for T_Light Off
      • Unit Group - Add (Triggering unit) to T_Holders
      • Hashtable - Save Handle OfT_Light as (Key light) of (Key (Triggering unit)) in T_Hashtable
      • Hashtable - Save T_isOn as (Key boolean) of (Key (Triggering unit)) in T_Hashtable
      • Custom script: call RemoveLocation (udg_T_Loc)
      • Custom script: call RemoveLocation (udg_T_Loc2)


Trigger:
  • Move
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
      • (Number of units in T_Holders) Greater than 0
    • Actions
      • Unit Group - Pick every unit in T_Holders and do (Actions)
        • Loop - Actions
          • Set T_Angle = (Facing of (Picked unit))
          • Set T_Loc = (Position of (Picked unit))
          • Set T_Loc2 = (T_Loc offset by 500.00 towards T_Angle degrees)
          • Set T_Light = (Load (Key light) of (Key (Picked unit)) in T_Hashtable)
          • Unit - Move T_Light instantly to T_Loc2
          • Custom script: call RemoveLocation (udg_T_Loc)
          • Custom script: call RemoveLocation (udg_T_Loc2)
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Jass = GUI.
GUI = Jass
For the periodic function, you can add condition to let it on and off.
 

Nherwyziant

Be better than you were yesterday :D
Reaction score
96
not vjass i dont use NewGen

Then get this
vJASS is so much better than vanilla jass.

If you wan't me to do it, then i'll do it in vJASS, I do not use plain JASS.

and using NewGen is very aweome
 

xoxdragonxox

New Member
Reaction score
1
I dont use newgen because it causes allot of conflicts with my map.

Yes newgen is awsome but when your making Converted tft to RoC it causes allot of problems, I have tried countless times before!

I would just like this in Vanilla Jass or how you guys like to call it lol
 

Bribe

vJass errors are legion
Reaction score
67
Please post the converted triggers in custom script format, and then if someone doesn't beat me to it I will provide you with functional vanilla JASS.
 

Jedi

New Member
Reaction score
63
I did this with locations, you can convert them to coordinates later when you learn.(Pause and destroy timer when you want to stop moving)
JASS:
function Trig_On_and_off_Conditions takes nothing returns boolean
    return GetItemTypeId(GetManipulatedItem()) == 'texp' //switch this texp with your item id
endfunction

function FollowFootman takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer id = GetHandleId(t)
    local unit light = LoadUnitHandle(udg_T_Hashtable, id, 0)
    local location lightloc = GetUnitLoc(light)
    local location loc = PolarProjectionBJ(lightloc, 500.00, GetUnitFacing(light))
    call SetUnitPositionLoc(light, loc)
    call RemoveLocation(lightloc)
    call RemoveLocation(loc)
    set t = null
    set light = null
    set lightloc = null
    set loc = null
endfunction

function Trig_On_and_off_Actions takes nothing returns nothing
    local unit itemer = GetTriggerUnit()
    local location itemerloc = GetUnitLoc(itemer)
    local location loc = PolarProjectionBJ(itemerloc, 500.00, GetUnitFacing(itemer))
    //I know i used locations, but he want to convert it to jass <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue    :p" loading="lazy" data-shortname=":p" />
    local unit light = CreateUnitAtLoc(GetOwningPlayer(GetTriggerUnit()), &#039;hfoo&#039;, loc, GetUnitFacing(itemer))
    local timer t = CreateTimer()
    local integer id = GetHandleId(t)
    call RemoveItem(GetManipulatedItem())
    call SetUnitPathing(light, false)
    // your hashtable&#039;s name is T_Hashtable, right?
    call SaveUnitHandle(udg_T_Hashtable, id, 0, light)
    call TimerStart(t, 0.04, true, function FollowFootman)
    call RemoveLocation(loc)
    call RemoveLocation(itemerloc)
    set itemer = null
    set loc = null
    set itemerloc = null
    set light = null
    set t = null
endfunction

//===========================================================================
function InitTrig_On_and_off takes nothing returns nothing
    set gg_trg_On_and_off = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_On_and_off, EVENT_PLAYER_UNIT_USE_ITEM)
    call TriggerAddCondition(gg_trg_On_and_off, Condition(function Trig_On_and_off_Conditions))
    call TriggerAddAction( gg_trg_On_and_off, function Trig_On_and_off_Actions)
endfunction
 

Bribe

vJass errors are legion
Reaction score
67
So I heard you wanted efficiency:

JASS:

function Trig_On_and_off_Enum           takes nothing returns boolean
    set bj_meleeNearestMine = GetEnumUnit()
    set bj_meleeNearestMineDist = GetUnitFacing(bj_meleeNearestMine) *bj_DEGTORAD

    call SetUnitX(bj_meleeNearestMine,GetUnitX(bj_meleeNearestMine) +500. *Cos(bj_meleeNearestMineDist))
    call SetUnitY(bj_meleeNearestMine,GetUnitY(bj_meleeNearestMine) +500. *Sin(bj_meleeNearestMineDist))
    return false
endfunction
function Trig_On_and_off_Loop           takes nothing returns nothing
    call ForGroup(udg_T_Holders,Filter(function Trig_On_and_off_Enum))
endfunction
    
function Trig_On_and_off_Conditions     takes nothing returns boolean
    if GetItemTypeId(GetManipulatedItem()) == &#039;texp&#039; then
        call RemoveItem(GetManipulatedItem())
        set bj_meleeNearestMine = GetTriggerUnit()
        set bj_meleeNearestMineDist = GetUnitFacing(bj_meleeNearestMine)
        call GroupAddUnit(udg_T_Holders,CreateUnit(GetTriggerPlayer(),&#039;hfoo&#039;,GetUnitX(bj_meleeNearestMine) +500. *Cos(bj_meleeNearestMineDist *bj_DEGTORAD),GetUnitY(bj_meleeNearestMine) +500. *Sin(bj_meleeNearestMineDist *bj_DEGTORAD),bj_meleeNearestMineDist))
    endif
    return false
endfunction
    
//===========================================================================
function InitTrig_On_and_off            takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_USE_ITEM)
    call TriggerAddCondition(t,Condition(function Trig_On_and_off_Conditions))

    call TimerStart(CreateTimer(), 0.04, true, function Trig_On_and_off_Loop)
endfunction


Just make sure that you have another trigger that removes the unit from this group... and... isn't 500. range every 0.04 seconds extreme?
 

xoxdragonxox

New Member
Reaction score
1
So I heard you wanted efficiency:

JASS:

function Trig_On_and_off_Enum           takes nothing returns boolean
    set bj_meleeNearestMine = GetEnumUnit()
    set bj_meleeNearestMineDist = GetUnitFacing(bj_meleeNearestMine) *bj_DEGTORAD

    call SetUnitX(bj_meleeNearestMine,GetUnitX(bj_meleeNearestMine) +500. *Cos(bj_meleeNearestMineDist))
    call SetUnitY(bj_meleeNearestMine,GetUnitY(bj_meleeNearestMine) +500. *Sin(bj_meleeNearestMineDist))
    return false
endfunction
function Trig_On_and_off_Loop           takes nothing returns nothing
    call ForGroup(udg_T_Holders,Filter(function Trig_On_and_off_Enum))
endfunction
    
function Trig_On_and_off_Conditions     takes nothing returns boolean
    if GetItemTypeId(GetManipulatedItem()) == &#039;texp&#039; then
        call RemoveItem(GetManipulatedItem())
        set bj_meleeNearestMine = GetTriggerUnit()
        set bj_meleeNearestMineDist = GetUnitFacing(bj_meleeNearestMine)
        call GroupAddUnit(udg_T_Holders,CreateUnit(GetTriggerPlayer(),&#039;hfoo&#039;,GetUnitX(bj_meleeNearestMine) +500. *Cos(bj_meleeNearestMineDist *bj_DEGTORAD),GetUnitY(bj_meleeNearestMine) +500. *Sin(bj_meleeNearestMineDist *bj_DEGTORAD),bj_meleeNearestMineDist))
    endif
    return false
endfunction
    
//===========================================================================
function InitTrig_On_and_off            takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_USE_ITEM)
    call TriggerAddCondition(t,Condition(function Trig_On_and_off_Conditions))

    call TimerStart(CreateTimer(), 0.04, true, function Trig_On_and_off_Loop)
endfunction


Just make sure that you have another trigger that removes the unit from this group... and... isn't 500. range every 0.04 seconds extreme?


Im getting syntax errors with this, I get errers like the trigger needs an InitTrig then when i remove the spaces between the function InitTrig_On_and_off takes nothing returns nothing that error is fixed but there is still a bunch of other syntaxs saying invalid filter or whatever
 

Bribe

vJass errors are legion
Reaction score
67
Yeah, you have to replace this JASS code with the "On and off" trigger that you have, otherwise it won't work. Delete the "move" trigger as this one contains both of them.
 

xoxdragonxox

New Member
Reaction score
1
The trigger name is right, I removed the move trigger, i tried to remove all the spacing in the trigger so it all looked normal. And still i get the same syntax errors. =[

i tried it this way

JASS:
function Trig_On_and_off_Enum           takes nothing returns boolean
    set bj_meleeNearestMine = GetEnumUnit()
    set bj_meleeNearestMineDist = GetUnitFacing(bj_meleeNearestMine) *bj_DEGTORAD

    call SetUnitX(bj_meleeNearestMine,GetUnitX(bj_meleeNearestMine) +500. *Cos(bj_meleeNearestMineDist))
    call SetUnitY(bj_meleeNearestMine,GetUnitY(bj_meleeNearestMine) +500. *Sin(bj_meleeNearestMineDist))
    return false
endfunction
function Trig_On_and_off_Loop           takes nothing returns nothing
    call ForGroup(udg_T_Holders,Filter(function Trig_On_and_off_Enum))
endfunction
    
function Trig_On_and_off_Conditions     takes nothing returns boolean
    if GetItemTypeId(GetManipulatedItem()) == &#039;texp&#039; then
        call RemoveItem(GetManipulatedItem())
        set bj_meleeNearestMine = GetTriggerUnit()
        set bj_meleeNearestMineDist = GetUnitFacing(bj_meleeNearestMine)
        call GroupAddUnit(udg_T_Holders,CreateUnit(GetTriggerPlayer(),&#039;hfoo&#039;,GetUnitX(bj_meleeNearestMine) +500. *Cos(bj_meleeNearestMineDist *bj_DEGTORAD),GetUnitY(bj_meleeNearestMine) +500. *Sin(bj_meleeNearestMineDist *bj_DEGTORAD),bj_meleeNearestMineDist))
    endif
    return false
endfunction
    
//===========================================================================
function InitTrig_On_and_off            takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_USE_ITEM)
    call TriggerAddCondition(t,Condition(function Trig_On_and_off_Conditions))
    call TimerStart(CreateTimer(), 0.04, true, function Trig_On_and_off_Loop)
endfunction



and this way

JASS:
function Trig_On_and_off_Enum takes nothing returns boolean
    set bj_meleeNearestMine = GetEnumUnit()
    set bj_meleeNearestMineDist = GetUnitFacing(bj_meleeNearestMine) *bj_DEGTORAD
    call SetUnitX(bj_meleeNearestMine,GetUnitX(bj_meleeNearestMine) +500. *Cos(bj_meleeNearestMineDist))
    call SetUnitY(bj_meleeNearestMine,GetUnitY(bj_meleeNearestMine) +500. *Sin(bj_meleeNearestMineDist))
    return false
endfunction

function Trig_On_and_off_Loop takes nothing returns nothing
    call ForGroup(udg_T_Holders,Filter(function Trig_On_and_off_Enum))
endfunction
    
function Trig_On_and_off_Conditions     takes nothing returns boolean
    if GetItemTypeId(GetManipulatedItem()) == &#039;texp&#039; then
        call RemoveItem(GetManipulatedItem())
        set bj_meleeNearestMine = GetTriggerUnit()
        set bj_meleeNearestMineDist = GetUnitFacing(bj_meleeNearestMine)
        call GroupAddUnit(udg_T_Holders,CreateUnit(GetTriggerPlayer(),&#039;hfoo&#039;,GetUnitX(bj_meleeNearestMine) +500. *Cos(bj_meleeNearestMineDist *bj_DEGTORAD),GetUnitY(bj_meleeNearestMine) +500. *Sin(bj_meleeNearestMineDist *bj_DEGTORAD),bj_meleeNearestMineDist))
    endif
    return false
endfunction
    
//===========================================================================
function InitTrig_On_and_off takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_USE_ITEM)
    call TriggerAddCondition(t,Condition(function Trig_On_and_off_Conditions))
    call TimerStart(CreateTimer(), 0.04, true, function Trig_On_and_off_Loop)
endfunction
 

Bribe

vJass errors are legion
Reaction score
67
My bad. I'm used to filtering groups instead of enumerating them. Change this:

JASS:
call ForGroup(udg_T_Holders,Filter(function Trig_On_and_off_Enum))

// to this:

call ForGroup(udg_T_Holders,function Trig_On_and_off_Enum)


BTW: whitespace doesn't matter.

JASS:

call             ForGroup           (              udg_T_Holders        ,     function Trig_On_and_off_Enum       )

// is the same as 

call ForGroup(udg_T_Holders,function Trig_On_and_off_Enum)
 
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