[DUVIDA] Como Botar Restrição de Iten ?
3 participantes
TeaM KingS :: Games: :: Warcraft: World Editor :: ::
Página 1 de 1
[DUVIDA] Como Botar Restrição de Iten ?
To querendo Saber como Botar uma Restrição em Itens, tipo
pra Warrior, Archer, Mage.
se alguem souber valeu
pra Warrior, Archer, Mage.
se alguem souber valeu
ThePlooper- Número de Posts : 81
Data de inscrição : 06/02/2010
Reputação : 5 Pontos : 26084
Re: [DUVIDA] Como Botar Restrição de Iten ?
ThePlooper eu vou fala com Troia ^^ ele não respondeu antes por que teve que sair ^^ mais se eu sobese ajuda =/.
Ps: olha meu modelo hehe do ichigo xD
Ps: olha meu modelo hehe do ichigo xD
Re: [DUVIDA] Como Botar Restrição de Iten ?
Download -> http://www.hiveworkshop.com/forums/spells-569/advanced-equipment-system-133727/?prev=search%3Ditem%26r%3D20%26d%3Dlist%26page%3D2
Um ótimo sistema, se tiver duvidas pode perguntar...
Importante: Importe todos os custom modelos que tem nesse mapa.
Codigo / Jass
- Spoiler:
- library AdvancedEquipmentSystem initializer Init
// The_Witcher's Equipment System
//
// This is an easy to use equipment system.
//
// for better understanding: -index means an integer value given from this system
// to the items you register
// -ID means the rawcode of an item
//
// you have to set up items before the system can use them. use this function for that
// call EquipmentSystem_RegisterItem(itemid, effect1, effekt2, effekt3, icon, class, twohanded, animation)
// integer integer integer integer integer integer boolean string
//
// to give a unit the ability to equip things just use
//
// call InitEquipment( yourunit )
//
// to check whether a unit has something equipped in a class use
//
// IsEquipmentClassEmpty( u, class) it returns a boolean
// unit integer
//
// in case you want the rawcode of an equipped item use
// GetEquipItemID (owner, class) it returns an integer
// unit integer
//
// if you want to force an item to be equipped use
// EquipItemByID (u, id)
// unit integer
//
// use the following one to force equipping by index
// EquipItemByIndex (u, index)
// unit integer
//
//
// if you want to make a item unaquipable(false)/equipable(true) for a unit use these:
// EnableItemEquipByID ( u, id, flag )
// unit integer boolean
//
// EnableItemEquipByIndex ( u, index, flag )
// unit integer boolean
//
// if you want to transfer the equipment of a unit to another one (for example because you had to replace the unit) use:
// TransferEquipment (a, b)
// unit unit
//
//----- For SAVE/LOAD systems use these functions: -----
//
// use this function to get the index of the equipped item of class xyz (save these values in your load code) ...
// GetEquipItemIndex (u, class) it returns an integer
// unit integer
//
// ... and this function to equip a new item by this index (which you read out from the load code)!
// EquipItemByIndex (u, index)
// unit integer
//
//
// to implement this system, just copy this trigger in your map
// it requires jngp to work well
//
// have fun^^
//--------------Customizeable Part----------------------
globals
// this is the rawcode of the unit which works as inventory
private constant integer INVENTORY_DUMMY = 'h007'
// this is the amount of classes you have (like ring, boots, etc..)
private constant integer ITEMCLASSES = 9
// this is the class you selected as mainhand class
private constant integer MAINHAND_CLASS = 1
// this is the class you selected as offhand class
private constant integer OFFHAND_CLASS = 2
// this is the ability to close the inventory
private constant integer EXIT_ABILITY = 'A00G'
// this is the ability to open the inventory
private constant integer OPEN_ABILITY = 'A003'
// this is the text shown when a unit is trying to equip an item which it isnt allowed to
// example: " can't equip " becomes ingame something like Soldier can't equip Giant Sword
private constant string UNABLE_TO_EQUIP = " can't equip "
// this is the icon ability shown in the offhand slot when a twhoanded weapon is equipeed
private constant integer TWOHAND_ABILITY = 'A00Z'
// if this is true the TWOHAND_ABILITY will be shown
private constant boolean SHOW_TWOHAND_ABILITY = true
// just ignore the following variable
private integer array normalpic
endglobals
private function InitNormals takes nothing returns nothing // here you have to give an icon ability for every empty slot
// this is my setup for the testmap
//class 1 = mainhand
//class 2 = offhand
//class 3 = amulet
//class 4 = armor
//class 5 = boots
//class 6 = gloves
//class 7 = ring
//class 8 = helmet
//class 9 = special
set normalpic[1] = 'A00D'
set normalpic[2] = 'A00E'
set normalpic[3] = 'A00A'
set normalpic[4] = 'A007'
set normalpic[5] = 'A00F'
set normalpic[6] = 'A004'
set normalpic[7] = 'A00C'
set normalpic[8] = 'A00L'
set normalpic[9] = 'A00M'
endfunction
//--------------------------------------------------------
//-------------don't edit anything below------------------
//--------------------------------------------------------
//---------------system code------------------------------
//--------------------------------------------------------
private struct Inventory
unit owner
unit u
string animtag = ""
integer array icon[12]
integer array effekt1[12]
integer array effekt2[12]
integer array effekt3[12]
integer array Item[12]
boolean array enabled[200]
endstruct
globals
private integer items = 0
private integer array itemm
private integer array itemclass
private integer array itemeffekt1
private integer array itemeffekt2
private integer array itemeffekt3
private integer array itempic
private boolean array twohand
private string array tag
private hashtable h = InitHashtable()
endglobals
function InitEquipment takes unit whichunit returns nothing
local Inventory dat = Inventory.create()
local integer i = 1
local unit u = whichunit
set dat.owner = u
set dat.u = CreateUnit(GetOwningPlayer(dat.owner),INVENTORY_DUMMY,GetUnitX(dat.owner),GetUnitY(dat.owner),0)
call UnitAddAbility(dat.u,EXIT_ABILITY)
call UnitAddAbility(dat.owner,OPEN_ABILITY)
loop
exitwhen i > ITEMCLASSES
call UnitAddAbility(dat.u,normalpic[i])
set dat.icon[i] = normalpic[i]
set dat.effekt1[i] = 0
set dat.effekt2[i] = 0
set dat.effekt3[i] = 0
set dat.Item[i] = 0
set i = i + 1
endloop
set i = 0
loop
exitwhen i > items
set dat.enabled[i] = true
set i = i + 1
endloop
call SaveInteger(h,GetHandleId(u),1,dat)
call SaveInteger(h,GetHandleId(dat.u),1,dat)
set u = null
endfunction
public function RegisterItem takes integer itemid, integer ability1,integer ability2,integer ability3, integer icon, integer class, boolean twohanded, string animation returns nothing
set items = items + 1
set itemm[items] = itemid
set itemclass[items] = class
set itemeffekt1[items] = ability1
set itemeffekt2[items] = ability2
set itemeffekt3[items] = ability3
set itempic[items] = icon
set tag[items] = animation
if class == MAINHAND_CLASS then
set twohand[items] = twohanded
else
set twohand[items] = false
endif
call SaveInteger(h,itemid,1,items)
call SaveInteger(h,icon,1,items)
endfunction
private function Equip takes unit u, item ite returns nothing
local Inventory dat = LoadInteger(h,GetHandleId(u),1)
local integer id = GetItemTypeId(ite)
local integer i = LoadInteger(h,id,1)
local integer ii = LoadInteger(h,dat.Item[MAINHAND_CLASS],1)
call RemoveItem(ite)
if itemclass[i] == MAINHAND_CLASS or itemclass[i] == OFFHAND_CLASS then
if twohand[i] or twohand[ii] then
call UnitRemoveAbility(dat.u, dat.icon[OFFHAND_CLASS])
call UnitRemoveAbility(dat.owner, dat.effekt1[OFFHAND_CLASS])
call UnitRemoveAbility(dat.owner, dat.effekt2[OFFHAND_CLASS])
call UnitRemoveAbility(dat.owner, dat.effekt3[OFFHAND_CLASS])
call UnitAddAbility(dat.u, normalpic[OFFHAND_CLASS])
call UnitAddItemById(dat.owner, dat.Item[OFFHAND_CLASS])
set dat.icon[OFFHAND_CLASS] = normalpic[OFFHAND_CLASS]
set dat.effekt1[OFFHAND_CLASS] = 0
set dat.effekt2[OFFHAND_CLASS] = 0
set dat.effekt3[OFFHAND_CLASS] = 0
set dat.Item[OFFHAND_CLASS] = 0
call UnitRemoveAbility(dat.u, dat.icon[MAINHAND_CLASS])
call UnitRemoveAbility(dat.owner, dat.effekt1[MAINHAND_CLASS])
call UnitRemoveAbility(dat.owner, dat.effekt2[MAINHAND_CLASS])
call UnitRemoveAbility(dat.owner, dat.effekt3[MAINHAND_CLASS])
call UnitAddItemById(dat.owner, dat.Item[MAINHAND_CLASS])
call UnitAddAbility(dat.u, normalpic[MAINHAND_CLASS])
set dat.icon[MAINHAND_CLASS] = normalpic[MAINHAND_CLASS]
set dat.effekt1[MAINHAND_CLASS] = 0
set dat.effekt2[MAINHAND_CLASS] = 0
set dat.effekt3[MAINHAND_CLASS] = 0
set dat.Item[MAINHAND_CLASS] = 0
endif
if SHOW_TWOHAND_ABILITY and twohand[i]then
call UnitRemoveAbility(dat.u, dat.icon[OFFHAND_CLASS])
call UnitAddAbility(dat.u, TWOHAND_ABILITY)
set dat.icon[OFFHAND_CLASS] = TWOHAND_ABILITY
endif
if dat.Item[OFFHAND_CLASS] == 0 then
call AddUnitAnimationProperties(dat.owner, dat.animtag, false)
call AddUnitAnimationProperties(dat.owner, tag[i], true)
set dat.animtag = tag[i]
endif
endif
call UnitRemoveAbility(dat.u, dat.icon[itemclass[i]])
call UnitRemoveAbility(dat.owner, dat.effekt1[itemclass[i]])
call UnitRemoveAbility(dat.owner, dat.effekt2[itemclass[i]])
call UnitRemoveAbility(dat.owner, dat.effekt3[itemclass[i]])
call UnitAddItemById(dat.owner, dat.Item[itemclass[i]])
call UnitAddAbility(dat.owner, itemeffekt1[i])
call UnitAddAbility(dat.owner, itemeffekt2[i])
call UnitAddAbility(dat.owner, itemeffekt3[i])
call UnitAddAbility(dat.u, itempic[i])
set dat.icon[itemclass[i]] = itempic[i]
set dat.effekt1[itemclass[i]] = itemeffekt1[i]
set dat.effekt2[itemclass[i]] = itemeffekt2[i]
set dat.effekt3[itemclass[i]] = itemeffekt3[i]
set dat.Item[itemclass[i]] = itemm[i]
endfunction
private function check takes nothing returns boolean
return LoadInteger(h,GetItemTypeId(GetManipulatedItem()),1) != 0
endfunction
private function access takes nothing returns nothing
local unit u = GetTriggerUnit()
local Inventory dat = LoadInteger(h,GetHandleId(u),1)
local integer i = LoadInteger(h,GetSpellAbilityId(),1)
if (GetSpellAbilityId() == EXIT_ABILITY) then
call SelectUnitForPlayerSingle(dat.owner, GetOwningPlayer(dat.owner))
elseif (GetSpellAbilityId() == OPEN_ABILITY) then
set dat = LoadInteger(h,GetHandleId(u),1)
call SelectUnitForPlayerSingle(dat.u, GetOwningPlayer(dat.u))
elseif GetUnitTypeId(u) == INVENTORY_DUMMY then
call UnitRemoveAbility(dat.u, dat.icon[itemclass[i]])
call UnitRemoveAbility(dat.owner, dat.effekt1[itemclass[i]])
call UnitRemoveAbility(dat.owner, dat.effekt2[itemclass[i]])
call UnitRemoveAbility(dat.owner, dat.effekt3[itemclass[i]])
call UnitAddItemById(dat.owner, dat.Item[itemclass[i]])
call UnitAddAbility(dat.u,normalpic[itemclass[i]])
set dat.icon[itemclass[i]] = normalpic[itemclass[i]]
set dat.effekt1[itemclass[i]] = 0
set dat.effekt2[itemclass[i]] = 0
set dat.effekt3[itemclass[i]] = 0
set dat.Item[itemclass[i]] = 0
if twohand[i] == true then
call UnitAddAbility(dat.u,normalpic[OFFHAND_CLASS])
set dat.icon[OFFHAND_CLASS] = normalpic[OFFHAND_CLASS]
call UnitRemoveAbility(dat.u,TWOHAND_ABILITY)
endif
if itemclass[i] == MAINHAND_CLASS and dat.Item[OFFHAND_CLASS] == 0 then
call AddUnitAnimationProperties(dat.owner, dat.animtag, false)
set dat.animtag = ""
elseif itemclass[i] == OFFHAND_CLASS then
call AddUnitAnimationProperties(dat.owner, dat.animtag, false)
call AddUnitAnimationProperties(dat.owner, tag[LoadInteger(h,dat.Item[MAINHAND_CLASS],1)], true)
set dat.animtag = tag[LoadInteger(h,dat.Item[MAINHAND_CLASS],1)]
endif
endif
set u = null
endfunction
function TransferEquipment takes unit a, unit b returns nothing
local integer i = 1
local Inventory dat = LoadInteger(h,GetHandleId(a),1)
loop
exitwhen i > ITEMCLASSES
call UnitRemoveAbility(a,itemeffekt1[LoadInteger(h,dat.Item[i],1)])
call UnitAddAbility(b,itemeffekt1[LoadInteger(h,dat.Item[i],1)])
call UnitRemoveAbility(a,itemeffekt2[LoadInteger(h,dat.Item[i],1)])
call UnitAddAbility(b,itemeffekt2[LoadInteger(h,dat.Item[i],1)])
call UnitRemoveAbility(a,itemeffekt3[LoadInteger(h,dat.Item[i],1)])
call UnitAddAbility(b,itemeffekt3[LoadInteger(h,dat.Item[i],1)])
set i = i + 1
endloop
call SaveInteger(h,GetHandleId(b),1,dat)
set dat.owner = b
call UnitAddAbility(b,OPEN_ABILITY)
call UnitRemoveAbility(a,OPEN_ABILITY)
call AddUnitAnimationProperties(a, dat.animtag, false)
call AddUnitAnimationProperties(b, dat.animtag, true)
endfunction
function IsEquipmentClassEmpty takes unit u, integer class returns boolean
local Inventory dat = LoadInteger(h,GetHandleId(u),1)
return dat.icon[class] == normalpic[class]
endfunction
function GetEquipItemID takes unit u, integer class returns integer
local Inventory dat = LoadInteger(h,GetHandleId(u),1)
return dat.Item[class]
endfunction
function GetItemIndex takes item ite returns integer
return LoadInteger(h,GetItemTypeId(ite),1)
endfunction
function EnableItemEquipByID takes unit u, integer id, boolean flag returns nothing
local Inventory dat = LoadInteger(h,GetHandleId(u),1)
set dat.enabled[LoadInteger(h,id,1)] = flag
endfunction
function EnableItemEquipByIndex takes unit u, integer index, boolean flag returns nothing
local Inventory dat = LoadInteger(h,GetHandleId(u),1)
set dat.enabled[index] = flag
endfunction
function GetEquipItemIndex takes unit u, integer class returns integer
local Inventory dat = LoadInteger(h,GetHandleId(u),1)
return LoadInteger(h,dat.Item[class],1)
endfunction
function EquipItemByID takes unit u, integer id returns nothing
call Equip(u,CreateItem(id,0,0))
endfunction
function EquipItemByIndex takes unit u, integer index returns nothing
call Equip(u,CreateItem(itemm[index],0,0))
endfunction
private function Itemequip takes nothing returns nothing
local unit u = GetTriggerUnit()
local item ite = GetManipulatedItem()
local Inventory dat = LoadInteger(h,GetHandleId(u),1)
if dat.enabled[LoadInteger(h,GetItemTypeId(ite),1)] then
call Equip(u,ite)
else
call DisplayTextToPlayer(GetOwningPlayer(u), 0, 0, GetUnitName(u) + UNABLE_TO_EQUIP + GetItemName(ite))
endif
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerAddAction(t, function Itemequip)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddCondition(t, Condition(function check))
set t = CreateTrigger()
call TriggerAddAction(t, function access)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
call InitNormals()
endfunction
endlibrary
Re: [DUVIDA] Como Botar Restrição de Iten ?
Beleza, vo dar uma olhada, -EDIT-
eu dei uma olhada, eu ja tenho um sistema parecido com esse ai.
o que eu quero eh que uma raça nao use um determinado iten.
tipo, uma achar possa usar um arco, mais nao uma espada.
compreendes ?
se souber da uma ajudinha ai
----------------------------------------------------------------------------
otra pergunta. Alguem ai quer me ajudar num RPG?
Fazer o terrain.
editar herois, skills, itens.
se alguem quiser da um toq aew
eu dei uma olhada, eu ja tenho um sistema parecido com esse ai.
o que eu quero eh que uma raça nao use um determinado iten.
tipo, uma achar possa usar um arco, mais nao uma espada.
compreendes ?
se souber da uma ajudinha ai
----------------------------------------------------------------------------
otra pergunta. Alguem ai quer me ajudar num RPG?
Fazer o terrain.
editar herois, skills, itens.
se alguem quiser da um toq aew
Última edição por ThePlooper em 2010-02-07, 21:00, editado 1 vez(es)
ThePlooper- Número de Posts : 81
Data de inscrição : 06/02/2010
Reputação : 5 Pontos : 26084
Re: [DUVIDA] Como Botar Restrição de Iten ?
beleza , da uma olhada ali no otro post a duvida certinha
ThePlooper- Número de Posts : 81
Data de inscrição : 06/02/2010
Reputação : 5 Pontos : 26084
Re: [DUVIDA] Como Botar Restrição de Iten ?
Você conhece aquele mapa chamado ''Extreme Candy War'' que tem no Scenario de warcraft?
Ele tem o sistema de item que você quer..
Caso você nunca tenha jogado o mapa ou não tenha no seu pc o link ta aqui: http://www.hiveworkshop.com/forums/maps-564/extreme-candy-war-2005-8-a-146474/?prev=search%3Dcandy%26d%3Dlist%26r%3D20
Eu não faço um trigger pra você por que tou sem tempo, ai eu lembrei desse mapa que tem esse sistema então copia dele ^^
O mapa é desprotegido para edições xD
Ele tem o sistema de item que você quer..
Caso você nunca tenha jogado o mapa ou não tenha no seu pc o link ta aqui: http://www.hiveworkshop.com/forums/maps-564/extreme-candy-war-2005-8-a-146474/?prev=search%3Dcandy%26d%3Dlist%26r%3D20
Eu não faço um trigger pra você por que tou sem tempo, ai eu lembrei desse mapa que tem esse sistema então copia dele ^^
O mapa é desprotegido para edições xD
Re: [DUVIDA] Como Botar Restrição de Iten ?
ta beleza, vo dar uma olhada se consigo fazer
------------------------------
o do hive ta bloquiado
vo ver do warcraft
------------------------------
o do hive ta bloquiado
vo ver do warcraft
ThePlooper- Número de Posts : 81
Data de inscrição : 06/02/2010
Reputação : 5 Pontos : 26084
Re: [DUVIDA] Como Botar Restrição de Iten ?
cara eu olhei aqui os codigos e tudo, mais nao consegui entender como o cara seto os herois.
se puder me dar uma ajudinha
se puder me dar uma ajudinha
ThePlooper- Número de Posts : 81
Data de inscrição : 06/02/2010
Reputação : 5 Pontos : 26084
Re: [DUVIDA] Como Botar Restrição de Iten ?
Eu fiz uma Gambiarra aqui e funciono ^^
ao longo do tempo vo arrumando mais isso:)
qualquer duvida posto aqui valeus
ao longo do tempo vo arrumando mais isso:)
qualquer duvida posto aqui valeus
ThePlooper- Número de Posts : 81
Data de inscrição : 06/02/2010
Reputação : 5 Pontos : 26084
Re: [DUVIDA] Como Botar Restrição de Iten ?
Aproveitando pra nao Flodar Topicos.
Tipo to com uma SUper Duvida;
Tipo eu boto pra começa ja os creeps no jogo . e pra dropar um iten random desse creep.
mais quando ele morre e renasce nao dropa mais itens. comofas pra dropar o mesmo random?
Tipo to com uma SUper Duvida;
Tipo eu boto pra começa ja os creeps no jogo . e pra dropar um iten random desse creep.
mais quando ele morre e renasce nao dropa mais itens. comofas pra dropar o mesmo random?
ThePlooper- Número de Posts : 81
Data de inscrição : 06/02/2010
Reputação : 5 Pontos : 26084
Re: [DUVIDA] Como Botar Restrição de Iten ?
Nao Tipo. vo dar um exemplo
Botei um Creep no Mapa, dai editei pra dropa uma Espada.
Ta ele Dropa a Espada.
Dai Entra em Ação a Trigger Que da Respaw.
e nao dropa mais a Espada. Nao Dropa Mais Nada.
Queria que Essa Otra Unidade Que Nasce Tb Drope essa Espada
Botei um Creep no Mapa, dai editei pra dropa uma Espada.
Ta ele Dropa a Espada.
Dai Entra em Ação a Trigger Que da Respaw.
e nao dropa mais a Espada. Nao Dropa Mais Nada.
Queria que Essa Otra Unidade Que Nasce Tb Drope essa Espada
ThePlooper- Número de Posts : 81
Data de inscrição : 06/02/2010
Reputação : 5 Pontos : 26084
Re: [DUVIDA] Como Botar Restrição de Iten ?
não eh uma otra.
aquela morre.
dai cria otra no lugar dela. mais do mesmo tipo.
a primeira dropa o iten.
mais a segunda não dropa
aquela morre.
dai cria otra no lugar dela. mais do mesmo tipo.
a primeira dropa o iten.
mais a segunda não dropa
ThePlooper- Número de Posts : 81
Data de inscrição : 06/02/2010
Reputação : 5 Pontos : 26084
Re: [DUVIDA] Como Botar Restrição de Iten ?
Vou ver se acho algum trigger desse no dota (sistema do roshan xD)
Re: [DUVIDA] Como Botar Restrição de Iten ?
ta beleza.
eu to tentando aqui mais ta foda ^^
eu to tentando aqui mais ta foda ^^
ThePlooper- Número de Posts : 81
Data de inscrição : 06/02/2010
Reputação : 5 Pontos : 26084
Tópicos semelhantes
» magia como iten
» Como não ter 2 iten's do mesmo tipo?
» Como fazer um iten inclicavel?
» [Duvida] Como criar um item que atire como uma shotgun?
» [Duvida]Skill como unir 2 em 1? e como fazer o Summon ressuscitar com time?
» Como não ter 2 iten's do mesmo tipo?
» Como fazer um iten inclicavel?
» [Duvida] Como criar um item que atire como uma shotgun?
» [Duvida]Skill como unir 2 em 1? e como fazer o Summon ressuscitar com time?
TeaM KingS :: Games: :: Warcraft: World Editor :: ::
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|