• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Why does this not work?

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,602
Hero only make an animation, but this doesn't work. It works in a test map which I have attached. This should be just like a basic attack.

JASS:
//TESH.scrollpos=25
//TESH.alwaysfold=0
//===========================================================================
//===================================SETUP===================================
//===========================================================================
function BookAttack_AID_ATTACK takes nothing returns integer
    return 'A61L' //Change to your attack ability Id
endfunction

function BookAttack_GROUP takes nothing returns group
    //Make a UnitGroup variable
    return udg_TempGroup //Edit. Should be "udg_" plus whatever name you used.
endfunction
//===========================================================================
//================================END OF SETUP===============================
//===========================================================================

function BookAttack_SET_GROUP takes group g returns nothing
    set g = CreateGroup()
endfunction

function BookAttack_DoTrue takes nothing returns boolean
   return true
endfunction

function BookAttack_Select takes nothing returns nothing
    if IsUnitInGroup(GetTriggerUnit(), BookAttack_GROUP()) then //Checks if unit is already in the group, preventing double select.
    else
        call GroupAddUnit(BookAttack_GROUP(), GetTriggerUnit())
    endif
endfunction

function BookAttack_Deselect takes nothing returns nothing
    call GroupRemoveUnit(BookAttack_GROUP(), GetTriggerUnit())
endfunction

function BookAttack_Attack takes nothing returns nothing
    if GetSpellTargetUnit() != null then
        call GroupTargetOrderById(BookAttack_GROUP(), 851983, GetSpellTargetUnit())
    else
        call GroupPointOrderByIdLoc(BookAttack_GROUP(), 851983, GetSpellTargetLoc())
    endif
endfunction

function BookAttack_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == BookAttack_AID_ATTACK()
endfunction

function InitTrig_BookAttack takes nothing returns nothing
    local trigger t1 = CreateTrigger()
    local trigger t2 = CreateTrigger()
    local trigger t3 = CreateTrigger()
    local integer i = 0
    loop
        call TriggerRegisterPlayerUnitEvent(t1, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, Condition(function BookAttack_DoTrue))
        call TriggerRegisterPlayerUnitEvent(t2, Player(i), EVENT_PLAYER_UNIT_SELECTED, Condition(function BookAttack_DoTrue))
        call TriggerRegisterPlayerUnitEvent(t3, Player(i), EVENT_PLAYER_UNIT_DESELECTED, Condition(function BookAttack_DoTrue))
        set i = i + 1
        exitwhen i == 12
    endloop
    call TriggerAddCondition(t1, Condition(function BookAttack_Conditions))
    call TriggerAddAction(t1, function BookAttack_Attack)
    call TriggerAddAction(t2, function BookAttack_Select)
    call TriggerAddAction(t3, function BookAttack_Deselect)
    call BookAttack_SET_GROUP(BookAttack_GROUP())
    //Cleanup
    set t1 = null
    set t2 = null
    set t3 = null
    set i = 0
endfunction
 

Attachments

  • Hive6.w3x
    14.2 KB · Views: 36
Level 5
Joined
Jan 6, 2006
Messages
106
Exactly. The 'A61L' ability code can only be achieved by using Campaign Object Editors, if you directly import the script into a new map of course your ability will not be presented in this raw code, instead it should be 'A0**' or something like that.

Other than that, there seems to be no other problems in your scripting.
 
Last edited:
Level 37
Joined
Aug 14, 2006
Messages
7,602
I'm not sure what you are talking about, bountygiver.

I have a trigger category that I always copy to all chapters. This trigger is belongs to this category. So you are saying, it doesn't work because I copy this to all chapters?

Actually, this worked perfectly some versions ago, I really wonder what is wrong now. It's raw code really is "A61L". Hmm?
 
Level 5
Joined
Jan 6, 2006
Messages
106
I'm not sure what you are talking about, bountygiver.

I have a trigger category that I always copy to all chapters. This trigger is belongs to this category. So you are saying, it doesn't work because I copy this to all chapters?

Actually, this worked perfectly some versions ago, I really wonder what is wrong now. It's raw code really is "A61L". Hmm?

Hmmm... So the rawcode has no problems. May I ask what skill is your 'A61L' based on?
 
