Author Topic: Infinite items  (Read 696 times)

What's the difference between these two scripts that apparently both work just fine in making an item with infinite usage. As in the item not being removed from your inventory after use.

Code: [Select]
function Snowball_Image::onCharge(%this, %obj, %slot)
{
%obj.playthread(2, spearReady);
}

function Snowball_Image::onAbortCharge(%this, %obj, %slot)
{
%obj.playthread(2, root);
}

function Snowball_Image::onFire(%this, %obj, %slot)
{
%obj.playthread(2, spearThrow);
Parent::onFire(%this, %obj, %slot);
}

Code: [Select]
function whiteCardImage::onPreFire(%this, %obj, %slot)
{
%obj.playthread(2, armattack);
}

function whiteCardImage::onStopFire(%this, %obj, %slot)
{
%obj.playthread(2, root);
}

Neither of them do anything that would remove it from your inventory, duh.

Oh. What do they do then? What makes the items infinite then? =O

The fact that they aren't removed from the inventory after use.

Oh clever. What does that piece o code do then?

Snowball:
When onCharge is called, raise the player's hand up.
When onAbortCharge is called, go back to normal.
When onFire is called, play a throwing animation and call the default (WeaponImage or ShapeBaseImageData) firing function.
This, with the state values on the shapebaseimagedata datablock, makes it attack like the spear.

WhiteCard:
When onPreFire is called, start swinging the arm.
When onStopFire is called, stop swinging the arm.
This, with the state values on the shapebaseimagedata datablock, makes it attack like the sword.

Love you. That's all I needed to know.

You seem to be very curious lately Demian. ;)

I'm not a scripter so I need help.

I'm not a scripter so I need help.
I guessed so and of course everyone is welcome to ask a question here. ;P

What's the difference between these two scripts that apparently both work just fine in making an item with infinite usage. As in the item not being removed from your inventory after use.

Code: [Select]
function Snowball_Image::onCharge(%this, %obj, %slot)
{
%obj.playthread(2, spearReady); «- This plays the animation of spearready
}

function Snowball_Image::onAbortCharge(%this, %obj, %slot)
{
%obj.playthread(2, root); «- This plays the animation of some root thingy
}

function Snowball_Image::onFire(%this, %obj, %slot)
{
%obj.playthread(2, spearThrow); «- This plays the animation of throwing a spear
Parent::onFire(%this, %obj, %slot);
}

Code: [Select]
function whiteCardImage::onPreFire(%this, %obj, %slot)
{
%obj.playthread(2, armattack); «- This plays the animation of armattack
}

function whiteCardImage::onStopFire(%this, %obj, %slot)
{
%obj.playthread(2, root); «- This plays the animation of another root thingy
}
As you see all what this code does is play some animations but nothing else.

As you see all what this code does is play some animations but nothing else.
I'm sure a detailed explanation of this answer has already been posted.

Yeah I know, when I reread this thread after I posted, I realised that you can't delete your post.