home *** CD-ROM | disk | FTP | other *** search
- ////////////////////////////////////////////////////////////////////////////////////////
- //
- // MoH: Allied Assault Script File
- // Global function: For giving items and placing item icons on the HUD
- // Script Written By: Benson 'elmagoo' Russell
- //
- ////////////////////////////////////////////////////////////////////////////////////////
-
- //**************************************************************************
- //*** add items to inventory
- //*** this will put an item into the players inventory
- //*** syntax --------------------------------
- //*** add_item <item>
- //**************************************************************************
- add_item local.passed_item local.nomessage:
-
- //*** check to see if the counter has been initialized
- if (level.item_total == NIL)
- {
- level.item_total = 0
- }
-
- //*** check to see if there are already 6 items in the inventory
- if (level.item_total >= 6)
- {
- println "^~^~^ Can't have more than 6 items in player's inventory!!"
- goto add_item_end
- }
-
- //*** assign the proper graphic for the item
- switch (local.passed_item)
- {
- case "camera":
- local.item_graphic = "textures/hud/item_camera"
- local.item = "camera"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the spy camera!"
- }
-
- $player item models/items/camera.tik
- break
-
- case "binoculars":
- local.item_graphic = "textures/hud/item_binoculars"
- local.pickup_sound = "pickup_explosives"
- local.item = "binoculars"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the binoculars!"
- }
-
- $player item models/items/binoculars.tik
- break
-
- case "bangalores":
- local.item_graphic = "textures/hud/item_bangalore"
- local.pickup_sound = "pickup_bangalore"
- local.item = "bangalores"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the bangalores!"
- }
-
- break
-
- case "battery":
- local.item_graphic = "textures/hud/item_battery"
- local.item = "battery"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the battery!"
- }
-
- break
-
- case "clipboard":
- local.item_graphic = "textures/hud/item_clipboard"
- //local.pickup_sound = "pickup_clipboard"
- local.pickup_sound = "pickup_papers"
- local.item = "clipboard"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the manifest!"
- }
-
- break
-
- case "radar_blueprints":
- local.item_graphic = "textures/hud/item_radar_blueprints"
- local.pickup_sound = "pickup_papers"
- local.item = "radar_blueprints"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the Naxos radar blueprints!"
- }
-
- break
-
- case "radar_notes":
- local.item_graphic = "textures/hud/item_radar_notes"
- local.pickup_sound = "pickup_papers"
- local.item = "radar_notes"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the Naxos radar research notes!"
- }
-
- break
-
- case "uboat_blueprints":
- local.item_graphic = "textures/hud/item_uboat_blueprints"
- local.pickup_sound = "pickup_papers"
- local.item = "uboat_blueprints"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the Naxos uboat blueprints!"
- }
-
- break
-
- case "uboat_notes":
- local.item_graphic = "textures/hud/item_uboat_notes"
- local.pickup_sound = "pickup_papers"
- local.item = "uboat_notes"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the Naxos uboat research notes!"
- }
-
- break
-
- case "explosive":
- local.item = "explosive"
- // no break
-
- case "explosives":
- local.item_graphic = "textures/hud/item_explosive"
- local.pickup_sound = "pickup_explosives"
- if (local.item == NIL)
- {
- local.item = "explosives"
- }
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired explosives!"
- }
-
- break
-
- case "radio_explosives":
- local.item_graphic = "textures/hud/item_radio_explosive"
- local.pickup_sound = "pickup_explosives"
- if (local.item == NIL)
- {
- local.item = "radio_explosives"
- }
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired radio detonated explosives!"
- }
-
- break
-
- case "gasmask":
- local.item_graphic = "textures/hud/item_gasmask"
- local.pickup_sound = "pickup_gasmask"
- local.item = "gasmask"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the gas mask!"
- }
-
- break
-
- case "papers_level1":
- local.item_graphic = "textures/hud/item_papers1"
- local.pickup_sound = "pickup_papers"
- local.item = "papers_level1"
- $player item models/items/papers.tik
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired level 1 papers!"
- }
-
- level.papers = 1
- break
-
- case "papers_level2":
- local.item_graphic = "textures/hud/item_papers2"
- local.pickup_sound = "pickup_papers"
- local.item = "papers_level2"
- $player item models/items/papers2.tik
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired level 2 papers!"
- }
-
- level.papers = 2
- break
-
- case "wirecutters":
- local.item = "wirecutters"
- // no break
-
- case "wirecutter":
- local.item = "wirecutter"
- // no break
-
- case "cutters":
- local.item = "cutters"
- // no break
-
- case "cutter":
- local.item_graphic = "textures/hud/item_wirecutters"
- if (local.item == NIL)
- {
- local.item = "cutter"
- }
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the wirecutters!"
- }
-
- break
-
- case "radio":
- local.item_graphic = "textures/hud/item_radio"
- local.pickup_sound = "radio_click"
- local.item = "radio"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the radio!"
- }
-
- break
-
- case "uniform":
- local.item_graphic = "textures/hud/item_uniform"
- local.pickup_sound = "pickup_uniform"
- local.item = "uniform"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired a German officers uniform!"
- }
-
- $player.has_disguise = 1
- setcvar g_playermodel "german_waffenss_officer"
-
- break
-
- case "stg44_blueprints":
- local.item_graphic = "textures/hud/item_stg44_blueprints"
- local.pickup_sound = "pickup_papers"
- local.item = "stg44_blueprints"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the StG44 blueprints!"
- }
-
- break
-
- case "tigerii_manual":
- local.item_graphic = "textures/hud/item_tigerii_manual"
- local.pickup_sound = "pickup_papers"
- local.item = "tigerii_manual"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the King Tiger field manual!"
- }
-
- break
-
- case "battleplans":
- local.item_graphic = "textures/hud/item_battleplans"
- local.pickup_sound = "pickup_papers"
- local.item = "battleplans"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired the German battle plans!"
- }
-
- break
-
- case "stickybomb":
- local.item = "stickybomb"
- local.item_graphic = "textures/hud/item_stickybomb"
- local.pickup_sound = "stickybomb_pickup"
-
- if (local.nomessage == NIL)
- {
- iprintln "You have acquired sticky bombs!"
- }
-
- break
-
- case "charges0":
- local.item = "charges0"
- local.item_graphic = "textures/hud/democharge0"
- break
-
- case "charges1":
- local.item = "charges1"
- local.item_graphic = "textures/hud/democharge1"
- break
-
- case "charges2":
- local.item = "charges2"
- local.item_graphic = "textures/hud/democharge2"
- break
-
- case "charges3":
- local.item = "charges3"
- local.item_graphic = "textures/hud/democharge3"
- break
-
- case "charges4":
- local.item = "charges4"
- local.item_graphic = "textures/hud/democharge4"
- break
-
- case "charges5":
- local.item = "charges5"
- local.item_graphic = "textures/hud/democharge5"
- break
-
- //*** the default is selected if the scripter enter a non-valid item
- default:
- println "^~^~^ " local.item " is not a valid inventory item!!"
- goto add_item_end
- break
- }
-
- //*** up the item total counter
- level.item_total += 1
-
- //*** shuffle the inventory items down 1 slot each
- for (local.i = level.item_total ; local.i > 1 ; local.i --)
- {
- level.item_graphic[local.i] = level.item_graphic[(local.i - 1)]
- level.item[local.i] = level.item[(local.i - 1)]
- huddraw_shader (local.i + 20) level.item_graphic[local.i]
- }
-
- //*** add the new item
- level.item_graphic[1] = local.item_graphic
- level.item[1] = local.item
- huddraw_shader 21 level.item_graphic[1]
-
- //*** play the proper sound
- if (local.pickup_sound != NIL)
- {
- $player playsound local.pickup_sound
- }
-
- //*** draw the items on the screen
- thread draw_items
-
- add_item_end:
- end
-
-
- //**************************************************************************
- //*** remove items from inventory
- //*** this will remove an item from the players inventory
- //*** syntax --------------------------------
- //*** remove_item <item>
- //**************************************************************************
- remove_item local.item:
-
- //*** check to see if the counter has been initialized
- if (level.item_total == NIL)
- {
- level.item_total = 0
- }
-
- //*** if the inventory is already empty, exit
- if (level.item_total <= 0)
- {
- println "^~^~^ There are no items currently in the players inventory!!"
- goto remove_item_end
- }
-
- for (local.i = 1 ; local.i <= 6 ; local.i ++)
- {
- if (level.item[local.i] == local.item)
- {
- local.index = local.i
- goto remove_item_remove
- }
- }
-
- //*** if the item isn't in the players inventory tell the scripter
- println "^~^~^ " local.item " can not be removed, it is not in the players inventory!!"
- goto remove_item_end
-
- //*** remove the item and shuffle the remaining inventory down a slot
- remove_item_remove:
-
- //*** check to see if it's a useable item that needs removing
- if (local.item == "camera")
- {
- $player take models/items/camera.tik
- }
- else if (local.item == "binoculars")
- {
- $player take models/items/binoculars.tik
- }
- else if (local.item == "papers_level1")
- {
- $player take models/items/papers.tik
- level.papers = 0
- }
- else if (local.item == "papers_level2")
- {
- $player take models/items/papers2.tik
- level.papers = 0
- }
- else if (local.item == "uniform")
- {
- setcvar g_playermodel "american_army"
- $player.has_disguise = 0
- }
-
- //*** remove the item and shuffle the rest down a slot
- for (local.j = local.index ; local.j < level.item_total ; local.j ++)
- {
-
- level.item_graphic[local.j] = level.item_graphic[(local.j + 1)]
- level.item[local.j] = level.item[(local.j + 1)]
- huddraw_shader (local.j + 20) level.item_graphic[local.j]
-
- level.item_graphic[(local.j + 1)] = ""
- level.item[(local.j + 1)] = ""
- }
-
- level.item_total -= 1
-
- //*** draw the items on the screen
- thread draw_items
-
- remove_item_end:
- end
-
-
-
- //************************************************
- // draw the item icons
- //************************************************
- draw_items:
-
- //*** variables to base the position off of, positions for all the item slots
- local.xpos = -384
- local.ypos = 8
-
- huddraw_align 21 right top
- huddraw_align 22 right top
- huddraw_align 23 right top
- huddraw_align 24 right top
- huddraw_align 25 right top
- huddraw_align 26 right top
-
- //*** draw the items on the hud
- for (local.j = 1 ; local.j <= 6 ; local.j ++)
- {
- local.xpos = -70 * local.j - 8
- huddraw_rect (local.j + 20) local.xpos local.ypos 64 64
-
- if (local.j > level.item_total)
- {
- huddraw_alpha (local.j + 20) 0
- goto draw_item_next
- }
-
- huddraw_alpha (local.j + 20) 0.7
- draw_item_next:
- }
-
- end
-
-
- //************************************************
- // reload all the item slots
- //************************************************
- reload_items:
-
- waitthread blank_items
-
- for (local.i = 1 ; local.i <= 6 ; local.i ++)
- {
- huddraw_shader (local.i + 20) level.item_graphic[local.i]
- }
-
- thread draw_items
-
- end
-
-
- //************************************************
- // blank all the item slots
- //************************************************
- blank_items:
-
- huddraw_alpha 21 0
- huddraw_alpha 22 0
- huddraw_alpha 23 0
- huddraw_alpha 24 0
- huddraw_alpha 25 0
- huddraw_alpha 26 0
-
- end