• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Code problem

Status
Not open for further replies.
Level 1
Joined
Jun 24, 2007
Messages
3
Hi im new to JASS and i wanna make 3 bloodmages in different locations(but for testing i just wanna use the same region) and at the same time create the regions they appear in inside JASS and lastly teach them a skill

what am i doing wrong?

variables in variable editor:
rect76
rect77
rect78

JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing        
        set udg_rect76=Rect(0.,0.7,0.,-1024.)
        call CreateNUnitsAtLoc( 1, 'Hblm', Player(0),GetRectCenter(udg_rect76),bj_UNIT_FACING)
        call SelectHeroSkill( GetLastCreatedUnit(), 'AHfs' )
        set udg_rect77=Rect(0.,0.6,0.,-1024.)
        call CreateNUnitsAtLoc( 1, 'Hblm', Player(0),GetRectCenter(udg_rect77),bj_UNIT_FACING)
        call SelectHeroSkill( GetLastCreatedUnit(), 'AHfs' )
        set udg_rect78=Rect(0.,0.7,0.,-1024.)
        call CreateNUnitsAtLoc( 1, 'Hblm', Player(0),GetRectCenter(udg_rect78),bj_UNIT_FACING)
        call SelectHeroSkill( GetLastCreatedUnit(), 'AHfs' )
        call ExecuteFunc("Trig_Untitled_Trigger_001_Actions")
endfunction

function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions)
endfunction
 
Last edited by a moderator:
Just so you know, your trigger leaks because of "GetRectCenter()", set it to a variable.

I can't see what's wrong with the rects, maybe you might want to preplace the rects using WE's region palette, and then set them to the rects by using a generated global such as:
JASS:
gg_rct_Something

To figure out the "something" part, just convert a trigger to custom text that uses a rect as a value so that it displays the "gg_rct_(Something)" part.

----------------

Also, to teach the ability, I don't know if "SelectHeroSkill" will do it.

Instead, use this:
JASS:
native UnitAddAbility               takes unit whichUnit, integer abilityId returns boolean
 
//BLANK LINE

To add the ability.

And use this:
JASS:
native          SetUnitAbilityLevel takes unit whichUnit, integer abilcode, integer level returns integer
 
//BLANK LINE

To set the level of the ability.

------------------

Btw, it would be easier to use a loop instead... If you want me to tell you how, just ask. :smile:
 
Last edited:
Level 1
Joined
Jun 24, 2007
Messages
3
Sry im new to JASS as i said and i cant completly understand what your solution is so if u could just write out the code i would be thankful
btw i dont want any pre-placed regions on the map :grin:
 
Level 5
Joined
Sep 21, 2004
Messages
186
First off, I will admit that I know nothing about JASS and probably shouldn't be prowling the JASS forum. That said, your trigger would be very simple to do in GUI using ((Region centered around)Last Created Unit) and then actions.
 
Status
Not open for further replies.
Top