inventory for fps?

hi i create a fps game but i am problem with the arms inventory
i read this tuto
http://theboomshelter.com/itute.html
but this dont works with blender 2.42 ,this works fine only in blender 2.25
i modifics the simpledemo file of thsi tuts
but dont works scripts names and othes scripts
download this:
http://www.savefile.com/files/105688
somebody can help me to be able to finish adapting it
so that it works correctly in blender 2.42

i very appreciate you collaboration…

HERE THE ERRORS SCRIPTS I CAN DETECT
BUT I DO NOT UNDERSTAND THAT TO CHANGE
SO THAT IT WORKS CORRECTLY

########script equip####################
1 own = GameLogic.getCurrentController().getOwner()
2 if own.gun == GameLogic.equip:
3 own.vis = 1
4 own.setVisible(1)
5 else:
6 own.vis = 2
7 own.setVisible(0)

ERROR console in line 2
attribute error:´module´ object has no attribute ´equip´

########script info######################
1 cont= GameLogic.getCurrentController()
2 own = cont.getOwner()
3 sen = cont.getSensor(‘col’)
4 sen2 = cont.getSensor(‘enter’)
5 if sen.isPositive():
6 GameLogic.name = sen.getHitObject().note
7 if sen2.isPositive() and sen.isPositive:
8 GameLogic.equip = sen.getHitObject().gun

ERROR console in line 8
attribute error:´nonetype´ object has not attribute ´gun´

ANYONE WITH PYTHON KNOWLEDGE
HELP PLEASESSSS

HERE THE ERRORS SCRIPTS I CAN DETECT
BUT I DO NOT UNDERSTAND THAT TO CHANGE
SO THAT IT WORKS CORRECTLY

########script equip####################
1 own = GameLogic.getCurrentController().getOwner()
2 if own.gun == GameLogic.equip:
3 own.vis = 1
4 own.setVisible(1)
5 else:
6 own.vis = 2
7 own.setVisible(0)

ERROR console in line 2
attribute error:´module´ object has no attribute ´equip´

########script info######################
1 cont= GameLogic.getCurrentController()
2 own = cont.getOwner()
3 sen = cont.getSensor(‘col’)
4 sen2 = cont.getSensor(‘enter’)
5 if sen.isPositive():
6 GameLogic.name = sen.getHitObject().note
7 if sen2.isPositive() and sen.isPositive:
8 GameLogic.equip = sen.getHitObject().gun

ERROR console in line 8
attribute error:´nonetype´ object has not attribute ´gun´

ANYONE WITH PYTHON KNOWLEDGE
HELP PLEASESSSS

ok it works in 2.42a now

http://www.upload2.net/page/download/aBET4Yz5I3WYbuw/simpledemo.blend.html

i didnt use yours thoyugh i used the one from the stickey

thanks a lot scabootssca for you help

now works in blender 2.42:) :slight_smile: :slight_smile: i very happy…

the scripts modifcs for scabootssca :
###########info###################
cont= GameLogic.getCurrentController()
own = cont.getOwner()
sen = cont.getSensor(‘col’)
sen2 = cont.getSensor(‘enter’)
obj = sen.getHitObject()
if sen.isPositive():
if obj:
GameLogic.name = obj.note
if sen2.isPositive() and sen.isPositive:
if obj:
GameLogic.equip = obj.gun

##########equip###########

g = GameLogic
own = g.getCurrentController().getOwner()
if hasattr(g,“initilizedInventory”):
if own.gun == g.equip:
own.vis = 1
own.setVisible(1)
else:
own.vis = 2
own.setVisible(0)

########starup##############
import GameLogic as g
g.inventory = []
g.name = “Empty”
g.equip = “”
g.initilizedInventory = 1

Cool :slight_smile:
Thank you for this demo file. It’s very interesting.

Just a question : when I select a gun (a gun which is in the inventory), the gun doesn’t appear on the screen. How can I make that ? For exemple, if the game is in third person, when I selected the Gun1, the Gun 1 appears in the hand of my character.

Thank you scabootssca :wink:

another download (repair script):
http://www.savefile.com/files/108682

(or in the scabootssca file delete the “1” of the gamelogic.equip = obj.gun in the script info

if sen2.isPositive() and sen.isPositive:
if obj:
1GameLogic.equip = obj.gun

Hi
Thank you very much !!
This file works properly :smiley:

Please use the code tags when posting python scripts