Level 5
Joined
Jan 6, 2006
Messages
106
JASS:
function BookAttack_Attack takes nothing returns nothing
    if GetSpellTargetUnit() != null then
        call GroupTargetOrderById(BookAttack_GROUP(), 851983, GetSpellTargetUnit())
    else
        call GroupPointOrderByIdLoc(BookAttack_GROUP(), 851983, GetSpellTargetLoc())
    endif
endfunction

OK, back to the point. From these lines it seems that 851983 is an order ID. Would you mind telling me what is the string name of the order? Is it some spell like "shockwave", "carrion swarm" or something similar?
 
Level 6
Joined
Sep 5, 2007
Messages
264
I'm not sure what you are talking about, bountygiver.

I have a trigger category that I always copy to all chapters. This trigger is belongs to this category. So you are saying, it doesn't work because I copy this to all chapters?

Actually, this worked perfectly some versions ago, I really wonder what is wrong now. It's raw code really is "A61L". Hmm?

@Aeroblyctos: When bountygiver was talking about a rawcode he was meaning the ability's rawcode that the engine uses to identify each individual ability. EG: 'A000', 'A001', 'A002', etc. If you are unsure of whether your rawcode in that script is the one you're after, then go into the object editor (abilities tab) and press CONTROL-D when you have your ability selected. In the left column, the rawcode of the ability will appear. :thumbs_up:
 
Level 37
Joined
Aug 14, 2006
Messages
7,602
bountygiver said:
well, what about the order ID 851983?
What the hell is that code? Some kind of FBI super code?

bountygiver said:
Is it some kind of unit/point target spell like shockwave or carrion swarm or something like that?
Yeah, that channel is. You can change it to way you want and I put it to "target + aoe".

PurplePoot said:
bountygiver, JassNewGenPack allows you to assign custom rawcodes.
Let's forget about that. Campaigns doesn't like "JassNewGenPack"(so I have heard) and I don't even have it.

bountygiver said:
And no one will assign his/her rawcodes to A6** or something like that. Probably he uses the campaign editor to make his abilities then directly import them into his maps.
Yea I always copy specific triggers to all maps before releasing new version.

OK, back to the point. From these lines it seems that 851983 is an order ID. Would you mind telling me what is the string name of the order? Is it some spell like "shockwave", "carrion swarm" or something similar?
Perhaps I need to change that code number to something...?

@Aeroblyctos: When bountygiver was talking about a rawcode he was meaning the ability's rawcode that the engine uses to identify each individual ability. EG: 'A000', 'A001', 'A002', etc. If you are unsure of whether your rawcode in that script is the one you're after, then go into the object editor (abilities tab) and press CONTROL-D when you have your ability selected. In the left column, the rawcode of the ability will appear. :thumbs_up:
Yeah... I know! Heh, I have been doing that Eleandor spell book system and I have learned something about raw codes. Thanks anyway.

There might be other way. How the hell I remove patrol button and put that basic attack button instead of it?
 
Level 6
Joined
Sep 5, 2007
Messages
264
What the hell is that code? Some kind of FBI super code?
LOLZ! That's a good comment Aeroblyctos. :xxd:
That number appears to be the numerical form of an order-id string EG: "attack", "stop", "move", etc.

That could be the problem, if that number doesn't link with the order-id that you're after... :thumbs_down: nothing will happen... So you'll be sitting there going ":confused: when the f*ck is my trigger gonna kick in???" :xxd:

On a more serious note, from your comments it sounds like that ability rawcode could be the culprit aswell...

EDIT: Sorry for telling you something so simple that you already knew :hohum: I'm used to dealing with the people that DON'T know what a rawcode is...
 
Level 6
Joined
Sep 5, 2007
Messages
264
Firstly, I'd check that ability rawcode... If it's not 'A61L', then change that code in the trigger to the correct rawcode...

Then I'd change that "magic" Order-Id call to one that uses strings:
JASS:
function BookAttack_Attack takes nothing returns nothing
    if (GetSpellTargetUnit() != null) then
        call GroupTargetOrder(BookAttack_GROUP(), <string>, GetSpellTargetUnit())
    else
        call GroupPointOrderLoc(BookAttack_GROUP(), <string>, GetSpellTargetLoc())
    endif
endfunction
Where the <string> is, I'd assume that you'd put "grabtree" from what you said earlier. But, I could be wrong there.

I'm not sure after that. Let me know how you go.
 
Status
Not open for further replies.
Top