Somebody can teach me to jass? i need patience

S

shadowvzs

Guest
i want learn jass, but i dont know object oriental language, i read the instruction but i dont understand really, i use some anti leak custom script but i want improve my map speed but i dont know what i must fix inside the normal trigger, exemple i have item drop trigger, this:
Code:
Double Item Dropping
    Events
        Unit - A unit Acquires an item
    Conditions
        (Item-type of (Item being manipulated)) Not equal to Chocobo Food
        (Item-class of (Item being manipulated)) Not equal to Purchasable
    Actions
        Set Tempory_nr[6] = 0
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Item-type of (Item being manipulated)) Equal to (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A)))
                    Then - Actions
                        Set Tempory_nr[6] = (Tempory_nr[6] + 1)
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Tempory_nr[6] Equal to 2
                            Then - Actions
                                Hero - Drop (Item being manipulated) from (Hero manipulating item)
                                Set PlayerGroup = (Player group((Owner of (Triggering unit))))
                                Game - Display to PlayerGroup the text: You can't hold in y...
                                Custom script:   call DestroyForce (udg_PlayerGroup)
                            Else - Actions
        Set Tempory_nr[6] = 0
        For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Hero manipulating item) has an item of type SaveLoad_Items[(Integer A)]) Equal to True
                    Then - Actions
                        Set Tempory_nr[6] = (Tempory_nr[6] + 1)
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Tempory_nr[6] Greater than 1
            Then - Actions
                Hero - Drop (Item being manipulated) from (Hero manipulating item)
                Set PlayerGroup = (Player group((Owner of (Triggering unit))))
                Game - Display to PlayerGroup the text: You can't use two w...
                Custom script:   call DestroyForce (udg_PlayerGroup)
            Else - Actions
in jass (i dont know how can i convert and now i do a error but i removed the bad line)
JASS:

//===========================================================================
// Trigger: Double Item Dropping
//===========================================================================
function Trig_Double_Item_Dropping_Conditions takes nothing returns boolean
    if ( not ( GetItemTypeId(GetManipulatedItem()) != 'I00X' ) ) then
        return false
    endif
    if ( not ( GetItemType(GetManipulatedItem()) != ITEM_TYPE_PURCHASABLE ) ) then
        return false
    endif
    return true
endfunction

function Trig_Double_Item_Dropping_Func004Func001Func001C takes nothing returns boolean
    if ( not ( udg_Tempory_nr[6] == 2 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Double_Item_Dropping_Func004Func001C takes nothing returns boolean
    if ( not ( GetItemTypeId(GetManipulatedItem()) == GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA())) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Double_Item_Dropping_Func006Func001C takes nothing returns boolean
    if ( not ( UnitHasItemOfTypeBJ(GetManipulatingUnit(), udg_SaveLoad_Items[GetForLoopIndexA()]) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Double_Item_Dropping_Func007C takes nothing returns boolean
    if ( not ( udg_Tempory_nr[6] > 1 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Double_Item_Dropping_Actions takes nothing returns nothing
    set udg_Tempory_nr[6] = 0
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 6
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        if ( Trig_Double_Item_Dropping_Func004Func001C() ) then
            set udg_Tempory_nr[6] = ( udg_Tempory_nr[6] + 1 )
        else
            if ( Trig_Double_Item_Dropping_Func004Func001Func001C() ) then
                call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
                set udg_PlayerGroup = GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit()))
                call DisplayTextToForce( udg_PlayerGroup, "TRIGSTR_2706" )
                call DestroyForce (udg_PlayerGroup)
            else
            endif
        endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    set udg_Tempory_nr[6] = 0
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 10
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        if ( Trig_Double_Item_Dropping_Func006Func001C() ) then
            set udg_Tempory_nr[6] = ( udg_Tempory_nr[6] + 1 )
        else
        endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    if ( Trig_Double_Item_Dropping_Func007C() ) then
        call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
        set udg_PlayerGroup = GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit()))
        call DisplayTextToForce( udg_PlayerGroup, "TRIGSTR_2939" )
        call DestroyForce (udg_PlayerGroup)
    else
    endif
endfunction

//===========================================================================
function InitTrig_Double_Item_Dropping takes nothing returns nothing
    set gg_trg_Double_Item_Dropping = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Double_Item_Dropping, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerAddCondition( gg_trg_Double_Item_Dropping, Condition( function Trig_Double_Item_Dropping_Conditions ) )
    call TriggerAddAction( gg_trg_Double_Item_Dropping, function Trig_Double_Item_Dropping_Actions )
endfunction


how do it jass the item droping trigger to faster
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
have u ever read Vexorian's tutorial?
-->Link Here<--
it's realy good tutorial it will give u the basic start of jass i personally started with this tutorial.
after u feel like u learned the basic u move on to advanced jass tutorial (there have been 2 tutorials which were made by phyrexian and Daelin if im not mistaken) which will tell u how to improve ur jass code and make it efficient.
 
S

shadowvzs

Guest
have u ever read Vexorian's tutorial?
-->Link Here<--
it's realy good tutorial it will give u the basic start of jass i personally started with this tutorial.
after u feel like u learned the basic u move on to advanced jass tutorial (there have been 2 tutorials which were made by phyrexian and Daelin if im not mistaken) which will tell u how to improve ur jass code and make it efficient.

super :) thx, problems is i read the instruction, and i understand the every trigger is a function, and how can i add value to a variable, and have difference between variable names (a,A) but deeper is too high for me :D

u can add me a homework or something, what is it basic? or what you want :) :)
 

