Somebody can teach me to jass? i need patience

and? x y is coordinate in screen because is real?

bump!

i need answers :D
and i have more question in progress :)
first these jass's good, or i need fixing it? these jass's and what i post last time with item and different wing type dropping?
JASS:
function RemovePlayer10 takes nothing returns nothing
local group g
local unit u
set g = GetUnitsInRectOfPlayer(GetPlayableMapRect(), Player(9))
loop
      set u = FirstOfGroup(g)
      exitwhen u==null
      call GroupRemoveUnit(g,u)
      call RemoveUnit( u )
endloop 
set g = null
set u = null
endfunction


how can i do tinki3 creep revivel system in jass with player 11,hostile?
or if i use every unit on entire map then same time ?
JASS:
function CreepLocation takes nothing returns nothing
local group g
local unit u
local integer i
set i = 0
set g = GetUnitsInRectAll(GetEntireMapRect()) <---- there player 11 and hostile or i must use again a loop and dont clear the integer value? i need best solution
loop
      set u = FirstOfGroup(g)
      exitwhen u==null
      set i = i + 1
      call GroupRemoveUnit(g,u)
      set udg_CreepX<i> = GetUnitX(u)
      set udg_CreepY<i> = GetUnitY(u)
endloop 
set i = null
set g = null
set u = null
endfunction</i></i>

this good?
JASS:
function ReSpawn takes nothing returns nothing
    local integer a = GetUnitUserData(GetDyingUnit())
    local real x = udg_CreepX[a]
    local real y = udg_CreepY[a]
    local location loc = GetUnitLoc(GetTriggerUnit())
    local effect   e   = AddSpecialEffectLoc( &quot;Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl&quot;, loc )
    call DestroyEffect(e)
    call TriggerSleepAction( 8.00 )
    call TriggerSleepAction( ( ( I2R(GetUnitLevel(GetTriggerUnit())) + 1.00 ) / 2.00 ) )
    call CreateNUnitsAtLoc( 1, GetUnitTypeId(GetTriggerUnit()), GetOwningPlayer(GetTriggerUnit()), OffsetLocation(GetRectCenter(GetEntireMapRect()), x, y), GetRandomDirectionDeg() )
    call RemoveLocation(loc)
    call SetUnitUserData( GetLastCreatedUnit(), GetUnitUserData(GetTriggerUnit()) )
    call SetUnitAnimation( GetLastCreatedUnit(), &quot;birth&quot; )
    set x = 0    
    set y = 0    
    set a = 0    
    set loc = null    
    set e = null
endfunction
 
And also you should never start to learn JASS by converting triggers like this.. As when you convert loops, groups and forces, WE makes them so complicated.
I beg to differ
I began my path of JASS by converting triggers and optimizing them a bit, like the conditions.

As for your trigger, the 1st one.
JASS:
function RemovePlayer10 takes nothing returns nothing
    local group g = CreateGroup()
    local unit u
    local integer p
    local integer q = 1
    set g = GetUnitsInRectOfPlayer(GetPlayableMapRect(), Player(9))
    set p = CountUnitsInGroup(g)
    loop
    exitwhen p &gt; q
        set u = FirstOfGroup(g)
        call GroupRemoveUnit(g, u)
        call RemoveUnit( u )
        set p = p + 1
    endloop
    call DestroyGroup(g)
    set g = null
    set u = null
endfunction
 
I beg to differ
I began my path of JASS by converting triggers and optimizing them a bit, like the conditions.

As for your trigger, the 1st one.
JASS:
function RemovePlayer10 takes nothing returns nothing
    local group g = CreateGroup()
    local unit u
    local integer p
    local integer q = 1
    set g = GetUnitsInRectOfPlayer(GetPlayableMapRect(), Player(9))
    set p = CountUnitsInGroup(g)
    loop
    exitwhen p &gt; q
        set u = FirstOfGroup(g)
        call GroupRemoveUnit(g, u)
        call RemoveUnit( u )
        set p = p + 1
    endloop
    call DestroyGroup(g)
    set g = null
    set u = null
endfunction

i dont know why but dont work(but i think if in unit group have 4 unit then always greater then 0 [p =4, q=0, and exit when p >q])

