Hi, I'm making a map and have some problems, I hope you can help here.
I'm showing some working C code, the paths I've been taking with Galaxy Editor haven't worked so far. So won't show that unless requested.
This code will return 4, 5. because both 4 and 5 have the lowest number.
I need to convert this code to Galaxy Editor. I've tried numerous times but I fail. also the #sc2mapster people haven't been able to solve it.
Also, I need to random the result and only give me a random lowest number. and return the random number as an integer for example.
#include <stdio.h>
int main(void)
{
int LowestInteger = 100;
int PlayerArray[8] = {5,6,3,4,2,2,7,8};
int PlayerArrayCompared[8] = {0};
int PlayerArrayComparedSize = 0;
int j = 0;
int i = 0;
Ok, I got it. The only thing that bothers me is that I'm apparently not allowed to send an array as a parameter to my function.
I'm using a temporary array to store the indexes of where the lowest numbers are found and a counter to keep track of the size. Each time a new lowest is found, I reset the temp-array and size.
Apart from anything that has to be changed to fit in your map and perhaps optimize my ugly code a bit, this seems to be working. What was the problem you had doing this? I found it quite easy and I'm only a hobby programmer... well, maybe not even that.
Edit: Managed to upload an unsaved, old, version of the test map, should be fixed now.
Hi, I'm making a map and have some problems, I hope you can help here.
I'm showing some working C code, the paths I've been taking with Galaxy Editor haven't worked so far. So won't show that unless requested.
This code will return 4, 5. because both 4 and 5 have the lowest number.
I need to convert this code to Galaxy Editor. I've tried numerous times but I fail. also the #sc2mapster people haven't been able to solve it.
Also, I need to random the result and only give me a random lowest number. and return the random number as an integer for example.
#include <stdio.h>
int main(void)
{
int LowestInteger = 100;
int PlayerArray[8] = {5,6,3,4,2,2,7,8};
int PlayerArrayCompared[8] = {0};
int PlayerArrayComparedSize = 0;
int j = 0;
int i = 0;
while(i < 8) {
if(PlayerArray[i] < LowestInteger) {
LowestInteger = PlayerArray[i];
}
i += 1;
}
while(j < 8) {
if(PlayerArray[j] == LowestInteger) {
PlayerArrayCompared[PlayerArrayComparedSize] = j;
PlayerArrayComparedSize++;
}
j += 1;
}
for(i = 0; i < PlayerArrayComparedSize; ++i) printf("%d\n", PlayerArrayCompared[i]);
return 0;
}
Ok, I got it. The only thing that bothers me is that I'm apparently not allowed to send an array as a parameter to my function.
I'm using a temporary array to store the indexes of where the lowest numbers are found and a counter to keep track of the size. Each time a new lowest is found, I reset the temp-array and size.
Apart from anything that has to be changed to fit in your map and perhaps optimize my ugly code a bit, this seems to be working. What was the problem you had doing this? I found it quite easy and I'm only a hobby programmer... well, maybe not even that.
Edit: Managed to upload an unsaved, old, version of the test map, should be fixed now.
@Berrala:
Someone from #sc2mapster solved it an hour ago :). thanks alot for the help.
And I can't seem to get anything working in this editor. :).
Probably helps that I'm not a programmer, I just use logic and look for possible solutions from what's available. :-)