Author Topic: Would it be possible to script...  (Read 1945 times)

Would it be possible to script a weapon for when the toolAmmo reaches a certain level that you could make it set the weaponImage shapeFile to another model?

like this:

Code: [Select]
function weaponImage::onModelChangeCheck(%this,%obj,%slot)
{
   if(%obj.toolAmmo[%obj.currTool] <= 15)
   %obj.setShapeFile = "./secondWeaponModel.dts";
}
?

You can't change the shape file, but you can mount another weapon with a different shape file.

would it change the amount of ammo in the weapon? or would you have to set the ammo for each?

You could do it like the hands on model approach.

Have the model and when you reach the certain amount of ammo you want (negative/ positive) make the model invisible and make the other appear.  It's really hard to explain, but it's like the model item that you pick up is different than the one you are holding.  The L4D2 wepset is a good example.

You could do it like the hands on model approach.

Have the model and when you reach the certain amount of ammo you want (negative/ positive) make the model invisible and make the other appear.  It's really hard to explain, but it's like the model item that you pick up is different than the one you are holding.  The L4D2 wepset is a good example.
The weapon item datablock is different from the weapon image datablock. That's how that works.

Also, this can be done pretty easily with multiple images, like Chrono said.

i want to make the MA5C like the one here: http://www.youtube.com/watch?v=XC-OuJmkNMI

skip to about 6:45 to see it in action

Like having the little numbers on it?

no, having the color of the display change depending on the amount of ammo. the numbers would take forever to make, but would be awesome!

does this look right? i added it to the onReloaded function:

Code: [Select]
%obj.setweaponImage = "MA5C_ICWSImage";

No, do %obj.mountImage(MA5C_ICWSImage,0);


would this work overall for the reload functions?

-cut-
« Last Edit: August 15, 2011, 08:27:39 PM by Midway Sentinel »

redo of the script:

Code: [Select]
function MA5C_ICWSImage::onLoadCheck(%this,%obj,%slot)
{
if(%obj.toolAmmo[%obj.currTool] <= 0)
%obj.setImageAmmo(%slot,0);
else
%obj.setImageAmmo(%slot,1);

if(%obj.toolAmmo[%obj.currTool] > 16)
%obj.mountImage(MA5C_ICWSImage,0);
%obj.unMountImage(MA5C_ICWSmedImage,0);
%obj.unMountImage(MA5C_ICWSlowImage,1);


if(%obj.toolAmmo[%obj.currTool] <= 16)
%obj.mountImage(MA5C_ICWSmedImage,0);
%obj.unMountImage(MA5C_ICWSImage,0);

if(%obj.toolAmmo[%obj.currTool] <= 7)
%obj.mountImage(MA5C_ICWSlowImage,0);
%obj.unMountImage(MA5C_ICWSmedImage,1);

}

function MA5C_ICWSImage::onReloadStart(%this,%obj,%slot)
{
%obj.toolAmmo[%obj.currTool] = 0;
%obj.unMountImage(MA5C_ICWSImage,0);
%obj.unMountImage(MA5C_ICWSmedImage,1);
%obj.mountImage(MA5C_ICWSlowImage,0);
}

function MA5C_ICWSImage::onReloaded(%this,%obj,%slot)
{
%obj.toolAmmo[%obj.currTool] = 32;
%obj.setImageAmmo(%slot,1);
}
sorry for tri-post

hurray for syntax errors ^^^

lol, might you care to point them out?