Hi All
Still getting my head around arrays.
I have an array made up of 9 numbers done 49 times.
If I want to call Array 25 and the third number, how do I do this.
Is it done with a loop within a loop or am I barking up the wrong tree.
Hi All
Still getting my head around arrays.
I have an array made up of 9 numbers done 49 times.
If I want to call Array 25 and the third number, how do I do this.
Is it done with a loop within a loop or am I barking up the wrong tree.
Not sure what you mean, do you mean you are looping through that array 49 times, and on the 25th loop you want to get the 3rd element in the array?
Hi
They are 9 different stats for 50 different people. Let me say the the first number = health. I want to get the health for BOT 25.
Cheers for reply
Are your bots in an array? And they each have a stat array as a variable?
If you have an array of bots, just use get, and get the bot at the 24th index, then drag off from that and get the stat array and use a get node to get whatever index your health stat is at. You may have to cast depending on where you are doing this
**
**
Yes: 0 = Health, 1 = Armour. 2 = Damage, etc.
**
**
Everything being done in one BP as I have no pawns.
This is where I get lost. :S
Create a Struct. Put your array in it. Create an Array out of that Struct. Each member in the struct array will be one of your bots, with it’s own array of variables.
You only have 9 gladiator stats, so that isn’t going to do anything.
The gladiators would need to be structs - if they aren’t actors. Gladiator struct, with a gladiator stats array as a variable. Make an array of gladiator structs, and add 50 gladiators. Get gladiator struct 25, then break that struct, then get it’s stat value at index 3 or whatever.
Presuming that you had previosly randomly set their value.
I did that at first, but when ever I did that, but could never pull the reference data.
I could view them separately with in game details panel, but getting BOT 5 / Health.
No Luck
For some reason, I can not seem to make those Node Join.
As per previous message, I have shown my STRUT.
I previously made an array out of this.
How did you go from Make Array to Make Strut?
Never heard of an array elem. Would that work.
For example I want BOT 1 to fight BOT 10.
I could get all there relevant data and then through other nodes work out a fight?
It should work, you could do it like that too, you don’t need the array it if you do it like this:
The struct:
edit: the reason it won’t work for you is your floats are not in an array in the struct. If you wanted to do that, just add one float variable and then click the icon to make it array. But if you do it that way, you won’t get the name for each variable, and you would need to keep track of what index is what
If you have the same data type yes , but if not , like example, a struct is the only solution
Ok
So along these line.
This looks like it would works, 2 days an no one could answer this.
Cheers
MO, you saved my hair line again.
One last question,
I am randomly filling the data at the moment.
What would be the best way to set all individual data separately?
And, if I need to replace BOT 15, how would I replace that data?
There might be an easier way, but you could do it like this, for each index:
It can be rewritten with the same node, just enter the index you want to change
Thanks , **** Solved ****
I think this is enough for me to start testing the Battle Arena.
I never thought a widget game would be so complex, there are going to be nodes everywhere.
Cheers AGAIN
Appreciate everyone’s help.
Cool, no problem