so how could i make it so that when i pick up
object 5, the name is
weapon (1).name = Sniper Rifle and the case number is
case 1? here's my source:
`-------- Title: My First FPS
`-------- Author: Krimzon DestinE
`-------- Date: October 15, 2005
`---------------------------------------------------------------
`------------------Main Variables-------------------------------
`---------------------------------------------------------------
`Setup Client Options
SYNC ON:SYNC RATE 0:HIDE MOUSE: AUTOCAM OFF:RANDOMIZE TIMER()
`weapon
type weapon
name as string
ammo as integer
maxammo as integer
clips as integer
maxclips as integer
endtype
`setup arrays
dim weapon(4) as weapon
weapon(0).name="Unarmed"
weapon(1).name="Sniper Rifle"
weapon(1).ammo=100
weapon(1).maxammo=100
weapon(1).clips=3
weapon(1).maxclips=3
weapon(2).name="Shotgun"
weapon(2).ammo=8
weapon(2).maxammo=8
weapon(2).clips=3
weapon(2).maxclips=3
weapon(3).name="Tommygun"
weapon(3).ammo=500
weapon(3).maxammo=500
weapon(3).clips=3
weapon(3).maxclips=3
weapon(4).name="ProximityMines"
weapon(4).ammo=10
weapon(4).maxammo=10
weapon(4).clips=3
weapon(4).maxclips=3
`Fire Counter to delay firing
DIM FireCounter(1)
`Define the main variables needed
PlayerHP=2000`-----Player's Health
MaxPlayerHP=2000`--Player's Max Health
EnemyHP=2000`------Enemy's Health
MaxEnemyHP=2000`---Enemy's Max Health
ArmorHP=500`-------Armor Health
play_out = 0`------Tells when player has gone off matrix
FireCounter(1)=0`--Delays Firing
`---------------------------------------------------------------
`------------------In Game Objects------------------------------
`---------------------------------------------------------------
`Create Main Player
MAKE OBJECT SPHERE 1,50:COLOR OBJECT 1,RGB(000,255,000):POSITION OBJECT 1,RND(1000),Ground#,RND(1000)
`Create Enemy Player
MAKE OBJECT SPHERE 2,50:COLOR OBJECT 2,RGB(255,000,000):POSITION OBJECT 2,RND(1000),Ground#,RND(1000)
`create armor
MAKE OBJECT CUBE 3,10:COLOR OBJECT 3,RGB(167,176,10):POSITION OBJECT 3,100,Ground#,100
`create ammo crate
MAKE OBJECT CUBE 4,10:COLOR OBJECT 4,RGB(20,250,75):POSITION OBJECT 4,100,Ground#,130
`create sniper rifle
MAKE OBJECT CUBE 5,10:COLOR OBJECT 5,RGB(13,234,132):POSITION OBJECT 5,100,Ground#,160
`create shotgun
MAKE OBJECT CUBE 6,10:COLOR OBJECT 6,RGB(58,220,76):POSITION OBJECT 6,100,Ground#,190
`create tommy gun
MAKE OBJECT CUBE 7,10:COLOR OBJECT 7,RGB(33,0,13):POSITION OBJECT 7,100,Ground#,210
`create health crate
MAKE OBJECT CUBE 8,10:COLOR OBJECT 8,RGB(70,10,200):POSITION OBJECT 8,100,Ground#,230
`create proximity mines
MAKE OBJECT CUBE 9,10:COLOR OBJECT 9,RGB(67,16,190):POSITION OBJECT 9,100,Ground#,250
`create playing field
MAKE MATRIX 1,1000,1000,50,50
load image "media/grass_T.bmp",1
prepare matrix texture 1,1,1,1
`make matrix the ground
Ground#=GET GROUND HEIGHT(1,0,0)
`---------------------------------------------------------------
`------------------Player Limbs---------------------------------
`---------------------------------------------------------------
`Add limb for intersection checks
MAKE OBJECT SPHERE 9999,10
MAKE MESH FROM OBJECT 1,9999
DELETE OBJECT 9999
ADD LIMB 1,1,1
HIDE LIMB 1,1
`Add a second limb for ground checks
ADD LIMB 1,2,1
OFFSET LIMB 1,2,0,-50,0
DELETE MESH 1
HIDE LIMB 1,2
`---------------------------------------------------------------
`------------------Enemy Limbs----------------------------------
`---------------------------------------------------------------
`Add limb for intersection checks
MAKE OBJECT SPHERE 7777,10
MAKE MESH FROM OBJECT 1,7777
DELETE OBJECT 7777
ADD LIMB 2,1,1
OFFSET LIMB 2,1,0,0,500
HIDE LIMB 2,1
`Add a second limb for ground checks
ADD LIMB 2,2,1
OFFSET LIMB 2,2,0,-50,0
DELETE MESH 1
HIDE LIMB 2,2
`---------------------------------------------------------------
`------------------Main Do/Loop---------------------------------
`---------------------------------------------------------------
DO
`---------------------------------------------------------------
`------------------Info Display---------------------------------
`---------------------------------------------------------------
`display text above things
IF OBJECT EXIST(2)=1
IF OBJECT IN SCREEN(2)=1
CENTER TEXT OBJECT SCREEN X(2),OBJECT SCREEN Y(2)-70,"Enemy Health: "+str$(EnemyHP)
ENDIF
ENDIF
IF OBJECT EXIST(3)=1
IF OBJECT IN SCREEN(3)=1
CENTER TEXT OBJECT SCREEN X(3),OBJECT SCREEN Y(3)-20,"Armor"
ENDIF
ENDIF
IF OBJECT EXIST(4)=1
IF OBJECT IN SCREEN(4)=1
CENTER TEXT OBJECT SCREEN X(4),OBJECT SCREEN Y(4)-20,"Ammo Crate"
ENDIF
ENDIF
IF OBJECT EXIST(5)=1
IF OBJECT IN SCREEN(5)=1
CENTER TEXT OBJECT SCREEN X(5),OBJECT SCREEN Y(5)-20,"Sniper Rifle"
ENDIF
ENDIF
IF OBJECT EXIST(6)=1
IF OBJECT IN SCREEN(6)=1
CENTER TEXT OBJECT SCREEN X(6),OBJECT SCREEN Y(6)-20,"Shotgun"
ENDIF
ENDIF
IF OBJECT EXIST(7)=1
IF OBJECT IN SCREEN(7)=1
CENTER TEXT OBJECT SCREEN X(7),OBJECT SCREEN Y(7)-20,"Tommy Gun"
ENDIF
ENDIF
IF OBJECT EXIST(8)=1
IF OBJECT IN SCREEN(8)=1
CENTER TEXT OBJECT SCREEN X(8),OBJECT SCREEN Y(8)-20,"Helath"
ENDIF
ENDIF
IF OBJECT EXIST(9)=1
IF OBJECT IN SCREEN(9)=1
CENTER TEXT OBJECT SCREEN X(9),OBJECT SCREEN Y(9)-20,"Proximity Mines"
ENDIF
ENDIF
`Display our Ammo, Clips, Health, and Armor on-screen
TEXT 0,SCREEN HEIGHT()-60,"Health: "+str$(PlayerHP)
TEXT 0,SCREEN HEIGHT()-50,"Ammo: "+str$(Ammo)
TEXT 0,SCREEN HEIGHT()-40,"Clips: "+str$(Clips)
`Show that we're reloading
IF Reload=1 THEN CENTER TEXT SCREEN WIDTH()/2,SCREEN HEIGHT()/2,"Reloading..."
`Add a target reticule to the screen
CIRCLE SCREEN WIDTH()/2,SCREEN HEIGHT()/2,5
`Fix player moving through the matrix
if Play_y# < Ground#
Play_y# = Ground#
position object 1, Play_x#, Play_y#, Play_z#
endif
`Screen FPS
FPS#=SCREEN FPS()
TEXT 500,0,"FPS: "+STR$(FPS#)
`display current weapon
text 500,500, "Current Weapon: "+str$(CWeapon)
`Camera Positioning
POSITION CAMERA OBJECT POSITION X(1),OBJECT POSITION Y(1)+10,OBJECT POSITION Z(1)
`---------------------------------------------------------------
`------------------Movement Settings----------------------------
`---------------------------------------------------------------
`stop player from flying
xrotate object 1, 0
`Movement Controls
IF KEYSTATE(17)=1 THEN MOVE OBJECT 1,.9
IF KEYSTATE(31)=1 THEN MOVE OBJECT 1,-.9
IF KEYSTATE(30)=1 THEN MOVE OBJECT LEFT 1,.8
IF KEYSTATE(32)=1 THEN MOVE OBJECT RIGHT 1,.8
`Use variables to make code easier to read (shorter lines)
Play_x# = object position x(1)
Play_y# = object position y(1)
Play_z# = object position z(1)
Leg_x# = LIMB POSITION X(1,2)
Leg_y# = LIMB POSITION Y(1,2)
Leg_z# = LIMB POSITION Z(1,2)
enemy_x# = object position x(2)
enemy_y# = object position y(2)
enemy_z# = object position z(2)
`prevent player from moving off matrix
if Play_x# < 0 then Play_x# = 0 : play_out = 1
if Play_x# > 1000 then Play_x# = 1000 : play_out = 1
if Play_z# < 0 then Play_z# = 0 : play_out = 1
if Play_z# > 1000 then Play_z# = 1000 : play_out = 1
if play_out = 1
position object 1, Play_x#, Play_y# , Play_z#
play_out = 0
endif
`Space key Controls
IF SPACEKEY()=1 AND JUMPING=0
JUMP_SPEED#=1
JUMPING=1
ENDIF
`Jumping
IF JUMPING=1
DEC JUMP_SPEED#,.005
POSITION OBJECT 1,Play_x#,Play_y#+JUMP_SPEED#, Play_z#
IF Play_y#<=Ground# THEN JUMPING=0
ENDIF
`Put player direction back to mouselook angle
xrotate object 1, CAMX#
`Mouse Camera Movement
CAMY#=CAMY#+MOUSEMOVEX()*.1
CAMX#=CAMX#+MOUSEMOVEY()*.1
IF CAMX#>90 AND CAMX#<135 THEN CAMX#=90
IF CAMX#>270 AND CAMX#<225 THEN CAMX#=90
YROTATE CAMERA CAMY#
XROTATE CAMERA CAMX#
YROTATE OBJECT 1,CAMY#
XROTATE OBJECT 1,CAMX#
`Mouseclick Shooting
IF KEYSTATE(19)=0 AND MOUSECLICK()=1
IF Ammo>0 THEN DEC Ammo,1
IF OBJECT EXIST(2)=1
IF Ammo>0 AND INTERSECT OBJECT (2, LIMB POSITION X(1,1), LIMB POSITION y(1,1), LIMB POSITION z(1,1), Play_x#,Play_y#, Play_z#)>0 THEN DEC EnemyHP,1
ENDIF
ENDIF
`enemy death, deletions, and regeneration
if EnemyHP=0 AND OBJECT EXIST(2)=1
DELETE OBJECT 2
MAKE OBJECT SPHERE 2,50: COLOR OBJECT 2,RGB(255,000,000): POSITION OBJECT 2,RND(600),Ground#,RND(600)
EnemyHP=2000
endif
`Reloading (press R)
IF MOUSECLICK()=0 AND KEYSTATE(19)=1 AND Ammo<MaxAmmo AND Clips>0
Reload=1
ENDIF
`Reloading Part 2 (delay)
IF Reload=1 THEN INC Time#,.005
IF Time#>=1 THEN Ammo=MaxAmmo:DEC Clips,1:Time#=0:Reload=0
`Ammo Crate code (obtain ammo from ground)
IF OBJECT EXIST(4)=1
IF Ammo<MaxAmmo AND INTERSECT OBJECT (4, Leg_x#, Leg_y#, Leg_z#, Play_x#,Play_y#, Play_z#)>0
INC Clips,(MaxClips-Clips)
INC Ammo,(MaxAmmo-Ammo)
DELETE OBJECT 4
ENDIF
ENDIF
`Armor crate code A (obtain armor from ground)
IF OBJECT EXIST(3)=1
IF INTERSECT OBJECT (3, Leg_x#, Leg_y#, Leg_z#, Play_x#,Play_y#, Play_z#)>0
DELETE OBJECT 3
ENDIF
ENDIF
`Armor crate code B (display armor and reduce armor health when shot
IF OBJECT EXIST(3)=0
TEXT 0,SCREEN HEIGHT()-70,"Armor: "+str$(ArmorHP)
ENDIF
`health crate code
If PlayerHP<MaxPlayerHP and intersect object (8, Leg_x#, Leg_y#, Leg_z#, Play_x#, Play_y#, Play_z#)>0
inc PlayerHP,(MaxPlayerHP-PlayerHP)
delete object 8
endif
`---------------------------------------------------------------
`------------------Weapons Code---------------------------------
`---------------------------------------------------------------
SYNC
LOOP
` CWeapon = Current Weapon
global CWeapon=1
SetWeapon()
` Set Weapon Offset
function SetWeapon()
select CWeapon
case 0
offset limb 1,1,0,0,10
endcase
case 1
offset limb 1,1,0,0,10000
endcase
case 2
offset limb 1,1,0,0,500
endcase
case 3
offset limb 1,1,0,0,400
endcase
case 4
offset limb 1,1,0,0,444
endcase
endselect
endfunction