martix

There is no spoon
Reaction score
49
First of all Jass is CASE SENSITIVE "aa" and "AA" are not the same.
Everything in Jass is one function or another. A trigger as you know it in GUI can consist of many functions. The trigger as an object however is a special function as it can register events(meaning the only one that can detect events as they occur).
About variables I suggest reading Daelin's tutorial as well.

Well thats for starters. There are plenty of tutorials out there, go read some. :)
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
You don't need knowledge of OOP to know JASS. :rolleyes:

Anyways, here is a muuuucccchhhh more efficient code from what you put:

JASS:
//===========================================================================
// Trigger: Double Item Dropping
//===========================================================================
function Trig_Double_Item_Dropping_Conditions takes nothing returns boolean
    return GetItemTypeId(GetManipulatedItem()) != &#039;I00X&#039; and GetItemType(GetManipulatedItem()) != ITEM_TYPE_PURCHASABLE
endfunction

function Trig_Double_Item_Dropping_Actions takes nothing returns nothing
    local integer i = 0
    set udg_Tempory_nr[6] = 0
    loop
        exitwhen i &gt; 6
        if UnitHasItemOfTypeBJ(GetManipulatingUnit(), udg_SaveLoad_Items[GetForLoopIndexA()]) == true then
            set udg_Tempory_nr[6] = ( udg_Tempory_nr[6] + 1 )
        elseif udg_Tempory_nr[6] == 2 then
                call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
                set udg_PlayerGroup = GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit()))
                call DisplayTextToForce( udg_PlayerGroup, &quot;TEXT&quot; )
                call DestroyForce(udg_PlayerGroup)
        endif
        set i = i + 1
    endloop
    set udg_Tempory_nr[6] = 0
    set i = 0
    loop
        exitwhen i &gt; 10
        if UnitHasItemOfTypeBJ(GetManipulatingUnit(), udg_SaveLoad_Items[GetForLoopIndexA()]) then
            set udg_Tempory_nr[6] = ( udg_Tempory_nr[6] + 1 )
        endif
        set i = i + 1
    endloop
    if (udg_Tempory_nr[6] &gt; 1) then
        call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
        set udg_PlayerGroup = GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit()))
        call DisplayTextToForce( udg_PlayerGroup, &quot;TEXT&quot; )
        call DestroyForce(udg_PlayerGroup)
    endif
endfunction

//===========================================================================
function InitTrig_Double_Item_Dropping takes nothing returns nothing
    set gg_trg_Double_Item_Dropping = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Double_Item_Dropping, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerAddCondition( gg_trg_Double_Item_Dropping, Condition( function Trig_Double_Item_Dropping_Conditions ) )
    call TriggerAddAction( gg_trg_Double_Item_Dropping, function Trig_Double_Item_Dropping_Actions )
endfunction



But it still could be more efficient. :p That's how awkward Blizzard's JASS conversions from GUI is. :D
 
Reaction score
456
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.
 
S

shadowvzs

Guest
You don't need knowledge of OOP to know JASS. :rolleyes:

Anyways, here is a muuuucccchhhh more efficient code from what you put:

