Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How to count remaining weapon bullets?

Masai Taringa
Registered User
Join date: 23 Oct 2006
Posts: 12
02-24-2007 17:56
Hi,
I would program a sort of weapon with 6 bullets inside. Every time you use a bullet, I would remember my remainig bullets in the weapon. So, I need to save the number of bullets I still have.

How is it possible to save variables inside an objects??

Masai
Shippou Oud
The Fox Within
Join date: 11 Jul 2005
Posts: 141
02-24-2007 22:00
by declaring them, the script "remembers" them. Here is a script to show you.
CODE

integer touches;
default
{
state_entry()
{
touches = 6;
}
touch_start(integer x)
{
touches = touches - 1;
if (touches < 1)
{
llSay(0,"Out of Amo");
}
}
}


This tells the script there are 6 when you start, and takes 1 away every time it is clicked.
Once the number is less than 1, the script tells you also.
Masai Taringa
Registered User
Join date: 23 Oct 2006
Posts: 12
02-25-2007 03:37
Thank you Shippou,
I didn't know that about variables

Masai
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-25-2007 04:16
From: Masai Taringa
Thank you Shippou,
I didn't know that about variables

Masai



Masai, I suggest that you have a read through thesticky at the top of the forum posts.