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.

      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