- Joined
- Oct 24, 2012
- Messages
- 6,545
globals
private Table recipeTable
endglobals
struct RecipeList extends array
private static method onInit takes nothing returns nothing
local trigger t = CreateTrigger()
set recipeTable = TableArray[0x2000]
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM)
call TriggerAddCondition( t, function thistype.recipeCheck)
set t = null
endmethod
endstruct
call TriggerAddCondition( t, function thistype.recipeCheck)
set this.i1 = i1
set this.i2 = i2
set this.i3 = i3
set this.i4 = i4
set this.i5 = i5
set this.i6 = i6
private integer array item
to take up some space.static method create takes integer i1, integer i2, integer i3, integer i4, integer i5, integer i6, integer itmToBeMade returns thistype
struct RecipeList extends array
implement Alloc
private integer i1
private integer i2
private integer i3
private integer i4
private integer i5
private integer i6
Looks nice now
Did you not use JNGP? TriggerAddCondition takes boolexpr, not code.This will cause syntax error.
scope test initializer Init
private function testFunction takes nothing returns nothing
endfunction
private function Init takes nothing returns nothing
local code c = function testFunction
call TriggerAddCondition(CreateTrigger(), Filter(c))
endfunction
endscope
what happens if I want the recipe to take 2 items of same type? like 2x claws of attack +15 => claws of attack +35 ?
Would you add to this system the functionality of working with such events as Unit enters rect?
set recipeRect = Rect( 32, 32, 0, 0)
set recipeRect = gg_rct_urRegionNameHere
private static method setRect takes region r returns region
call RegionAddRect( r, gg_rct_urRectName)
return r
endmethod
private static method setRect takes region r returns region
call RegionAddRect( r, gg_rct_urRectName)
call RegionAddRect( r, gg_rct_urRectName1)
call RegionAddRect( r, gg_rct_urRectName2)
call RegionAddRect( r, gg_rct_urRectName3)
return r
endmethod
I believe with multiple rects, users should be able to set a specific rect for each recipe because the variety of rects now is useless without a "owner".
function CreateRecipe takes Table inputs, integer inputSize, Table outputs, integer outputSize returns Recipe
function CompileRecipe takes Table itemIds, integer tableSize returns Table // returns output table
I think you should make it irrelevant to rects.
Make the system only handle the recipes themselves.
The API would be something as simple as:
JASS:function CreateRecipe takes Table inputs, integer inputSize, Table outputs, integer outputSize returns Recipe function CompileRecipe takes Table itemIds, integer tableSize returns Table // returns output table
by looking at the code, I take that this does not support item charge requirements right?
like item1 should have 2 charges for the recipe to work etc...
moved