how do i use a (weapons)spreadsheet to do all the heavy lifting?

0 favourites
  • 7 posts
From the Asset Store
The Lift
$5 USD
Easy copy/paste lift function for 2D platformer type games
  • so the problem is, im trying to use a csv spreadsheet thats is a weapon database, with information like weapon name, attack dmg, element type, and fx that go with it.

    i need a way that on weapon selected, i can get the current equiped weapons´s other stats, like attack dmg and fx etc. and use it somewhere else with just one expression.

    below is where i cant get at.

    right now i can select the weapon name at x with a variable.

    and even change the fx with the same variable(although im using an object, so its easy), but how do i go about getting the weapons attack and other stats?

    for ex:

    weapon» on collision with enemy» subtract current weapon.array.at( something, something)...

    is this right ?

  • The other data is at a different Y. So using what you have now, array.at(weapon,0) is the weapon name. array.at(weapon,1) is the next column of data.

  • The other data is at a different Y. So using what you have now, array.at(weapon,0) is the weapon name. array.at(weapon,1) is the next column of data.

    thanks for the fast reply,

    i did try that with the fx, i put diferent animations into fx and also named them ID_"number"

    so as i changed the weapon variable number , the fx number also changed.

    so the expression was :

    -fx2 set animation to "ID_"&arr_weapons.At(weapon,1)

    but it didnt work :/

  • oh wait i figured it out why it wasnt working with the fx animation...because in the spredsheet the fx ID didnt match ? i think that was it

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It will work if the animation name is ID_100 I guess. You don't need to do trial and error with the array data, you can see it in debug view.

  • yeah its workin , but another question arises, how do i add or subtract from the array.

    i tried just subtracting from the column and but it gives a NaN error, wich i read has to do with adding or subtracting strings from numbers and i have to convert the string to int. i tried whats below but, its not working. where am i going wrong

    thanks for the help , im a total noob when it comes to coding.

  • update to anyone who might be having the same question

    it WAS working with the original expression subtract from:arr_weapons.At(weapon,1)

    however it was giving the NaN error because firstly on one csv spreadsheet i had no values in the cell\array, and on the second try...wait for it... i put O instead of 0 xD ( thats O"letter" instead of zero xD "facepalm"

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)