| 08-10-2004, 02:29 AM | #1 |
Hi, I figured it would give players a little something extra to toy around with in my current map if they were able to "forge" new items by placing certain combos of items into a building called "Abandoned Forge". Problem is, is that I can't get it to work right and I was wondering if there was something I'm missing; anyway, heres the trigger as it currently is. Code:
Basic Forge items
Events
Unit - Abandoned Smithy 0501 <gen> Acquires an item
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
Or - Any (Conditions) are true
Conditions
(Item carried by Abandoned Smithy 0501 <gen> of type Forging Mallet) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 1)
(Item carried by Abandoned Smithy 0501 <gen> of type Forging Mallet) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 2)
(Item carried by Abandoned Smithy 0501 <gen> of type Forging Mallet) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 3)
(Item carried by Abandoned Smithy 0501 <gen> of type Forging Mallet) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 1)
(Item carried by Abandoned Smithy 0501 <gen> of type Forging Mallet) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 1)
(Item carried by Abandoned Smithy 0501 <gen> of type Forging Mallet) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 1)
Or - Any (Conditions) are true
Conditions
(Item carried by Abandoned Smithy 0501 <gen> of type Arachnid Fang) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 1)
(Item carried by Abandoned Smithy 0501 <gen> of type Arachnid Fang) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 2)
(Item carried by Abandoned Smithy 0501 <gen> of type Arachnid Fang) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 3)
(Item carried by Abandoned Smithy 0501 <gen> of type Arachnid Fang) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 4)
(Item carried by Abandoned Smithy 0501 <gen> of type Arachnid Fang) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 5)
(Item carried by Abandoned Smithy 0501 <gen> of type Arachnid Fang) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 6)
Or - Any (Conditions) are true
Conditions
(Item carried by Abandoned Smithy 0501 <gen> of type Ettin Skull) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 1)
(Item carried by Abandoned Smithy 0501 <gen> of type Ettin Skull) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 2)
(Item carried by Abandoned Smithy 0501 <gen> of type Ettin Skull) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 3)
(Item carried by Abandoned Smithy 0501 <gen> of type Ettin Skull) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 4)
(Item carried by Abandoned Smithy 0501 <gen> of type Ettin Skull) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 5)
(Item carried by Abandoned Smithy 0501 <gen> of type Ettin Skull) Equal to (Item carried by Abandoned Smithy 0501 <gen> in slot 6)
Then - Actions
Item - Remove (Item carried by Abandoned Smithy 0501 <gen> of type Forging Mallet)
Item - Remove (Item carried by Abandoned Smithy 0501 <gen> of type Arachnid Fang)
Item - Remove (Item carried by Abandoned Smithy 0501 <gen> of type Ettin Skull)
Hero - Create Essence of Life and give it to Hero[(Player number of (Owner of Abandoned Smithy 0501 <gen>))]
Else - ActionsYeah, I know thats probably a lot longer than it needs to be... but its all I could come up with. problem is, is that when you place any one of the three items needed into it it gives you the Essence of Life anyway... |
| 08-10-2004, 02:39 AM | #2 |
Uhm dont use condition unit have item in slot use item type carry by unit like this: Event:A unit accquire an item Condition: And all condition equal to true +unit type of triggering unit equal to [unit type] +Item type of item carry by triggering unit of type [item1] equal to item type of [item1] +Item type of item carry by triggering unit of type [item2] equal to item type of [item2] Action: +Remove [item1] carry by triggering unit +Remove [item2] carry by triggering unit +Create special effect attach to origin of triggering unit +Create [item3] and give it to triggering unit -I used to use those trigger in my corridor map so if u have any problem about this then i can give u a sample map ^_^ |
| 08-10-2004, 02:49 AM | #3 |
Well there's alot of stuff there, and some of it is cut off so I don't quite understand it too well but, by looking at it, it says If Any Conditions Are True, meaning it could be any item that you listed for triggers. It should be; Event: Smithy Acquires Item Condition: Hero has item of type (works for unit's also) Item being manipulated equal to (your item) Action: Remove item being manipulated Set Variable(Item Variable) equal to Item in Smithy slot 1 Remove Item variable Create 1 *Forged Item* at position of Smithy make sure the Smithy thingy only has as many item slots as the # of items that can be forged. Hope I helped :\ |
| 08-10-2004, 04:48 AM | #4 |
Alrighty, thanks to both of you; I'll try out what the idea you listed thedevil and post back on here if whether or not it works. [Oh Arksword, the whole trigger is there and not cut off, theres a scrollbar so you can read the rest of it that you thought had been cutoff] |
| 08-11-2004, 04:54 AM | #5 |
Alright, thanks man, I got it working. |
| 08-12-2004, 11:07 PM | #6 |
One more thing man, you gatta make sure that there is some way for a player make the smithy drop the items in his inventory, because if he is given the wrong items then he wouldn't be able to continue forging items, that is im assuming that the smithy belones to player passive and you cant control him. |
| 08-13-2004, 07:50 AM | #7 |
Alrighty took care of that, the player gains control of the forge when he comes within a certain range of it and control is given back to Passive when he leaves (its setup so other players cant take it over while a player has control too). |
| 08-13-2004, 08:58 AM | #8 |
I've made a Jass script for forging items. It's really easy to use and automaticly detects if the forge has the correct amount of items (3, not 4 potions etc.). Has the correct items and then creates the result. Works like this Custom Script : Call Forge([Itemcode 1], [Itemcode 2], [Itemcode 3], [Itemcode 4], [Itemcode 5], [Itemcode 6], [Result Itemcode], [Forging Unit]) You get the itemcode by pressing ctrl+d in the object editor. The 4 characters are the code of the item (example: I00A). If you only want two/three/four/five items in the combination type "null". The [Forging Unit] should be the triggering unit for example. In Jass triggering unit is called "GetTriggerUnit()". And Casting unit is called "GetSpellAbilityUnit()" Example: Custom Script : call Forge('I001', 'pclr', 'I00T', null, null, null, 'I003', GetSpellAbilityUnit()) I made this awhile ago, so it ain't perfect, but it works. Paste the following in the custom script area of your map. Code:
function SlotIsEmpty takes unit u returns integer
local integer i=1
local integer n=0
loop
exitwhen i>6
if ( GetItemTypeId(UnitItemInSlotBJ(u, i)) == GetItemTypeId(null) ) then
set n=n+1
else
endif
set i=i+1
endloop
return n
endfunction
function SlotIsFull takes unit u returns integer
local integer i=1
local integer n=0
loop
exitwhen i>6
if ( GetItemTypeId(UnitItemInSlotBJ(u, i)) == GetItemTypeId(null) ) then
else
set n=n+1
endif
set i=i+1
endloop
return n
endfunction
function CheckSlot takes integer it, unit u returns integer
local integer i=1
local integer n=0
loop
exitwhen i>6
if ( GetItemTypeId(UnitItemInSlotBJ(u, i)) == it ) then
set n=n+1
else
endif
set i=i+1
endloop
return n
endfunction
function ClearSlots takes unit u returns nothing
local integer i=1
loop
exitwhen i>6
call RemoveItem( UnitItemInSlotBJ(u, i) )
set i=i+1
endloop
endfunction
function NoS takes integer i1, integer i2, integer i3, integer i4, integer i5, integer i6 returns integer
local integer i=1
local integer n=0
local integer array in
set in[1] = i1
set in[2] = i2
set in[3] = i3
set in[4] = i4
set in[5] = i5
set in[6] = i6
loop
exitwhen i>6
if ( in[i] == null ) then
else
set n=n+1
endif
set i=i+1
endloop
return n
endfunction
function CheckRec takes integer i1, integer i2, integer i3, integer i4, integer i5, integer i6, unit u returns integer
local integer array in
local integer g=0
local integer i=1
local integer n=NoS(i1, i2, i3, i4, i5, i6)
local integer e=6-n
local integer j=SlotIsEmpty(u)
set in[1] = i1
set in[2] = i2
set in[3] = i3
set in[4] = i4
set in[5] = i5
set in[6] = i6
if (e == j) then
else
return 0
endif
set g = 0
loop
exitwhen (g == n or i>n)
set g = g + CheckSlot(in[i], u)
set i=i+1
endloop
if g==n then
return 1
else
return 0
endif
endfunction
function Forge takes integer i1, integer i2, integer i3, integer i4, integer i5, integer i6, integer r, unit u returns nothing
if CheckRec(i1, i2, i3, i4, i5, i6, u) == 0 then
return
else
endif
call ClearSlots(u)
call UnitAddItemByIdSwapped( r, u)
endfunction |
| 08-13-2004, 05:23 PM | #9 |
Well it looks useful, but since I don't know much about Jass coding and I already got the trigger working the way I need it to I think I'll just stick to what I've got already, thanks anyway though. ![]() |
| 08-18-2004, 04:05 PM | #10 |
Oh well, it's alot easier to use if you're using a bunch of items. If you're only going to have the ability to forge a small number it's easier with normal triggers. But otherwise this saves alot of space and work. |
| 08-18-2004, 04:34 PM | #11 |
I've used AIAndy's function for an easy check for the right amount of items of the correct type. http://kattana.users.whitehat.dk/viewfunc.php?id=154 |