JASS:
function RemovePlayer10 takes nothing returns nothing
local group g = CreateGroup()
local unit u
local integer i = 1
set g = GetUnitsInRectOfPlayer(GetEntireMapRect(), Player(9))
set i = CountUnitsInGroup(g)
loop
      exitwhen i &lt; 1
      set u = FirstOfGroup(g)
      call GroupRemoveUnit(g,u)
      call RemoveUnit( u )
      set i = i - 1
endloop 
call DestroyGroup(g)
set g = null
set u = null
endfunction


thx because i learn something in every jass :)

i dont found instruction for playergroup but this is good or i can fix?:
JASS:
function Dialog takes nothing returns nothing
    local integer i = 0
    local integer nr = 0
    local string array s
    set s[0] = &quot;Human&quot;
    set s[1] = &quot;Night Elf&quot;
    set s[2] = &quot;Blood Elf&quot;
    set s[3] = &quot;Orc&quot;
    set s[4] = &quot;Golem&quot;
    call DialogClearBJ( udg_N )
    call DialogSetMessageBJ( udg_N, &quot;Nation&quot; )
loop
    exitwhen nr &gt; 4
    call DialogAddButtonBJ( udg_N, s[nr] )
    set udg_Nation_Button[nr] = GetLastCreatedButtonBJ()
    set nr = nr + 1
endloop
loop
        exitwhen i &gt; 12
if ( GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING ) then
     if ( GetPlayerController(Player(i)) == MAP_CONTROL_USER ) then
        call DialogDisplayBJ( true, udg_N, Player(i) )
     endif
endif
set i = i + 1
endloop 
endfunction
 
Remember that most BJs are bad. It is good to have an anti-bj code such as this:
JASS:
function Dialog takes nothing returns nothing
    local integer i = 0
    local integer nr = 0
    local string array s
    set s[0] = &quot;Human&quot;
    set s[1] = &quot;Night Elf&quot;
    set s[2] = &quot;Blood Elf&quot;
    set s[3] = &quot;Orc&quot;
    set s[4] = &quot;Golem&quot;
    call DialogClear( udg_N )
    call DialogSetMessage( udg_N, &quot;Nation&quot; )
    loop
        exitwhen nr &gt; 4 
        set udg_Nation_Button[nr] = DialogAddButton( udg_N, s[nr], 0 )
        set nr = nr + 1
    endloop
    loop
        exitwhen i &gt; 12
        if ( GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING ) then
            if ( GetPlayerController(Player(i)) == MAP_CONTROL_USER ) then
                call DialogDisplay(Player(i), udg_N, true)
            endif
        endif
        set i = i + 1
    endloop
endfunction


I also cleaned it up a bit. ;)
 
Remember that most BJs are bad. It is good to have an anti-bj code such as this:
I also cleaned it up a bit. ;)

