| 06-25-2008, 08:21 AM | #1 |
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 : 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 |
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 |
Isn't there a function for getting just ability names...? Something like: local string s = GetAbilityName('A000') |
| 06-25-2008, 11:59 AM | #4 | |
Quote:
http://www.wc3jass.com/viewtopic.php?t=1022 It just calls GetObjectName(), which he has already tried. |
| 06-26-2008, 06:47 AM | #5 | |
Quote:
|
| 06-26-2008, 04:41 PM | #6 |
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 | |
Quote:
|
| 06-27-2008, 03:46 AM | #8 |
You can only re-assign IDs if you are using channel or spell book abilities. |
| 06-27-2008, 09:13 AM | #9 |
And if it's not is there an other solution ? |
| 06-27-2008, 09:35 AM | #10 | |
Quote:
|
| 06-29-2008, 08:47 PM | #11 |
I still don't have any solution. |
| 06-29-2008, 09:04 PM | #12 |
Why do you register the event twice? Could we see some smaple text outputs of your trigger? |
| 06-30-2008, 06:51 AM | #13 | ||
Quote:
Quote:
Code:
playerId: 9 abilityName (objectName): Zones abilityId: 1093677110 abilityString: 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 |
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 |
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. |