HTML:
//===========================================================================
// Trigger: Double Item Dropping
//===========================================================================
function Trig_Double_Item_Dropping_Conditions takes nothing returns boolean
    return GetItemTypeId(GetManipulatedItem()) != 'I00X' and GetItemType(GetManipulatedItem()) != ITEM_TYPE_PURCHASABLE
endfunction

[b]function Trig_Double_Item_Dropping_Actions takes nothing returns nothing
    local integer i = 0
    set udg_Tempory_nr[6] = 0
    loop
        exitwhen i > 6
        if UnitHasItemOfTypeBJ(GetManipulatingUnit(), udg_SaveLoad_Items[GetForLoopIndexA()]) == true then
            set udg_Tempory_nr[6] = ( udg_Tempory_nr[6] + 1 )
        elseif udg_Tempory_nr[6] == 2 then
                call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
                set udg_PlayerGroup = GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit()))
                call DisplayTextToForce( udg_PlayerGroup, "TEXT" )
                call DestroyForce(udg_PlayerGroup)
        endif
        set i = i + 1
    endloop
    set udg_Tempory_nr[6] = 0
    set i = 0
    loop
        exitwhen i > 10
        if UnitHasItemOfTypeBJ(GetManipulatingUnit(), udg_SaveLoad_Items[GetForLoopIndexA()]) then
            set udg_Tempory_nr[6] = ( udg_Tempory_nr[6] + 1 )
        endif
        set i = i + 1
    endloop
    if (udg_Tempory_nr[6] > 1) then
        call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
        set udg_PlayerGroup = GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit()))
        call DisplayTextToForce( udg_PlayerGroup, "TEXT" )
        call DestroyForce(udg_PlayerGroup)
    endif
endfunction[/b]

//===========================================================================
function InitTrig_Double_Item_Dropping takes nothing returns nothing
    set gg_trg_Double_Item_Dropping = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Double_Item_Dropping, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerAddCondition( gg_trg_Double_Item_Dropping, Condition( function Trig_Double_Item_Dropping_Conditions ) )
    call TriggerAddAction( gg_trg_Double_Item_Dropping, function Trig_Double_Item_Dropping_Actions )
endfunction


But it still could be more efficient. :p That's how awkward Blizzard's JASS conversions from GUI is. :D

this is too complex yet :D the bolded part the body of trigger (action without condition and event?)
and i cant copy to my map because i dont know how can convert to back, and when i copy to custom scripts every row in ur jass was in same row :D a little long was :D
i tryed do something
JASS:
function CFade takes handle udg_Player returns nothing
if GetLocalPlayer() == udg_Player then
call CinematicFilterGenericBJ( 7.00, BLEND_MODE_BLEND, &quot;ReplaceableTextures\\CameraMasks\\Black_mask.blp&quot;, 0.00, 0.00, 0.00, 0.00, 100.00, 100.00, 100.00, 100.00 )
endif
endfunction


