Arrays

Reaction score
456
Nothing? The function is quite useless in it's current state, though :p..
 

Romek

Super Moderator
Reaction score
963
Locals can only be used in the function they where declared in.
Use globals for that.

Also, when setting an array, you need to specify the index.
For example:
Set Items[7] = 'Xmas'
 
B

bramming

Guest
Its because locals are only used within the function. Since "Items" is a local in setup01, it wont work in function "actions". You can just put the actions inside the "setup01" as long as all variables are at the top of the function. Or else you can use globals. If you download newgen you can do:

JASS:
globals
item array Itemz
unit array caster
location array CPoint
unit array Dummy
item array dummyitem
endglobals

function actions takes nothing returns nothing
    set Items[x] = *random item*
endfunction

as a quick summary of locals and globals:
locals can only be used inside the function
globals can be used anywhere (but they are slower, so locals are prefered when possible)
if you dont use newgen and you want globals, you can go to the variable editor in World Editor and add the variables there, then set them in your trigger.
 

Romek

Super Moderator
Reaction score
963
...Nothing. What error are you getting?
 

Trollvottel

never aging title
Reaction score
262

Romek

Super Moderator
Reaction score
963
With item arrays, you'd need to store the actual created item. (CreateItem( .. ))
'I000' is a raw code. Raw codes are integers.
 

Frozenhelfir

set Gwypaas = Guhveepaws
Reaction score
56
Nope, an item array stores a physical item in game which a hero can pick up. You must use an integer array to store an item type as all raw codes are integers. This means ability ID's, unit ID's, item ID's, and upgrade ID's must be stored in an integer array.

I think CreateItem() if that's what you want to do, takes an integer anyway so passing an item in would just give a syntax error.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top