Some Simple Questions

Charapanga

New Member
Reaction score
46
no no no, i want to know if it's possible to make a JASS version, GUI version is "unit Peasant000 <gen> takes damage" is it possible to make it into a generic unit event in JASS? beacuse there is no GUI event "unit - a unit takes damage"
 

Charapanga

New Member
Reaction score
46
I'm absolutely sure that there is no generic unit event
'Unit - A unit takes damage'
Though there is a Specific unit event
'Unit - Peasant000<gen> takes damage'
 

Flare

Stops copies me!
Reaction score
662
Code:
Enumeratin filters
group callbacks
timer callbacks
Enumeration filters - the functions that are used to determine what units should be added to the group when using the GroupEnum functions

Group callback - Equivalent of the looped actions with
Code:
Pick every unit in Group and do actions:

Timer callback - The function that is executed whenever the timer expires e.g.
JASS:
call TimerStart (MyTimer, 5, true, function DoStuff)

That'll call the function DoStuff (which is the timer's callback function) everytime that timer expires (which is every 5 seconds) - the true there determines if the timer continually starts over after expiring

JASS:
function loopstuff takes nothing returns nothing
loop
  exitwhen udg_boolean = false
    // actions
endloop
endfunction

function startloop takes nothing returns nothing
    set udg_boolean = true
    call loopstuff()
    call TriggerSleepAction(5.00)
    set udg_boolean = false
endfunction

That'll hit the op limit

i might have to change all my knockback spells
Knockback spells? Waits? Terrible idea - if you're making a knockback, a high-frequency timer/repeating trigger is required (waits suck balls when it comes to anything that requires precision and fluidity)
 

Romek

Super Moderator
Reaction score
963
There is no generic damage event.

In Jass, it is quite simple to make your own one.
it would still require a bit more work than a normal loop though.

And, I think a few snippets for this have been made.
 

Charapanga

New Member
Reaction score
46
I'll search for it, thanx!
I'll also search for a JASS version of a knockback :)

I'ma go to bed after that, will add more questions tomorow :)
 

Charapanga

New Member
Reaction score
46
That's nice! but, how could i impliment that into a GUI spell that has the finishing touch, a knockback
and how would i make it do damage to units it hits?
 

Charapanga

New Member
Reaction score
46
Open the demo map, theres a GUI example usage.

Alrighty then :)

So, i made a Duel Trigger in GUI and it didn't work...so i converted it to JASS, tinkered a bit, and still it doesn't work...And now i call upon you, the great JASSers of GUI to help me figure this out, i've been banging my head trying to figure out the problem...

JASS:
function Trig_DuelStart_Func001C takes nothing returns boolean
    if ( not ( udg_HumansAlive == false ) ) then
        return false
    endif
    if ( not ( CountPlayersInForceBJ(udg_UserPlayers) &gt;= 2 ) ) then
        return false
    endif
    return true
endfunction

function Trig_DuelStart_Conditions takes nothing returns boolean
    if ( not Trig_DuelStart_Func001C() ) then
        return false
    endif
    return true
endfunction

function Trig_DuelStart_Func004001002 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true )
endfunction

function Trig_DuelStart_Func004A takes nothing returns nothing
    call SetUnitPositionLoc( GetEnumUnit(), GetRectCenter(gg_rct_Dueler1) )
    call SetUnitManaPercentBJ( GetEnumUnit(), 100 )
    call SetUnitLifePercentBJ( GetEnumUnit(), 100 )
    set udg_DuelingPlayer[1] = GetOwningPlayer(GetEnumUnit())
    call ForceRemovePlayerSimple( udg_DuelingPlayer[1], udg_UserPlayers )
endfunction

function Trig_DuelStart_Func005001002 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true )
endfunction

function Trig_DuelStart_Func005A takes nothing returns nothing
    call SetUnitPositionLoc( GetEnumUnit(), GetRectCenter(gg_rct_Dueler1) )
    call SetUnitManaPercentBJ( GetEnumUnit(), 100 )
    call SetUnitLifePercentBJ( GetEnumUnit(), 100 )
    set udg_DuelingPlayer[2] = GetOwningPlayer(GetEnumUnit())
    call ForceRemovePlayerSimple( udg_DuelingPlayer[2], udg_UserPlayers )
endfunction

function Trig_DuelStart_Actions takes nothing returns nothing
    set udg_NoDuel = false
    set udg_UserPlayers = GetPlayersByMapControl(MAP_CONTROL_USER)
    call ForGroupBJ( GetUnitsOfPlayerMatching(ForcePickRandomPlayer(udg_UserPlayers), Condition(function Trig_DuelStart_Func004001002)), function Trig_DuelStart_Func004A )
    call ForGroupBJ( GetUnitsOfPlayerMatching(ForcePickRandomPlayer(udg_UserPlayers), Condition(function Trig_DuelStart_Func005001002)), function Trig_DuelStart_Func005A )
    call SetPlayerAllianceStateBJ( udg_DuelingPlayer[1], udg_DuelingPlayer[2], bj_ALLIANCE_UNALLIED )
    call SetPlayerAllianceStateBJ( udg_DuelingPlayer[2], udg_DuelingPlayer[1], bj_ALLIANCE_UNALLIED )
    call DisplayTextToForce( GetPlayersAll(), ( ( GetPlayerName(udg_DuelingPlayer[1]) + &quot; and &quot; ) + ( GetPlayerName(udg_DuelingPlayer[2]) + &quot; will now engage in a duel, the winner will get 250 gold! Good Luck!&quot; ) ) )
    call DisableTrigger( GetTriggeringTrigger() )
endfunction

//===========================================================================
function InitTrig_DuelStart takes nothing returns nothing
    set gg_trg_DuelStart = CreateTrigger(  )
    call DisableTrigger( gg_trg_DuelStart )
    call TriggerRegisterTimerEventPeriodic( gg_trg_DuelStart, 10.00 )
    call TriggerAddCondition( gg_trg_DuelStart, Condition( function Trig_DuelStart_Conditions ) )
    call TriggerAddAction( gg_trg_DuelStart, function Trig_DuelStart_Actions )
endfunction


The players are allies at first, then this trigger turns them into enemies and teleports them...In theory...but in reality, it doesnt even start...I got another trigger that turns on this trigger between waves...and the other trigger works fine...
 

Charapanga

New Member
Reaction score
46
Bump
Problem STILL not solved
And i got a Syntax error for this line:
JASS:
            call DestroyTimer (udg_ReviveTimer[Get ForLoopIndexA()])

EDIT: It was a space...Fixed
 
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