ohh thx, only problem when i convert to jass everything in bj, why use trigger everywhere bj commands?
where i can know whats sequence have a normal command without bj because
JASS:
call DialogDisplay(Player(i), udg_N, true

here was changed player and boolen location
JASS:
call DialogDisplayBJ( true, udg_N, Player(i)

JASS:
        set udg_Nation_Button[nr] = DialogAddButton( udg_N, s[nr], 0 )
there have a 0 when i add to variable directly
JASS:
  call DialogAddButtonBJ( udg_N, s[nr] )
    set udg_Nation_Button[nr] = GetLastCreatedButtonBJ()
 
i don't think there is realy an answer for why the order is changed or things are just without a few things....
if u wanna realy check why u lost the 0 then u go to the jass craft and see for urself what actions the BJ contain - some are just calling another function with a different order in the arguments and some are more complicated and do a few actions to do what u think is a one simple call
e.g: (call BJDebugMsg)
JASS:
function BJDebugMsg takes string msg returns nothing
    local integer i = 0
    loop
        call DisplayTimedTextToPlayer(Player(i),0,0,60,msg)
        set i = i + 1
        exitwhen i == bj_MAX_PLAYERS
    endloop
endfunction

i hope u understand what it actually does in this loop
and i hope u understand my explanation
 
i don't think there is realy an answer for why the order is changed or things are just without a few things....
if u wanna realy check why u lost the 0 then u go to the jass craft and see for urself what actions the BJ contain - some are just calling another function with a different order in the arguments and some are more complicated and do a few actions to do what u think is a one simple call
e.g: (call BJDebugMsg)
JASS:
function BJDebugMsg takes string msg returns nothing
    local integer i = 0
    loop
        call DisplayTimedTextToPlayer(Player(i),0,0,60,msg)
        set i = i + 1
        exitwhen i == bj_MAX_PLAYERS
    endloop
endfunction

i hope u understand what it actually does in this loop
and i hope u understand my explanation

dont really , sry, my failing. because bj_Maxplayer is a constans, and i dont have only quick basic (little) knowleadge and there if i use a constans faster then a variable, or the problem is when i use this
JASS:
call DialogDisplayBJ( true, udg_N, Player(i)
then i use a call again where have
JASS:
call DialogDisplay(Player(i), udg_N, true)
?
 
JASS:
function DialogDisplayBJ takes boolean flag, dialog whichDialog, player whichPlayer returns nothing
    call DialogDisplay(whichPlayer, whichDialog, flag)
endfunction

the BJ one is making a call for the Dialog Display which is making a longer way while u can call the simple "call DialogDisplay(whichPlayer, whichDialog, flag)" which will save u all this and i dunno why the BJ take the arguments in a different order but i don't think it matter since that u should just follow the natives and stop using BJs.

btw what do u mean: "because bj_Maxplayer is a constans"?
what do u mean by constans?
 
JASS:
function DialogDisplayBJ takes boolean flag, dialog whichDialog, player whichPlayer returns nothing
    call DialogDisplay(whichPlayer, whichDialog, flag)
endfunction

the BJ one is making a call for the Dialog Display which is making a longer way while u can call the simple "call DialogDisplay(whichPlayer, whichDialog, flag)" which will save u all this and i dunno why the BJ take the arguments in a different order but i don't think it matter since that u should just follow the natives and stop using BJs.

btw what do u mean: "because bj_Maxplayer is a constans"?
what do u mean by constans?

this is clear, if i use bj thing then +1 call but sometime i cannot find in jass craft same command without bj, exemple:
JASS:
    if ( UnitHasItemOfTypeBJ(whichUnit, udg_SaveLoad_Items<i>) == true ) then</i>
 
JASS:
function UnitHasItemOfTypeBJ takes unit whichUnit, integer itemId returns boolean
    return GetInventoryIndexOfItemTypeBJ(whichUnit, itemId) &gt; 0
endfunction

look only for the call itself in this case it's the: "UnitHasItemOfTypeBJ" and u will find it easly

okey but if i searched i found this, again a bj function :/
JASS:

function GetInventoryIndexOfItemTypeBJ takes unit whichUnit, integer itemId returns integer
    local integer index
    local item    indexItem

    set index = 0
    loop
        set indexItem = UnitItemInSlot(whichUnit, index)
        if (indexItem != null) and (GetItemTypeId(indexItem) == itemId) then
            return index + 1
        endif

        set index = index + 1
        exitwhen index &gt;= bj_MAX_INVENTORY
    endloop
    return 0
endfunction
 
yep Bj's are complex sometimes like this one and u are gonna make it as this BJ does to reach the same effect i suggest to just stay with the BJ to save trouble (depends on what u try to reach to and would it realy save u trouble)
 
yep Bj's are complex sometimes like this one and u are gonna make it as this BJ does to reach the same effect i suggest to just stay with the BJ to save trouble (depends on what u try to reach to and would it realy save u trouble)

i have trouble :D
i dont know why dont work, in map have 12 item type and when i pick up a item r and w = 0 when i pick second item r and w = 1 when i pick up a item type what i dont have in saveload_item array[1-10] and dont have in inventory but r = 1, w = 0, why?
JASS:
function DID takes unit whichUnit, item whichItem returns nothing
    local integer i = 1 
    local integer p = 1
    local integer w = 0
    local integer r = 0
    local string s = &quot;You cannot hold in your inventory 2 item in same type or wing type&quot;
    
loop
   exitwhen i &gt; 6
        if ( ( GetItemTypeId(whichItem) == GetItemTypeId(UnitItemInSlot(whichUnit, i)) ) ) then
            set r =  r + 1 
        endif 
     loop
        exitwhen p &gt; 10  
//        call DisplayTextToPlayer( GetOwningPlayer(whichUnit), 0 ,0 , I2S(p) )        
             if ( ( udg_SaveLoad_Items[p] == GetItemTypeId(UnitItemInSlot(whichUnit, i)) ) ) then
                 set w = w + 1
             endif
       set p = p + 1
     endloop
call DisplayTextToPlayer( GetOwningPlayer(whichUnit), 0 ,0 , I2S(w))
call DisplayTextToPlayer( GetOwningPlayer(whichUnit), 0 ,0 , I2S(r))
   set i = i + 1
   set p = 1
endloop
     if (GetBooleanOr(( r &gt; 0), w &gt; 1)) then 
        call UnitRemoveItemSwapped( whichItem, whichUnit ) 
        call DisplayTextToPlayer( GetOwningPlayer(whichUnit), 0 ,0 , s )
     endif

set i = 0
set r = 0
set w = 0
set p = 0
set s = null
endfunction


what i want?
for i = 1 to 6 (hero inventory slot)
if this item type have in hero more times then r = (number of this item type in hero inventory)
for p = 1 to 10
if this itemtypr(hero, hisimventory slot (i) = udg_itemtypes(i)) then w = w + 1
end for
end for

if w > 1 or r > 1 then drop hero manipulated item
 
bump

pls somebody tell me what is it the problem in last post?
 
well i think this part:
JASS:
     if (GetBooleanOr(( r &gt; 0), w &gt; 1)) then 
        call UnitRemoveItemSwapped( whichItem, whichUnit ) 
        call DisplayTextToPlayer( GetOwningPlayer(whichUnit), 0 ,0 , s )
     endif

set i = 0
set r = 0
set w = 0
set p = 0
set s = null
endfunction

this what u need to do:
JASS:
     if (( r &gt; 0) or (w &gt; 1)) then 
        call UnitRemoveItem( whichUnit ,whichItem) 
        call DisplayTextToPlayer( GetOwningPlayer(whichUnit), 0 ,0 , s )
     endif
endfunction

u don't need to null integers or null string,boolean,code,reals and etc' (i don't remember them all :p)
 
why don work this jass trigger if i bought this item and i am player 1?

JASS:
function Trig_Buy_Good_Point_Conditions takes nothing returns boolean
    if ( not ( GetItemTypeId(GetSoldItem()) == &#039;I01B&#039; ) ) then
        return false
    endif
    return true
endfunction

function Trig_Buy_Good_Point_Actions takes nothing returns nothing
    local integer i = GetConvertedPlayerId(GetOwningPlayer(GetBuyingUnit()))
    local multiboarditem mbitem 
    set udg_GoodBadPoints<i> = ( udg_GoodBadPoints<i> + 1 )
                    set mbitem = MultiboardGetItem(GetLastCreatedMultiboard(), i - 1, 3 - 1)
                    call MultiboardSetItemValue(mbitem, R2S(udg_GoodBadPoints<i>))
                    call MultiboardReleaseItem(mbitem)
set mbitem = null
endfunction

//===========================================================================
function InitTrig_Buy_Good_Point takes nothing returns nothing
    local integer index = 0
    set gg_trg_Buy_Good_Point = CreateTrigger(  )
    loop
        set index = index + 1
        call TriggerRegisterPlayerUnitEvent(gg_trg_Buy_Good_Point, Player(index), EVENT_PLAYER_UNIT_SELL_ITEM, null)
        exitwhen index == 8
    endloop
    call TriggerAddCondition( gg_trg_Buy_Good_Point, Condition( function Trig_Buy_Good_Point_Conditions ) )
    call TriggerAddAction( gg_trg_Buy_Good_Point, function Trig_Buy_Good_Point_Actions )
endfunction

</i></i></i>
 
try this:
JASS:
function Trig_Buy_Good_Point_Conditions takes nothing returns boolean
    return (GetItemTypeId(GetSoldItem()) == &#039;I01B&#039; )
endfunction

function Trig_Buy_Good_Point_Actions takes nothing returns nothing
    local integer i = GetPlayerId(GetOwningPlayer(GetBuyingUnit()))
    local multiboarditem mbitem 
    set udg_GoodBadPoints<i> = ( udg_GoodBadPoints<i> + 1 )
                    set mbitem = MultiboardGetItem(GetLastCreatedMultiboard(), i - 1, 3 - 1)
                    call MultiboardSetItemValue(mbitem, R2S(udg_GoodBadPoints<i>))
                    call MultiboardReleaseItem(mbitem)
set mbitem = null
endfunction

//===========================================================================
function InitTrig_Buy_Good_Point takes nothing returns nothing
    local integer index = 0
    set gg_trg_Buy_Good_Point = CreateTrigger(  )
    loop
        set index = index + 1
        call TriggerRegisterPlayerUnitEvent(gg_trg_Buy_Good_Point, Player(index), EVENT_PLAYER_UNIT_SELL_ITEM, null)
        exitwhen index == 8
    endloop
    call TriggerAddCondition( gg_trg_Buy_Good_Point, Condition( function Trig_Buy_Good_Point_Conditions ) )
    call TriggerAddAction( gg_trg_Buy_Good_Point, function Trig_Buy_Good_Point_Actions )
endfunction</i></i></i>

since GetConverted is suited for GUI and in GUI player number is +1 from his real number so u can kinda say it's a BJ since it basically call the real player id and add 1 to it
 
try this:
JASS:
function Trig_Buy_Good_Point_Conditions takes nothing returns boolean
    return (GetItemTypeId(GetSoldItem()) == &#039;I01B&#039; )
endfunction

function Trig_Buy_Good_Point_Actions takes nothing returns nothing
    local integer i = GetPlayerId(GetOwningPlayer(GetBuyingUnit()))
    local multiboarditem mbitem 
    set udg_GoodBadPoints<i> = ( udg_GoodBadPoints<i> + 1 )
                    set mbitem = MultiboardGetItem(GetLastCreatedMultiboard(), i - 1, 3 - 1)
                    call MultiboardSetItemValue(mbitem, R2S(udg_GoodBadPoints<i>))
                    call MultiboardReleaseItem(mbitem)
set mbitem = null
endfunction

//===========================================================================
function InitTrig_Buy_Good_Point takes nothing returns nothing
    local integer index = 0
    set gg_trg_Buy_Good_Point = CreateTrigger(  )
    loop
        set index = index + 1
        call TriggerRegisterPlayerUnitEvent(gg_trg_Buy_Good_Point, Player(index), EVENT_PLAYER_UNIT_SELL_ITEM, null)
        exitwhen index == 8
    endloop
    call TriggerAddCondition( gg_trg_Buy_Good_Point, Condition( function Trig_Buy_Good_Point_Conditions ) )
    call TriggerAddAction( gg_trg_Buy_Good_Point, function Trig_Buy_Good_Point_Actions )
endfunction</i></i></i>

since GetConverted is suited for GUI and in GUI player number is +1 from his real number so u can kinda say it's a BJ since it basically call the real player id and add 1 to it


nothing :/ dont add to goodpoint nothging, i think the something with event or condition have, removed the bj in event because i found in jass editor what i need :/ TriggerRegisterAnyUnitEventBJ
i changed to:
JASS:
    local integer index = 0
    set gg_trg_Buy_Good_Point = CreateTrigger(  )
    loop
        set index = index + 1
        call TriggerRegisterPlayerUnitEvent(gg_trg_Buy_Good_Point, Player(index), EVENT_PLAYER_UNIT_SELL_ITEM, null)
        exitwhen index == 8
    endloop


i try change set index line to second inside the loop and call the first but dont work the trigger.
generic event, units buy item from shop,condition type of item what i wrote....
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I should have had all of this like a month ago but whatever, it's fine. He's trying a thing, idk it's his menu I don
  • Varine Varine:
    I don't care.
  • Varine Varine:
    Fuck I need more saturday nights off. Turns out I'm much cooler to drunk girls. If I hang out with enough people like that, eventually I'll meet one that likes me sober too
  • Varine Varine:
    idk if anyone has ever done IT. I am not IT but I just got off a 20 minute phone call with the general manager asking me how to make her new computer print. I do adore her, like I know her personally, but I asked three times if the printer was on. She apologized for bothering me, and Chef Ben walked in a few minutes later, turned the printer on apparently, and then called to ask if I was trying to print shit from my house again
  • Varine Varine:
    So I have a newfound appreciation
  • Varine Varine:
    And also I'm going to remove that one from my secondary career options
  • Varine Varine:
    As I get older I'm not thinking I can do this forever anymore, and I'm kind of dead end right now. I get a fine salary and fair raises, like I can easily live my lifestyle on this normally, but I don't know if I can do this in ten years, and I don't think I want to. I don't really have any desire to take over another restaurant, and I don't want to try and own one, and I doubt I'll luck out like I did with that taco place in Texas
  • Varine Varine:
    I have a math degree but that was a while ago and I'm not positive I actually deserved that. It was kind of just given to me I feel like cuz I was in school so long. Like for a bit as a teenager I got real into the mormon thing, and my dad grew up kind of similarly. Much like he fell out of it
  • Varine Varine:
    Anyway he started coming to church with me for a bit, and they gave home the I think Melchizedek? idk how to spell it, but it's the 'upper' priesthood, like he had a whole blessing thing after I got baptized, and it WAS a very neat experience. And the only reason I think they did they did that was cuz he was like late 30s, and that is kind of the age that they have the last chance at that
  • Varine Varine:
    And I mean its not, but like... I'm pretty well set in my lack of religious beliefs, I guess. And I'm a bit younger than my dad would have been then.
  • Varine Varine:
    And then I got real into, he got bored and was like you do you dude, and that's how I got a huge amount of freedom when I started doing drugs as a teenager
  • Varine Varine:
    In hindsight my parents were fantastic. but they were too fucking tired to raise kids like me. And their jobs were easier with better benefits.
  • Varine Varine:
    Anyway idk where I'm going here, but I asked ChatGPT some of the same things and holy shit was it way more strict and just gave me (importantly the wrong) phone number to a hotline
  • Varine Varine:
    TH, I gotta say, though, I'm amazed you keep this up. I feel like there are you and Ghan doing whatever you're doing, Tom posting news, and then me using the chatbox as a journal every once in a while.
    +1
  • Varine Varine:
    Thanks for letting me do that, also. I know I'm not using it correctly, but somewhere along the line I went from arguing with Cheshire to using this as a kind of void for my frustrations and hopes. I like to think of the whole thing as an enigma of sorts
  • Varine Varine:
    It's not, you guys could probably blackmail me if you went back far enough. I doubt anyone would, you've always been very kind, and I'm glad to have been a part of all this! I hope you enjoy me too, cuz I'm going to keep doing it.
    +1
  • Varine Varine:
    In my defense I was high for a lot of that though
  • V-SNES V-SNES:
    Thanks for sharing @Varine
  • The Helper The Helper:
    Brother how long we been here together? You guys are some of my best friends and I have never even met any of you. I dont know what I would if I did not have my Varine rant to look at when I get on. How could I possibly ever shut this site down? We have been here in this little chat box through a lot of shit for a long time. I love you guys!
    +2
  • tom_mai78101 tom_mai78101:
    I missed out on a lot of chat messages. But yeah, we're planning for my mom's funeral back in Taiwan. I'm really glad I work remotely, so I can try to leverage that and go to places outside of US while still working in US.
    +1
  • tom_mai78101 tom_mai78101:
    If it wasn't for my mom, I wouldn't be able to work in the US. Let alone being able to work until our office closed, and I became a full-time remote employee.
  • tom_mai78101 tom_mai78101:
    Really important though, get your wills and last testaments ready. We avoided like 2 to 3 months of waiting for probate court to get back to us.
    +2
  • The Helper The Helper:
    V-SNES I got good news I got your stuff packed for shipping and just need to get to the post office to get shipping cost!
    +1
  • jonas jonas:
    Oh man Cheshire, I often wonder what happened to her and most of the other people who used to be here
  • V-SNES V-SNES:
    @The Helper that's great! Looking forward to getting them!

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top