Page 1 of 1

Variables 'ammo' 'clip' problem.

PostPosted: Wed May 09, 2007 12:29 pm
by scythe
I have a variable called 'W2000SniperClip' and a variable called 'ammo', atm the gun starts with 7 bullets, create actor, ammo =7, and after the 7 bullets are used, empty 'ammo = 0' you reload 'key down' and get 7 bullets again 'ammo=7'.

My problem is i also want to have 3 clips 'W2000SniperClip = 3' but I dont want the gun to reload and be able to shoot if 'W2000SniperClip = 0'

I tried this code for reload, it accepts the code, but its not working, the code used to be just 'ammo =7;', now it is this:

Code: Select all
W2000SniperClip - 1;

if (W2000SniperClip == 0)
{
(ammo = 0);
}

else if (W2000SniperClip >= 0)
{
(ammo = 7);
}


Any help GE wise ones? :)

Thanks,
scythe

PostPosted: Wed May 09, 2007 6:54 pm
by jazz_e_bob
This may do the trick:

Code: Select all
if ( W2000SniperClip > 0 ) // if there is a clip available
{
    W2000SniperClip -= 1; // load the clip
    ammo = 7;  // now I have 7 shots
}

PostPosted: Thu May 10, 2007 9:00 am
by scythe
Awesome, thanks, it did the trick! Looks like i should have tried a few more combinations :)

Hey your from Australia, i'm from Oz too, I wonder how many others on the forum are? were you ever in the Oz demo scene? I ran a c64 BBS in the early 80's, Amiga scene, I had an Atari & Intellivision +8kComputerKeyboardAddon before that :), as your invader pic makes it look like you may be oldschool.

Ive actually released a few games and done gfx for many, but am not much of a coder as u can see :) Last released commercial game I was involved in was UVW, ages ago, a SEU on Amiga,PC and Linux.

Thanks again,
scythe

PostPosted: Fri May 11, 2007 11:24 am
by jazz_e_bob
Nice to meet you mate. :)

I wasn't involved in the demo scene but I did have an Amiga. Loved deluxe paint and amos. Then I sold out and bought a PC - seduced by UFO - Enemy Unknown, Visual Basic and Doom... ;-)

If you have any other coding problems I'm happy to help out.

PostPosted: Sat May 12, 2007 5:34 pm
by scythe
Nice to meet you too mate :) I was in a few demo groups in Oz & OS a few years ago, last Amiga group i was in was Cydonia, as Amiga was dying :(.

Yeah I used Deluxe Paint V5.+ last, I think it was unofficial by then :), although I bought a few versions of it, the last being v4.5. thinking of buying pro motion now, for use with GE :)

hehe we all sold out in the end, great machine & OS, but it just died, I had An A1200 AGA with 030 at 40Mhz & 10MB? at the end, still got it somewhere, along with an A1000 still boxed!, the 1st 'True' 'Multimedia' computer :), it even has the sigs of the designers molded inside the case, even their dogs paw print! they were crazy hippy dudes like Jay Miner, the Amiga 500 Motherboard was called the B52 Rock Lobster, and the chips had names like 'Fat Agnus' and when u got an error it would display 'Guru Meditation' haha those were the days.

scythe