• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Vjass in Inventory Spell

Status
Not open for further replies.
Level 4
Joined
Apr 19, 2013
Messages
86
Hey everyone, I posted a question on Anachron's awesome inventory spell recently, but it occurred to me my problem might simply be due to my very basic understanding of vjass. The custom inventory spell he made is pretty popular I beleive so maybe someone out there will see what I mean...

I want the inventory to be constructed at the start location for each player. I have it so each players start location is at an empty part of the map where there is room for the construction of the inventory destructibles. Technically all I have to do is define the 'point' right? After that each player inventory will correspond to that players hero, right? I don't really have to edit anything futher, its already mui from what I can tell. I was looking in the CISetup trigger and tried the following:

rect CI_UI_RECT = GetPlayerStartLocation(Player(i))

It says error, undeclared variable. I guess I don't remember much about vjass.

Am I in the right place? And sorry if you already answered a question like this, but I double checked all your notes and almost every page on this forum.

Also I wanted to ask if it was possible to directly add stats to items that are mathematical expressions, not just values, i.e.
(This is from the "Test" trigger)


set ci.dmg = 2*GetHeroLevel(hero)

or maybe something like

set ci.dmg = native GetRandomReal takes real 20., real 50. returns real

Would the ability libraries ect. handle these expressions properly and add the right amount of damage as is? If not would there be an easy tweak somewhere to adjust things properly, or are these things too unpractical? So far I haven't figured this out yet either. I'm also not sure if its not working due to my possible misunderstanding of a vjass function or if its a limitation of the spell system itself. any help at all would be great.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
GetPlayerStartLocation returns an integer, you are trying to assign it to a rect variable.

You would nee to make the variable an array and change each line that uses the variable to use player number.

set index = 0
loop
set CI_UI_RECT[index] = Rect(GetPlayerStartLocationX(Player(index))-width/2, GetPlayerStartLocationY(Player(index))-width/2, GetPlayerStartLocationX(Player(index))+height/2, GetPlayerStartLocationY(Player(index))+height/2)
exitwhen i == 11
set index = index + 1
endloop

Setting the property with a function does work, but it will not dynamically change the value. If the hero gains more str after the value is set, you need to set the value again to use the new str.
 
Status
Not open for further replies.
Top