Code:
Create Ur Hero
    Events
        Dialog - A dialog button is clicked for Nation_question
    Conditions
    Actions
        Set Tempory_nr[14] = 0
        For each (Integer A) from 0 to 4, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Nation_Button[(Integer A)] Equal to (Clicked dialog button)
                    Then - Actions
                        Set Player = (Triggering player)
                        [b]Custom script:   call CFade(udg_Player)[/b]
                        Set Temp_point[1] = (Random point in StartLocation <gen>)
                        Unit - Create 1 SaveLoad_Heroes[(25 + (Integer A))] for Player at Temp_point[1] facing Default building facing degrees
                        Custom script:   call RemoveLocation(udg_Temp_point[1])
                        Unit - Set level of Hero Race  for (Last created unit) to ((Integer A) + 1)
                        Hero - Make (Owner of (Last created unit)) Heroes gain (150.00 x (Real(Number_of_player)))% experience from future kills
                        Unit - Hide (Last created unit)
                        Set MyHero[(Player number of Player)] = (Last created unit)
                        Custom script:   call RemoveLocation(udg_Temp_point[1])
                        Set Point = (Random point in Ship <gen>)
                        Unit - Create 1 Transport Ship for Player at Point facing 90.00 degrees
                        Unit - Move (Last created unit) instantly to Point, facing 90.00 degrees
                        Custom script:   call RemoveLocation(udg_Point)
                        Set Point = (Random point in ShipDock <gen>)
                        Unit - Order (Last created unit) to Move To Point
                        Custom script:   call RemoveLocation(udg_Point)
                        Set PlayerGroup = (Player group(Player))
                        Cinematic - Turn cinematic mode On for PlayerGroup
                        Custom script:   call DestroyForce (udg_PlayerGroup)
                        Set Point = (Position of (Last created unit))
                        Camera - Pan camera for (Owner of (Last created unit)) to Point over 0.00 seconds
                        Custom script:   call RemoveLocation(udg_Point)
                        Camera - Lock camera target for (Owner of (Last created unit)) to (Last created unit), offset by (0.00, 0.00) using Default rotation
                        Camera - Set (Owner of (Last created unit))'s camera Distance to target to 800.00 over 2.00 seconds
                        Camera - Set (Owner of (Last created unit))'s camera Rotation to 25.00 over 2.00 seconds
                        Camera - Set (Owner of (Last created unit))'s camera Angle of attack to 355.00 over 2.00 seconds
                        Camera - Set (Owner of (Last created unit))'s camera Height Offset to 150.00 over 2.00 seconds
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Nation_Button[5] Equal to (Clicked dialog button)
            Then - Actions
                Set Player = (Triggering player)
                [b]Custom script:   call CFade(udg_Player)[/b]
                Set Point = (Random point in Region[(Random integer number between 3 and 5)])
                Unit - Create 1 Medivh (Raven Form) for Player at Point facing 180.00 degrees
                Camera - Pan camera for Player to Point over 0.00 seconds
                Custom script:   call RemoveLocation(udg_Point)
                Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
                Unit - Grant shared vision of (Last created unit) to Player
                Set PlayerGroup = (Player group(Player))
                Cinematic - Turn cinematic mode On for PlayerGroup
                Custom script:   call DestroyForce (udg_PlayerGroup)
                Camera - Lock camera target for (Owner of (Last created unit)) to (Last created unit), offset by (0.00, 0.00) using Default rotation
                Camera - Set (Owner of (Last created unit))'s camera Distance to target to 800.00 over 0.00 seconds
                Camera - Set (Owner of (Last created unit))'s camera Rotation to 90.00 over 2.00 seconds
                Camera - Set (Owner of (Last created unit))'s camera Angle of attack to 346.00 over 2.00 seconds
                Camera - Set (Owner of (Last created unit))'s camera Height Offset to 340.00 over 2.00 seconds
                Set Point = (Center of LoadRegion <gen>)
                Unit - Order (Last created unit) to Move To Point
                Custom script:   call RemoveLocation(udg_Point)
            Else - Actions
        Visibility - Create an initially Enabled visibility modifier for (Triggering player) emitting Visibility across Arena <gen>
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Some Defintion <gen> is on) Not equal to True
            Then - Actions
                Trigger - Turn on Some Defintion <gen>
                Trigger - Run Some Defintion <gen> (ignoring conditions)
            Else - Actions
                Trigger - Run Update Definition <gen> (ignoring conditions)
in last trigger when player click to dialog button(0)....dialog button(4) then create a hero but with animation, but if he click to 5th dialog button then again and animation, but i hope my first jass, the fade filter each player work
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
JASS:
function CFade takes handle udg_Player returns nothing 
    if GetLocalPlayer() == udg_Player then 
        call CinematicFilterGenericBJ( 7.00, BLEND_MODE_BLEND, &quot;ReplaceableTextures\\CameraMasks\\Black_mask.blp&quot;, 0.00, 0.00, 0.00, 0.00, 100.00, 100.00, 100.00, 100.00 ) 
    endif 
endfunction


This won't work, change it to this:
JASS:
function CFade takes player whichPlayer returns nothing
    if GetLocalPlayer() == whichPlayer then
        call CinematicFilterGenericBJ( 7.00, BLEND_MODE_BLEND, &quot;ReplaceableTextures\\CameraMasks\\Black_mask.blp&quot;, 0.00, 0.00, 0.00, 0.00, 100.00, 100.00, 100.00, 100.00 )
    endif
endfunction


Then in your trigger, simply use:
Code:
Custom Script:    call CFade(udg_Player)

;)
 
S

shadowvzs

