Blockland Forums > Modification Help
Projectile scale?
(1/3) > >>
takato14:
Trying to change the scale of my projectile.

--- 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;
};
%p.setScale( %scaleFactor @ " " @ %scaleFactor @ " " @ %scaleFactor);
missionCleanup.add(%p);
}
return %p;

--- End code ---
No matter what I set the value of %scalefactor to, the projectile is always the same size. What am I doing wrong?
Iban:
It should adjust it.

To test it, change this line:
%p.setScale( %scaleFactor @ " " @ %scaleFactor @ " " @ %scaleFactor);

to these two:

echo("Scale Factor:" SPC %scaleFactor);
%p.setScale(%scaleFactor SPC %scaleFactor SPC %scaleFactor);


takato14:

--- Quote from: Iban on March 21, 2011, 08:33:09 PM ---It should adjust it.

To test it, change this line:
%p.setScale( %scaleFactor @ " " @ %scaleFactor @ " " @ %scaleFactor);

to these two:

echo("Scale Factor:" SPC %scaleFactor);
%p.setScale(%scaleFactor SPC %scaleFactor SPC %scaleFactor);




--- End quote ---
I tried the SPC arrangement before, but it didnt work.

setScale should affect the projectile size, explosion size, trail emitter size, damage values, brick explosion values, etc, correct?
Iban:
Correct.

Change the projectile to the Pong projectile because it's very slow, has very long longevity, and has noticeable light/particles.
takato14:
Alright, I figured it out, the script actually isnt spawning a projectile.

The only reason it was firing because I had parent::onFire in the function by mistake.


--- Code: ---function SLCZImage::onFire(%this,%obj,%slot)
{
%projectile = SLCZProjectile;
%charge_time = getSimTime() - %obj.client.saved_time;
if(%charge_Time <= 1000.0)
{
%scaleFactor = 0.5;
}
if(%charge_Time <= 2000.0)
{
%scaleFactor = 0.75;
}
if(%charge_Time <= 3000.0)
{
%scaleFactor = 1.0;
}
if(%charge_Time <= 7000.0)
{
%scaleFactor = 2.0;
}

%client = %obj.client;
%pos = %obj.getHackPosition();

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;
};
echo("Scale Factor:" SPC %scaleFactor);
%p.setScale(%scaleFactor SPC %scaleFactor SPC %scaleFactor);
missionCleanup.add(%p);
}
return %p;
}

--- End code ---
This seems to have a problem with it as well, as nothing echoed when I fired the weapon, and when I removed parent::onFire no projectile was spawned at all.
Navigation
Message Index
Next page

Go to full version