Setting of raw data

WolfieeifloW

WEHZ Helper
Reaction score
372
Like TriggerHappy said, could you clarify a little more?

If you mean setting them into variables; just do:
JASS:
private constant integer unit_id = '####'


EDIT: Thanks for pointing that out T.s.e.
 

T.s.e

Wish I was old and a little sentimental
Reaction score
133
Integers aren't in "-signs, but '-signs.

JASS:
private constant integer unit_id = 'RawC'


And no, you can't set a units rawcode with a native or BJ that I'm aware of. Clarifying your question would be nice though :D
 

Flare

Stops copies me!
Reaction score
662
You're trying to associate some generalised properties with an item/unit? If so, this thread may give you some ideas, particularly this part
Flare said:
You could use gamecache, and convert the rawcode to string using I2S and use that value as one key - you could declare a struct with all the required item properties e.g.
JASS:
library ItemData initializer Init

globals
  private gamecache itemDataCache
  private constant string ITEM_DATA_KEY = "ItemProperties"
endglobals

struct ItemData
  integer cost
  real weight //if you wanted items to have a mass, which would have an impact on the carrying units speed or something
  integer sellPrice
//etc
endstruct

function GetItemData takes integer itemId returns ItemData
  return ItemData (GetStoredInteger (itemDataCache, I2S (itemId), ITEM_DATA_KEY))
endfunction

function SetItemData takes integer itemId, integer cost, real weight, integer sellPrice returns nothing
  local string s = I2S (itemId)
  local ItemData a
  if GetStoredInteger (itemDataCache, s, ITEM_DATA_KEY) == 0 then
    set a = ItemData.create ()
    set a.cost = cost
    set a.weight = weight
    set a.sellPrice = sellPrice
    call StoreInteger (itemDataCache, s, ITEM_DATA_KEY, integer (a))
  endif
endfunction

private function Init takes nothing returns nothing
  call FlushGameCache(InitGameCache("Item.cache"))
  set itemDataCache=InitGameCache("Item.cache")
endfunction
endlibrary

Although, that does generalize item properties, so if a hero has an ability that allows him to buy items for less/sell them for more, you won't be able to incorporate it directly into this without affecting every other item of that type. If you want something which allows each individual item to have it's own unique properties, use Get/SetItemUserData as Viikuna suggested

If you're looking for something more specific (i.e. unique properties for each individual item/unit object), you're going to need something else (such as Cohadar's PUI unit indexing system)
 

Frozenhelfir

set Gwypaas = Guhveepaws
Reaction score
56
I think he wants to change the raw ID of the units, not set them to a variable. NewGen allows you to choose a raw ID upon creation of the unit/item/ability/buff/upgrade, but after that I don't think you can edit it. However you can copy/paste it, choose a new ID and delete the old one.
 

Deele

New Member
Reaction score
0
I want to change user/item data with a trigger. Like changing unit tinting colour, unit tooltips or base armor etc... I know, there is some way to get theese raw data with <AHhb,DataA1> but I still havent understood, how to use them :D
 

Deele

New Member
Reaction score
0
For example, tinting of unit CAN be changed, cause that is done in GEM TD, when game starts...
Maybe that is just a multiple units, each set to different tint and when timer comes, they are "replaced" and selected by trigger...
:(
 
Reaction score
341
For example, tinting of unit CAN be changed, cause that is done in GEM TD, when game starts...

What does that have to do with raw id....

Maybe that is just a multiple units, each set to different tint and when timer comes, they are "replaced" and selected by trigger...

you can change unit vertex coloring via triggers...now raw id's, i don't understand how those two connect in your brain.
 

saw792

Is known to say things. That is all.
Reaction score
280
Some object editor data can be set through the map script (such as movespeed, vertex colouring, etc), but most can't. That's just the way it is.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top