Guest
JASS:
function CFade takes handle udg_Player returns nothing 
    if GetLocalPlayer() == udg_Player then 
        call CinematicFilterGenericBJ( 7.00, BLEND_MODE_BLEND, &quot;ReplaceableTextures\\CameraMasks\\Black_mask.blp&quot;, 0.00, 0.00, 0.00, 0.00, 100.00, 100.00, 100.00, 100.00 ) 
    endif 
endfunction


This won't work, change it to this:
JASS:
function CFade takes player whichPlayer returns nothing
    if GetLocalPlayer() == whichPlayer then
        call CinematicFilterGenericBJ( 7.00, BLEND_MODE_BLEND, &quot;ReplaceableTextures\\CameraMasks\\Black_mask.blp&quot;, 0.00, 0.00, 0.00, 0.00, 100.00, 100.00, 100.00, 100.00 )
    endif
endfunction


Then in your trigger, simply use:
Code:
Custom Script:    call CFade(udg_Player)

;)


whichPlayer = tempory variable for player?
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
it's the value which u took in this function:
"function CFade takes player whichPlayer"
 
S

shadowvzs

Guest
it's the value which u took in this function:
"function CFade takes player whichPlayer"

okey :) i understand this :) my learning opinion is: i must do a map without serioes leak and i think i cannot do without jass, i tryed removing point,groups,effects leak but i have serioes leak when i start my map and posibil after, during game play if play all 8 player :/ now i must go to sleep because here is 23:50 and i must wake up 6:00 :D thx everybody and i hope tomorrow we can continoues :) good night, bye
 
S

shadowvzs

Guest
boomp :D i have a problem and i dont have ideea why i have lagg if i use every remove location, group and other custom script :/
there is the map and scipts but i dont know... lagg when i press a key and start the map while create for me a hero and again a lagg when ship entering in dock, and a big leak if i add spellbook to my hero (inside the spell book 3 spell only)


and whats argument type available in jass? i see player, then have unit, item? integer,real,string i know have in jass but i dont know unit,unit type,item item type whats argument type i must write to function?
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
about the arguments try using search button it's have already been asked here and i know that some1 gave a full list so just search it
 
S

shadowvzs

Guest
i found :)
JASS:
function poo takes nothing returns nothing  
local ability ability1 
local attacktype attacktype1 
local boolean boolean1 
local buff buff1 
local camerasetup camerasetup1 
local weapontype weapontype1 
local damagetype damagetype1 
local destructable destructable1 
local defeatcondition defeatcondition1 
local dialog dialog1 
local button button1 
local effecttype effecttype1 
local texttag texttag1 
local gamecache gamecache1 
local gamespeed gamespeed1 
local image image1 
local integer integer1 
local item item1 
local itemtype itemtype1 
local leaderboard leaderboard1 
local lightning lightning1 
local multiboard multiboard1 
local multiboarditem multiboarditem1 
local player player1 
local playercolor playercolor1 
local force force1 
local location location1 
local pathingtype pathingtype1 
local quest quest1 
local questitem questitem1 
local race race1 
local real real1 
local rect rect1 
local region region1 
local sound sound1 
local soundtype soundtype1 
local effect effect1 
local string string1 
local terraindeformation terraindeformation1 
local timer timer1 
local timerdialog timerdialog1 
local trackable trackable1 
local trigger trigger1 
local unit unit1 
local unittype unittype1 
local group group1 
local fogmodifier fogmodifier1 
local weathereffect weathereffect1 
local event event1 
local triggercondition triggercondition1 
local triggeraction triggeraction1 
local ubersplat ubersplat1 
local boolexpr boolexpr1 
local eventid eventid1 
endfunction


haho? ??? somebody heard me? :D
i have second little function, i converted my respawn trigger (tinki3 creep revivel system+special effect)

Code:
reSpawn
    Events
        Unit - A unit owned by Neutral Hostile Dies
        Unit - A unit owned by Player 11 (Dark Green) Dies
    Conditions
        ((Triggering unit) is Summoned) Equal to False
        ((Triggering unit) is A structure) Equal to False
        (Unit-type of (Triggering unit)) Not equal to Chocobo
    Actions
        Set ReSpawnPoint = (Position of (Triggering unit))
        Special Effect - Create a special effect at ReSpawnPoint using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
        Custom script:   call RemoveLocation(udg_ReSpawnPoint)
        Set SpecialEffect[0] = (Last created special effect)
        Custom script:   call DestroyEffect (udg_SpecialEffect[0])
        Wait 40.00 seconds
        Wait (((Real((Level of (Triggering unit)))) + 1.00) / 2.00) seconds
        Set ReSpawnPoint = ((Center of (Entire map)) offset by (CreepX[(Custom value of (Triggering unit))], CreepY[(Custom value of (Triggering unit))]))
        Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at ReSpawnPoint facing Default building facing degrees
        Custom script:   call RemoveLocation(udg_ReSpawnPoint)
        Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
        Animation - Play (Last created unit)'s birth animation

