Blockland Forums > Modification Help

Projectile scale?

Pages: << < (2/3) > >>

takato14:

Wait, crap. Forgot to specify %shellcount. Fixed it.

New problem: the projectile is always the same scale no matter how long I hold the button.

Iban:

Yeah that would be a problem.

%shellCount is undefined, meaning it will produce 0 projectiles.

You didn't copy the code over correctly.

Edit: What is the console echo'ing for ScaleFactor

takato14:


--- Quote from: Iban on March 21, 2011, 08:51:46 PM ---Edit: What is the console echo'ing for ScaleFactor

--- End quote ---
2.
Edit: I have this function before the onFire one. (The weapon image is based off of the Spear's image)

--- Code: ---function SLCZImage::onCharge(%this, %obj, %slot)
{
%obj.client.saved_time = getSimTime();
}

--- End code ---


Iban:

Just replace the entire loop with this.

It should make the projectile a random size every time you fire.

I also put the size rescaling post-group add, but that shouldn't really change anything.


--- Code: --- for(%shell=0; %shell<%shellcount; %shell++)
{
%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = vectorScale(%obj.getMuzzleVector(%slot), 200);
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
missionCleanup.add(%p);

%scaleFactor = getRandom(0, 200) / 100;
%p.setScale(%scaleFactor SPC %scaleFactor SPC %scaleFactor);
}
--- End code ---

If this doesn't work I don't know.

takato14:


--- Quote from: Iban on March 21, 2011, 08:56:13 PM ---Just replace the entire loop with this.

It should make the projectile a random size every time you fire.

I also put the size rescaling post-group add, but that shouldn't really change anything.


--- Code: --- for(%shell=0; %shell<%shellcount; %shell++)
{
%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = vectorScale(%obj.getMuzzleVector(%slot), 200);
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
missionCleanup.add(%p);

%scaleFactor = getRandom(0, 200) / 100;
%p.setScale(%scaleFactor SPC %scaleFactor SPC %scaleFactor);
}
--- End code ---

If this doesn't work I don't know.

--- End quote ---
That's not what I wanted it to do, what I want is the longer you hold the mouse button before firing, the larger/more powerful the blast is. This is in an attempt to avoid several wasteful datablocks.

Probably should've specified that earlier.

Pages: << < (2/3) > >>

Go to full version