So, i decided to try add Vercas Ability System to my map, however the abilities are not perm when u use a transformation spell
the book disappeared and if u set the book up to re add when u transform, the abilities in it disappear, any help?
and then after transform
the book disappeared and if u set the book up to re add when u transform, the abilities in it disappear, any help?
JASS:
//TESH.scrollpos=1
//TESH.alwaysfold=0
/***************************************************************************************************\
| Abilities System |
| by Vercas |
| |
| Requires: - Table |
| by Vexorian |
| |
| I made this system for my map, for making managing abilities easier but I thought other |
| people could use it as well so I uploaded it! |
| |
| Since version 2.01.a1, it has been completly rewritten and now the only reason to lag is...|
| ABILITIES PRELOADING!!! |
| You know, the crappy Warcraft 3 engine lags the first time it sees an ability on an unit... |
| So do not complain for the lag, I will fix it later! |
| |
| I've kept the old documentation trigger if you have any questions... |
| |
| |
| Application Programming Interface (API) : |
| |
| AddAbil( item ID, ability ID, boolean) -> nothing |
| This adds an item to the system; |
| Assigns an ability to an item! If the boolean is true, the ability is given when |
| the item is picked up, else when it's used. |
\***************************************************************************************************/
/**/library AbilitiesSystem initializer Init requires Table/***************************************/
globals
private constant integer SB_ABILITY = 'A0CZ' // The ID of your main Spellbook. Please check the Object Editor for the ability.
private Table ItemAbility // Fastest way to get the ability assigned to an item
private Table ItemUsed // 0 is true ; anything else is false... Pretty useless...
private Table AbilityItem // To be used later for backwards compatibility
endglobals
function AddAbil takes integer it, integer abil, boolean c returns nothing
local integer i = 0
set it:ItemAbility = abil
if c then
set it:ItemUsed = 0
else
set it:ItemUsed = 1
endif
set abil:AbilityItem = it
loop
call SetPlayerAbilityAvailable( Player( i ), abil, false )
set i = i + 1
exitwhen i >= 16
endloop
endfunction
private function Action takes nothing returns nothing
local integer i = GetItemTypeId( GetManipulatedItem( ) )
call RemoveItem( GetManipulatedItem( ) )
call UnitAddAbility( GetTriggerUnit( ) , i:ItemAbility )
call UnitMakeAbilityPermanent(GetTriggerUnit(), true, i:ItemAbility)
endfunction
private function Cond1 takes nothing returns boolean
local integer i = GetItemTypeId( GetManipulatedItem( ) )
return i:ItemAbility != 0 and i:ItemUsed == 0
endfunction
private function Cond2 takes nothing returns boolean
local integer i = GetItemTypeId( GetManipulatedItem( ) )
return i:ItemAbility != 0 and i:ItemUsed != 0
endfunction
private function Cond takes nothing returns boolean
return GetUnitAbilityLevel( GetFilterUnit(), SB_ABILITY ) > 0
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger ( )
local trigger t2 = CreateTrigger ( )
local boolexpr BX= Condition ( function Cond )
local integer i = 0
set ItemAbility = Table.create ( )
set ItemUsed = Table.create ( )
set AbilityItem = Table.create ( )
loop
call TriggerRegisterPlayerUnitEvent( t , Player(i), EVENT_PLAYER_UNIT_PICKUP_ITEM, BX )
call TriggerRegisterPlayerUnitEvent( t2, Player(i), EVENT_PLAYER_UNIT_USE_ITEM , BX )
set i = i + 1
exitwhen i >= 16
endloop
call TriggerAddCondition ( t , Condition( function Cond1 ) )
call TriggerAddCondition ( t2, Condition( function Cond2 ) )
call TriggerAddAction ( t , function Action )
call TriggerAddAction ( t2, function Action )
endfunction
endlibrary
-
SetAbilitys
-
Events
-
Time - Elapsed game time is 0.01 seconds
-
-
Conditions
-
Actions
-
-------- Weapon Skills --------
-
-------- Active Skills --------
-
-------- Hide --------
-
Custom script: call AddAbil( 'I07Y', 'A0D2', true )
-
-------- Passive Skills --------
-
-
-
StartSkills
-
Events
-
Time - Elapsed game time is 1.00 seconds
-
-
Conditions
-
Actions
-
For each (Integer A) from 1 to 7, do (Actions)
-
Loop - Actions
-
Set VariableSet SBS = (Player((Player number of (Player((Integer A))))))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(SBS controller) Equal to User
-
(SBS slot status) Equal to Is playing
-
-
Then - Actions
-
Unit - Add |cffffff80Book|r of Skills to SetHeroGS[(Player number of (Player((Integer A))))]
-
Hero - Create Hide (SBA) and give it to SetHeroGS[(Player number of (Player((Integer A))))]
-
-
Else - Actions
-
-
-
-
-
-
Skill Aquire
-
Events
-
Unit - A unit Acquires an item
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-type of (Item being manipulated)) Equal to Hide (SBA)
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
SBAHide[(Player number of (Owner of (Hero manipulating item)))] Equal to 0
-
-
Then - Actions
-
Set VariableSet SBAHide[(Player number of (Owner of (Hero manipulating item)))] = 1
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
JASS:
//TESH.scrollpos=74
//TESH.alwaysfold=0
library Table
//***************************************************************
//* Table object 3.0
//* ------------
//*
//* set t=Table.create() - instanceates a new table object
//* call t.destroy() - destroys it
//* t[1234567] - Get value for key 1234567
//* (zero if not assigned previously)
//* set t[12341]=32 - Assigning it.
//* call t.flush(12341) - Flushes the stored value, so it
//* doesn't use any more memory
//* t.exists(32) - Was key 32 assigned? Notice
//* that flush() unassigns values.
//* call t.reset() - Flushes the whole contents of the
//* Table.
//*
//* call t.destroy() - Does reset() and also recycles the id.
//*
//* If you use HandleTable instead of Table, it is the same
//* but it uses handles as keys, the same with StringTable.
//*
//* You can use Table on structs' onInit if the struct is
//* placed in a library that requires Table or outside a library.
//*
//* You can also do 2D array syntax if you want to touch
//* mission keys directly, however, since this is shared space
//* you may want to prefix your mission keys accordingly:
//*
//* set Table["thisstring"][ 7 ] = 2
//* set Table["thisstring"][ 5 ] = Table["thisstring"][7]
//*
//***************************************************************
//=============================================================
globals
private constant integer MAX_INSTANCES=8100 //400000
//Feel free to change max instances if necessary, it will only affect allocation
//speed which shouldn't matter that much.
//=========================================================
private hashtable ht
endglobals
private struct GTable[MAX_INSTANCES]
method reset takes nothing returns nothing
call FlushChildHashtable(ht, integer(this) )
endmethod
private method onDestroy takes nothing returns nothing
call this.reset()
endmethod
//=============================================================
// initialize it all.
//
private static method onInit takes nothing returns nothing
set ht = InitHashtable()
endmethod
endstruct
//Hey: Don't instanciate other people's textmacros that you are not supposed to, thanks.
//! textmacro Table__make takes name, type, key
struct $name$ extends GTable
method operator [] takes $type$ key returns integer
return LoadInteger(ht, integer(this), $key$)
endmethod
method operator []= takes $type$ key, integer value returns nothing
call SaveInteger(ht, integer(this) ,$key$, value)
endmethod
method flush takes $type$ key returns nothing
call RemoveSavedInteger(ht, integer(this), $key$)
endmethod
method exists takes $type$ key returns boolean
return HaveSavedInteger( ht, integer(this) ,$key$)
endmethod
static method flush2D takes string firstkey returns nothing
call $name$(- StringHash(firstkey)).reset()
endmethod
static method operator [] takes string firstkey returns $name$
return $name$(- StringHash(firstkey) )
endmethod
endstruct
//! endtextmacro
//! runtextmacro Table__make("Table","integer","key" )
//! runtextmacro Table__make("StringTable","string", "StringHash(key)" )
//! runtextmacro Table__make("HandleTable","handle","GetHandleId(key)" )
endlibrary
and then after transform