and now
Code:
reSpawn
    Events
        Unit - A unit owned by Neutral Hostile Dies
        Unit - A unit owned by Player 11 (Dark Green) Dies
    Conditions
        ((Triggering unit) is Summoned) Equal to False
        ((Triggering unit) is A structure) Equal to False
        (Unit-type of (Triggering unit)) Not equal to Chocobo
    Actions
        Custom script:   call ReSpawn()
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( 40.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 loc = null    
    set e = null
endfunction


Purgeandfire i tryed this

JASS:
function DID takes nothing returns nothing
    local integer i = 0
    set udg_Tempory_nr[6] = 0
    loop
        exitwhen i &gt; 6
        if UnitHasItemOfTypeBJ(GetManipulatingUnit(), udg_SaveLoad_Items[GetForLoopIndexA()]) == true then
            set udg_Tempory_nr[6] = ( udg_Tempory_nr[6] + 1 )
        elseif udg_Tempory_nr[6] == 2 then
                call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
                set udg_PlayerGroup = GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit()))
                call DisplayTextToForce( udg_PlayerGroup, &quot;You can&#039;t hold in your inventory 2 items of the same type. (Excluded some purchasable items)&quot; )
                call DestroyForce(udg_PlayerGroup)
        endif
        set i = i + 1
    endloop
    set udg_Tempory_nr[6] = 0
    set i = 0
    loop
        exitwhen i &gt; 10
        if UnitHasItemOfTypeBJ(GetManipulatingUnit(), udg_SaveLoad_Items[GetForLoopIndexA()]) then
            set udg_Tempory_nr[6] = ( udg_Tempory_nr[6] + 1 )
        endif
        set i = i + 1
    endloop
    if (udg_Tempory_nr[6] &gt; 1) then
        call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
        set udg_PlayerGroup = GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit()))
        call DisplayTextToForce( udg_PlayerGroup, &quot;You can&#039;t use two wing.&quot; )
        call DestroyForce(udg_PlayerGroup)
    endif
endfunction


and i use call DID() but dont drop nothing, why?
 

SerraAvenger

Cuz I can
Reaction score
234
cuz of GetManipulatingUnit()^^
you may not use it if you do not have the event returning it, it is null in your trigger xD

You might wanna change it to
"takes unit droppinunit"
and than replace "manipulating unit" wiht "droppinunit"

EDIT: not only that, you use GetForLoopIndexA(), you have to replace that with i.
And a small hint for a beginning writer: never use such indescriptive names like "integer i", "unit u" "real r", and so on, it is really unmaintainable. i allways use "unit triggerunit", "integer counter", "real facing". It is much easier to understand and correct.

EDIT2:
As I am not sure how complete your list is, I give you this list wich is complete( and shows the line where it is casted =) ):
Code:
Native Types:

Line	Name
	boolean
	code
	handle
	integer
	real
	string

common.j:

Line	Name
11	ability
38	aidifficulty
29	alliancetype
88	attacktype
66	blendmode
22	boolexpr
12	buff
75	button
60	camerafield
61	camerasetup
24	conditionfunc
89	damagetype
78	defeatcondition
9	destructable
74	dialog
47	dialogevent
68	effect
69	effecttype
5	event
40	eventid
33	fgamestate
25	filterfunc
73	fogmodifier
72	fogstate
13	force
84	gamecache
51	gamedifficulty
41	gameevent
50	gamespeed
31	gamestate
52	gametype
14	group
32	igamestate
94	image
10	item
27	itempool
86	itemtype
80	leaderboard
92	lightning
45	limitop
19	location
57	mapcontrol
56	mapdensity
53	mapflag
55	mapsetting
54	mapvisibility
81	multiboard
82	multiboarditem
93	pathingtype
63	placement
6	player
62	playercolor
42	playerevent
36	playergameresult
35	playerscore
58	playerslotstate
34	playerstate
43	playerunitevent
76	quest
77	questitem
28	race
30	racepreference
65	raritycontrol
21	rect
20	region
23	sound
91	soundtype
64	startlocprio
71	terraindeformation
67	texmapflags
87	texttag
18	timer
79	timerdialog
83	trackable
15	trigger
17	triggeraction
16	triggercondition
95	ubersplat
8	unit
44	unitevent
26	unitpool
37	unitstate
48	unittype
85	version
59	volumegroup
90	weapontype
70	weathereffect
7	widget
46	widgetevent

