HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Ability name

06-25-2008, 08:21 AM#1
Changaco
Hi.

I created some custom abilities by coping/pasting and when I use the "GetObjectName()" and "GetSpellAbilityId()" functions the result is the same for all the abilities. Is this a well-known problem ? If it is, is there any solution ?

If it can help there is the JASS code of the trigger :
Collapse JASS:
scope PickTool

//------------------------------- Conditions
private function Conditions takes nothing returns boolean
    return GetSpellAbilityUnit() == MasterMakers[GetPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))]
endfunction

//------------------------------- Actions
private function Actions takes nothing returns nothing
    local unit theUnit = GetSpellAbilityUnit()
    local integer unitType = GetUnitTypeId(theUnit)
    local integer playerId = GetPlayerId(GetOwningPlayer(theUnit))
    local integer abilityId = GetSpellAbilityId()
    if ( unitType == 'hM00' ) then
        call DisplayTimedTextToForce( AllPlayers, 9999999999, "playerId: "+I2S(playerId) )
        call DisplayTimedTextToForce( AllPlayers, 9999999999, "abilityName (objetcName): "+GetObjectName(abilityId) )
        call DisplayTimedTextToForce( AllPlayers, 9999999999, "abilityId: "+I2S(abilityId) )
        call DisplayTimedTextToForce( AllPlayers, 9999999999, "abilityString: "+AbilityId2String(abilityId) )
        set MasterMakers[playerId] = ReplaceUnitBJ( theUnit, 'hM00', bj_UNIT_STATE_METHOD_RELATIVE )
        set theUnit = MasterMakers[playerId]
        call SelectUnitForPlayerSingle( theUnit, Player(playerId) )
    endif

endfunction

//------------------------------- Init
public function InitTrig takes nothing returns nothing
    local trigger trig = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( trig, Condition(function Conditions) )
    call TriggerAddAction( trig, function Actions )
endfunction

endscope
06-25-2008, 10:05 AM#2
Aragashia
Well, I don't really know JASS, but I'd guess your problem lies in the spells themselves as they are all copied from one and the same, meaning they all share one single spell ID.

/Aragashia
06-25-2008, 10:53 AM#3
Themerion
Isn't there a function for getting just ability names...?

Something like:

local string s = GetAbilityName('A000')
06-25-2008, 11:59 AM#4
Anitarf
Quote:
Originally Posted by Themerion
Isn't there a function for getting just ability names...?

Something like:

local string s = GetAbilityName('A000')
It's a BJ function, look it up:
http://www.wc3jass.com/viewtopic.php?t=1022
It just calls GetObjectName(), which he has already tried.
06-26-2008, 06:47 AM#5
Changaco
Quote:
Originally Posted by Aragashia
Well, I don't really know JASS, but I'd guess your problem lies in the spells themselves as they are all copied from one and the same, meaning they all share one single spell ID.

/Aragashia
That's my opinion too but how do I get rid of that ? Can I reassign IDs ?
06-26-2008, 04:41 PM#6
Troll-Brain
Hmm maybe i miss understood your problem but i can display the abilityName and the abilityId , it is different for the custom and the original spell.
But abilityString is a null string .

I tried with the human hero ability : divine shield ('AHds') and a custom spell copy of this spell.
06-26-2008, 06:14 PM#7
Changaco
Quote:
Originally Posted by Troll-Brain
Hmm maybe i miss understood your problem but i can display the abilityName and the abilityId , it is different for the custom and the original spell.
But abilityString is a null string .

I tried with the human hero ability : divine shield ('AHds') and a custom spell copy of this spell.
In my case they are the same and that is the problem.
06-27-2008, 03:46 AM#8
Kwah
You can only re-assign IDs if you are using channel or spell book abilities.
06-27-2008, 09:13 AM#9
Changaco
And if it's not is there an other solution ?
06-27-2008, 09:35 AM#10
Anitarf
Quote:
Originally Posted by hawk900
You can only re-assign IDs if you are using channel or spell book abilities.
That's orderstrings, not ability IDs.
06-29-2008, 08:47 PM#11
Changaco
I still don't have any solution.
06-29-2008, 09:04 PM#12
Anitarf
Why do you register the event twice? Could we see some smaple text outputs of your trigger?
06-30-2008, 06:51 AM#13
Changaco
Quote:
Originally Posted by Anitarf
Why do you register the event twice?
I forgot to delete the second ^^
Quote:
Originally Posted by Anitarf
Could we see some sample text outputs of your trigger?
Sure :
Code:
playerId: 9
abilityName (objectName): Zones
abilityId: 1093677110
abilityString:
The player Id is correct but abilityName and abilityId are always the same.
abilityString is always empty but I don't really know what this function is supposed to do so i guess it's normal. ^^
06-30-2008, 12:56 PM#14
Anitarf
Do you by any chance have multiple abilities based on the same base ability on the same unit?

If not, can you reproduce this error in a new testmap and if you can, could you attach the map?
06-30-2008, 02:00 PM#15
Captain Griffen
The problem is you can't have two abilities based off the same one on the same unit (except spell book and channel). If you do, the orders get messed up and it will generally cast only one of them, regardless of which one you try to cast.