newb 2 jass question

Emu.Man00

New Member
Reaction score
41
yeah just started jass today, and im going on a couple tutorials and the code that you get from using convert to custom script in WE :S
I tried to add a variable for spell being cast, and then order the caster to use the spell on a random; so heres what i did

Code:
function Trig_Spell_Transport_Func004C takes nothing returns boolean
    if ( not ( GetSpellAbilityUnit() == udg_Spell_Transport_Target ) ) then
        return false
    endif
    if ( not ( IsUnitEnemy(GetSpellTargetUnit(), GetOwningPlayer(GetSpellAbilityUnit())) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spell_Transport_Conditions takes nothing returns boolean
    if ( not Trig_Spell_Transport_Func004C() ) then
        return false
    endif
    return true
endfunction

function Trig_Spell_Transport_Func002002001003 takes nothing returns boolean
    return ( IsPlayerAlly(GetOwningPlayer(udg_Spell_Transport_Random), GetOwningPlayer(GetSpellAbilityUnit())) == true )
endfunction

function Trig_Spell_Transport_Actions takes nothing returns nothing
(43)    [B]set udg_Spell_Transport_Casted = GetSpellAbility()[/B]
    set udg_Spell_Transport_Target = GroupPickRandomUnit(GetUnitsInRangeOfLocAll(200.00, GetUnitLoc(GetSpellAbilityUnit())))
    set udg_Spell_Transport_Target = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(200.00, GetUnitLoc(GetSpellAbilityUnit()), Condition(function Trig_Spell_Transport_Func002002001003)))
(46)    call IssueTargetOrderBJ( GetSpellAbilityUnit(), [B]udg_Spell_Transport_Casted[/B] , udg_Spell_Transport_Random )
endfunction

(49)//===========================================================================
function InitTrig_Spell_Transport takes nothing returns nothing
    set gg_trg_Spell_Transport = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Spell_Transport, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Spell_Transport, Condition( function Trig_Spell_Transport_Conditions ) )
    call TriggerAddAction( gg_trg_Spell_Transport, function Trig_Spell_Transport_Actions )
endfunction

bold parts are what i changed, and i get 3 errors:
line 43: type mismatch in assignment
line 46: invalid arguement type (integer)
line 49: expected a code statement (integer)
 

Romek

Super Moderator
Reaction score
964
GetSpellAbility() returns an ability.. I think you want GetSpellAbilityID() for the integer.
Also, IssueTargetOrderBJ uses a string for the order. You should use IssueTargetOrderById.

And, Use Jass (
jass.gif
) tags for Jass =]
 

Emu.Man00

New Member
Reaction score
41
but i want the ability cause i wanna make the unit cast it, no? :S
IssueTargetOrderBJ was what WE made it when i converted from gui :S
and i didnt notice there were jass tags :S
----
i tried using ID and still got 3 errors, first one changed to
expecting name
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
GetSpellAbilityId(), not ID(). JASS is case-sensitive.
 

Emu.Man00

New Member
Reaction score
41
I was told by a friend in game that this simply isnt possible :S am i wasting my time trying to do this?
 

Emu.Man00

New Member
Reaction score
41
well i tested it in game, and it simply doesnt work :S he can cast spells without any problem

edit: sometimes he just stops casting, some times he casts fine :S
 

Emu.Man00

New Member
Reaction score
41
no1 got a solution?

for the widget am i just supposed to use the same variable i used before? cause theres no variable called 'widget' :S (this probably sounds rly rly stupid :()
 

Romek

Super Moderator
Reaction score
964
A widget is anything with health.
Units, Destructibles, Items (I think) etc. (Or is that all of them?)

Can you post your current, updated code?
In Jass
jass.gif
tags :)
 

Emu.Man00

New Member
Reaction score
41
lol xD the variable is a unit variable :S

JASS:
function Trig_Spell_Transport_Func004C takes nothing returns boolean
    if ( not ( GetSpellAbilityUnit() == udg_Spell_Transport_Target ) ) then
        return false
    endif
    if ( not ( IsUnitEnemy(GetSpellTargetUnit(), GetOwningPlayer(GetSpellAbilityUnit())) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Spell_Transport_Conditions takes nothing returns boolean
    if ( not Trig_Spell_Transport_Func004C() ) then
        return false
    endif
    return true
endfunction

function Trig_Spell_Transport_Func002002001003 takes nothing returns boolean
    return ( IsPlayerAlly(GetOwningPlayer(udg_Spell_Transport_Random), GetOwningPlayer(GetSpellAbilityUnit())) == true )
endfunction

function Trig_Spell_Transport_Actions takes nothing returns nothing
    set udg_Spell_Transport_Cast = GetSpellAbilityId()
    set udg_Spell_Transport_Target = GroupPickRandomUnit(GetUnitsInRangeOfLocAll(200.00, GetUnitLoc(GetSpellAbilityUnit())))
    set udg_Spell_Transport_Target = GroupPickRandomUnit(GetUnitsInRangeOfLocMatching(200.00, GetUnitLoc(GetSpellAbilityUnit()), Condition(function Trig_Spell_Transport_Func002002001003)))
    call IssuePointOrderLocBJ( GetSpellAbilityUnit(), "stop", GetUnitLoc(GetSpellAbilityUnit()) )
    call TriggerSleepAction( 0.3 )
    call IssueTargetOrderById( GetSpellAbilityUnit(), udg_Spell_Transport_Cast , udg_Spell_Transport_Random )

endfunction

//===========================================================================
function InitTrig_Spell_Transport takes nothing returns nothing
    set gg_trg_Spell_Transport = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Spell_Transport, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Spell_Transport, Condition( function Trig_Spell_Transport_Conditions ) )
    call TriggerAddAction( gg_trg_Spell_Transport, function Trig_Spell_Transport_Actions )
endfunction
 
Reaction score
456
JASS:
function Trig_Spell_Transport_Func002002001003 takes nothing returns boolean
    return ( IsPlayerAlly(GetOwningPlayer(udg_Spell_Transport_Random), GetOwningPlayer(GetSpellAbilityUnit())) == true )
endfunction


JASS:
    call IssueTargetOrderById( GetSpellAbilityUnit(), udg_Spell_Transport_Cast , udg_Spell_Transport_Random )


You haven't set udg_Spell_Transport_Random to anything.

> :S i wish ppl were as active in jass section as the gui one.
:S And I wish the one who we are helping is as active as we are.
 
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