And to add events:All you need.

Just call this at map init.
 
S

shadowvzs

Guest
i convert my item drop trigger to jass

i need comments guys, i am only studdent and i need comments ;)

and i convert trigger what was in my first post :D
saveload_items[0]....saveload_items[10] is wing type, i dont want hold only 1 wing :)

JASS:
function DID takes unit whichUnit, item whichItem returns nothing
    local integer i = 1
    local integer r = 0
    local string s = &quot;You cannot hold in your inventory 2 item in same type&quot;
    local string s1 = &quot;You cannot hold in your inventory 2 wing type in same time&quot;
    loop
        exitwhen i &gt; 6
        if ( ( GetItemTypeId(whichItem) == GetItemTypeId(UnitItemInSlotBJ(whichUnit, i)) ) ) then
            set r = ( r + 1 )
        else
            call DoNothing()
        endif
        set i = i + 1
    endloop
     if ( r &gt; 1) then 
         call UnitRemoveItemSwapped( whichItem, whichUnit ) 
         call DisplayTextToPlayer(GetOwningPlayer(whichUnit),0 ,0 , s)
        else
            call DoNothing()
        endif

set i = 1
set r = 0
    loop
        exitwhen i &gt; 10
        if ( UnitHasItemOfTypeBJ(whichUnit, udg_SaveLoad_Items<i>) == true ) then
            set r = r + 1
        else
            call DoNothing(  )
        endif
    set i = i + 1
    endloop

    if ( r &gt; 1) then 
         call UnitRemoveItemSwapped( whichItem, whichUnit ) 
         call DisplayTextToPlayer(GetOwningPlayer(whichUnit),0 ,0 , s1)
        else
            call DoNothing()
        endif
set i = 1
set r = 0
set s = null
set s1 = null
endfunction
</i>
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
if (Condition) then
- ...
else
- call DoNothing()
endif

can simply be

if (Condition) then
- ...
endif

"UnitRemoveItemSwapped" is a BJ function, use "UnitRemoveItem", which takes a unit and an item as arguments (vice versa order with the BJ one).

"DisplayTextToForce", in this content, can be replaced with "DisplayTextToPlayer", which removes the need to create and destroy the force.

- call DisplayTextToPlayer(GetOwningPlayer(whichUnit), 0, 0, s)

In addition to, you don't have to null string, real, integer, boolean and code local variables.
 
S

shadowvzs

Guest
if (Condition) then

"DisplayTextToForce", in this content, can be replaced with "DisplayTextToPlayer", which removes the need to create and destroy the force.

- call DisplayTextToPlayer(GetOwningPlayer(whichUnit), 0, 0, s)

In addition to, you don't have to null string, real, integer, boolean and code local variables.

invalid argument type (unit) if remove swapped word, else work displaytoplayer with removeitemswapped, what is it the two 0 after s in this row?
JASS:
call DisplayTextToPlayer(GetOwningPlayer(whichUnit),0 ,0 , s)


and then i dont need nulling local variables?
 

Sooda

Diversity enchants
Reaction score
318
> and then i dont need nulling local variables?

You need to null all local variables what aren' t native ones.

> what is it the two 0 after s in this row?

Check out Vexorian tutorial he explaned (Or someone) what these two 0. means.
 
S

shadowvzs

Guest
We note that DisplayTextToForce uses DisplayTextToPlayer, and we only needed to show a text for a player, Player 1. Should replace the Msg function to make it call DisplayTextToPlayer

Code:

native DisplayTextToPlayer takes player toPlayer, real x, real y, string message returns nothing

We need a player argument, and to figure out what x and y mean. There is no problem about them though, because DisplayTextToForce used 0 for x and y.

But what to use for player? How do we make it work for Player 1?

and? x y is coordinate in screen because is real?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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