Cutstuff Forum

Mega Man 8-bit Deathmatch => Projects & Creative => Maps => Topic started by: Audiophile on February 28, 2011, 07:51:43 PM

Title: ACS scripting question - Random ThrustThing values
Post by: Audiophile on February 28, 2011, 07:51:43 PM
As this is my first post, I would like to extend my greetings to the forum community.

With that out of the way, I'm in the process of making my first map. I'm trying to make a sector that, when stepped on, will thrust the player in a random direction at a random speed.

I've been doing some research on scripting and put together a patchwork of code I was able to assemble with the limited knowledge on the subject I have.

It is as follows:
Code: [Select]
#include "zcommon.acs"

int angarr[8] = {0,32,64,96,128,160,192,224};
int achoice;
achoice = angarr[random(0,7)];

int thrarr[6] = {5,10,15,20,25,30}
int tchoice;
tchoice = thrarr[random(0,5)];

script 1 open {
        thrustthing(achoice,tchoice,0,0);
        delay(1)
        }

I know this is incorrect, as it will not compile. My question is; Would this be an error in syntax, or the wrong methodology, or a combination of the two?
Title: Re: ACS scripting question - Random ThrustThing values
Post by: Ivory on February 28, 2011, 07:55:34 PM
...There is no semi colon after the last delay...
Title: Re: ACS scripting question - Random ThrustThing values
Post by: Audiophile on February 28, 2011, 08:43:59 PM
Quote from: "Ivory"
...There is no semi colon after the last delay...
thanks for pointing that out, but that's not the case.

the error it's kicking out is "invalid declarator" and it's pointing to

achoice = angarr[random(0,7)];

perhaps i should have mentioned that in the previous post
Title: Re: ACS scripting question - Random ThrustThing values
Post by: Audiophile on February 28, 2011, 09:18:06 PM
Well, I have discovered why it wasn't working. I've overcomplicated things.

I was able to get the desired effect with the following code

Code: [Select]
#include "zcommon.acs"

script 1 open {
        thrustthing(random(0,359),random(5,30),0,0);
        delay(1);
        }

and it works perfectly.
Title: Re: ACS scripting question - Random ThrustThing values
Post by: CutmanMike on February 28, 2011, 10:20:30 PM
I saw this and assumed you only wanted it to thrust in the directions you specified in the array. In which case this might have worked:

Code: [Select]
#include "zcommon.acs"

int angarr[7] = {0,32,64,96,128,160,192,224}; // I can't remember if this is the right syntax for putting values directly into arrays however

int thrarr[6] = {5,10,15,20,25,30};

script 1 open {
        thrustthing(angarr[random(0,7)],thrarr[random(0,5)],0,0);
        delay(1)
        }
Title: Re: ACS scripting question - Random ThrustThing values
Post by: Audiophile on February 28, 2011, 11:07:55 PM
thanks boss, I'll remember that if need to use it for future maps  :mrgreen: