Adding to this older fps demo

Hi, I recently played this, it has a lot of items in it.

I am not sure what to do, I am trying to get the armature placed to load in a new item, the bone section doesn’t seem to move the armature with it, so I can animate it with the object. And then add code for it to load according to the tutorial video.

blend file 2.76 https://ufile.io/m3q4n5ty

Explains the armature animation movement process. I used the demo release. So I’m not quite sure, what is going on. The file works in the game engine.

I used the wip tutorial file. The animation shows the new hand positions. But the new file doesn’t load(python code wasn’t updated, I think was the problem there). It is there but in the game engine it won’t load.

I don’t know, it loads fine in one file, but in this file, it doesn’t. I added to the code, it could be a brick missing for the file. I tried to animate the arms for the item, but the whole rig just moves down.

import bge

cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
own = cont.owner

equipped = own['equipped']
target = own['target']
timer = own['timer']
change = own['change']
reload = own['reload']
Grenades = own['Grenades']
Smoke = own['Smoke']
shoot = own['shoot']

collide = cont.sensors['cutscene']

#animations
down_m24 = cont.actuators['downm24']
downGlock = cont.actuators['downGlock']
upm24 = cont.actuators['pickupm24']
upGlock = cont.actuators['pickupGlock']
downGren = cont.actuators['down_Gren']
upGren = cont.actuators['pickup_Gren']
Sdown = cont.actuators['Sdown']
Sup = cont.actuators['Sup']
Kdown = cont.actuators['knifedown']
Kup = cont.actuators['knifeup']
chain = cont.actuators['downChain']
opendoor = cont.actuators['opendoor']

self = scene.objects[own.name]
movement = scene.objects['player']

#sets change == True
if own['target'] != own['equipped'] and reload == False and shoot == True or own['equipped'] == 0 or own['target'] == 6:
    self['change'] = True
elif own['target'] == own['equipped']:
    self['change'] = False

#timer  
if change == True and timer < 30 and movement['door'] == False:
    own['timer'] += 1

if change == True and movement['door'] == True and timer < 45:
    own['timer'] += 1
    
#putting down weapon
if equipped == 0 and change == True and timer == 0:
    cont.activate(downGlock)
if equipped == 1 and change == True and timer == 0:
    cont.activate(down_m24)
if equipped == 2 and change == True and timer == 0:
    cont.activate(downGlock)
if equipped == 3 and change == True and timer == 0:
    cont.activate(downGren)
if equipped == 4 and change == True and timer == 0:
    cont.activate(Sdown)
if equipped == 5 and change == True and timer == 0:
    cont.activate(Kdown
if equipped == 6 and change == True and timer == 0:
    cont.activate(downChain)
    
    
#ends old weapon + animation
if timer == 15 and change == True and equipped == 0:
    cont.deactivate(downGlock)
if timer == 15 and change == True and equipped == 1:
    own.sendMessage("endm24")
    cont.deactivate(down_m24)
if timer == 15 and change == True and equipped == 2:
    own.sendMessage("endglock")
    cont.deactivate(downGlock)
if timer == 15 and change == True and equipped == 3:
    own.sendMessage("endGren")
    cont.deactivate(downGren)
if timer == 15 and change == True and equipped == 4:
    own.sendMessage("endSmoke")
    cont.deactivate(Sdown)
if timer == 15 and change == True and equipped == 5:
    own.sendMessage("endKnife")
    cont.deactivate(Kdown)
if timer == 15 and change == True and equipped == 6:
    own.sendMessage("endChain")
    cont.deactivate(downChain)
    
#spawn new weapon
if timer == 15 and change == True and target == 1:
    scene.addObject('m24', own, 0)
if timer == 15 and change == True and target == 2:
    scene.addObject('Glock', own, 0)
if timer == 15 and change == True and target == 3:
    scene.addObject('Grenade', own, 0)
if timer == 15 and change == True and target == 4:
    scene.addObject('smoke', own, 0)
if timer == 15 and change == True and target == 5:
    scene.addObject('knife', own, 0)
if timer == 15 and change == True and target == 6:
    scene.addObject('Chain', own, 0)

#picking up weapon
if timer > 15 and timer < 30 and change == True and target == 1:
    cont.activate(upm24)
if timer > 15 and timer < 30 and change == True and target == 2:
    cont.activate(upGlock)  
if timer > 15 and timer < 30 and change == True and target == 3:
    cont.activate(upGren)
if timer > 15 and timer < 30 and change == True and target == 4:
    cont.activate(Sup)
if timer > 15 and timer < 30 and change == True and target == 5:
    cont.activate(Kup)
if timer > 15 and timer < 30 and change == True and target == 6:
    cont.activate(upChain)
if timer > 15 and timer < 45 and change == True and movement['door'] == True and target == 6:
    cont.activate(opendoor)

#open sesame
doorsound = cont.actuators['doorsound']
if timer == 30 and change == True and movement['door'] == True and target == 6:
    select = collide.hitObjectList[0]
    own.sendMessage("opendoor", "", str(select))
    cont.activate(doorsound)
#resetting properties
if timer == 30 and change == True and own['equipped'] != own['target'] and movement['door'] == False:
    own['equipped'] = own['target']
    own['timer'] -= 31
    cont.deactivate(upm24)
    cont.deactivate(upGren)
    cont.deactivate(upGlock)
    cont.deactivate(Sup)
    cont.deactivate(Kup)

#resetting after cutscene
if timer == 45 and change == True and movement['door'] == True and own['equipped'] != 6:
    own['equipped'] = own['target']
    movement['door'] = False
    movement['control'] = True
    movement['cutscene'] = 0
    self['timer'] = 0
    own.sendMessage("restorecontrol")
    cont.deactivate(opendoor)
    own['target'] = 2
    
#intial weapon selection
if equipped == 0:
    self['target'] = 2

I edited the changed.py added chain, then added a few bricks, I couldn’t add the animation one since there are so many. The arms are now loaded the correct way, but no weapon selection works, 1, 2, 3. so 6 would be the new item, the demo and the wip tutorials aren’t quite the same, so I’ve edited and add what I think is most of the change.

I edited the python code a little more, line 61 is an error.

import bge

cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
own = cont.owner

equipped = own['equipped']
target = own['target']
timer = own['timer']
change = own['change']
reload = own['reload']
Grenades = own['Grenades']
Smoke = own['Smoke']
shoot = own['shoot']

collide = cont.sensors['cutscene']

#animations
down_m24 = cont.actuators['downm24']
downGlock = cont.actuators['downGlock']
upm24 = cont.actuators['pickupm24']
upGlock = cont.actuators['pickupGlock']
downGren = cont.actuators['down_Gren']
upGren = cont.actuators['pickup_Gren']
Sdown = cont.actuators['Sdown']
Sup = cont.actuators['Sup']
Kdown = cont.actuators['knifedown']
Kup = cont.actuators['knifeup']
chain = cont.actuators['chaindown']
opendoor = cont.actuators['opendoor']

self = scene.objects[own.name]
movement = scene.objects['player']

#sets change == True
if own['target'] != own['equipped'] and reload == False and shoot == True or own['equipped'] == 0 or own['target'] == 6:
    self['change'] = True
elif own['target'] == own['equipped']:
    self['change'] = False

#timer  
if change == True and timer < 30 and movement['door'] == False:
    own['timer'] += 1

if change == True and movement['door'] == True and timer < 45:
    own['timer'] += 1
    
#putting down weapon
if equipped == 0 and change == True and timer == 0:
    cont.activate(downGlock)
if equipped == 1 and change == True and timer == 0:
    cont.activate(down_m24)
if equipped == 2 and change == True and timer == 0:
    cont.activate(downGlock)
if equipped == 3 and change == True and timer == 0:
    cont.activate(downGren)
if equipped == 4 and change == True and timer == 0:
    cont.activate(Sdown)
if equipped == 5 and change == True and timer == 0:
    cont.activate(Kdown
**if equipped == 6 and change == True and timer == 0:**
**    cont.activate(chaindown)**
    
    
#ends old weapon + animation
if timer == 15 and change == True and equipped == 0:
    cont.deactivate(downGlock)
if timer == 15 and change == True and equipped == 1:
    own.sendMessage("endm24")
    cont.deactivate(down_m24)
if timer == 15 and change == True and equipped == 2:
    own.sendMessage("endglock")
    cont.deactivate(downGlock)
if timer == 15 and change == True and equipped == 3:
    own.sendMessage("endGren")
    cont.deactivate(downGren)
if timer == 15 and change == True and equipped == 4:
    own.sendMessage("endSmoke")
    cont.deactivate(Sdown)
if timer == 15 and change == True and equipped == 5:
    own.sendMessage("endKnife")
    cont.deactivate(Kdown)
if timer == 15 and change == True and equipped == 6:
    own.sendMessage("endChain")
    cont.deactivate(chaindown)
    
#spawn new weapon
if timer == 15 and change == True and target == 1:
    scene.addObject('m24', own, 0)
if timer == 15 and change == True and target == 2:
    scene.addObject('Glock', own, 0)
if timer == 15 and change == True and target == 3:
    scene.addObject('Grenade', own, 0)
if timer == 15 and change == True and target == 4:
    scene.addObject('smoke', own, 0)
if timer == 15 and change == True and target == 5:
    scene.addObject('knife', own, 0)
if timer == 15 and change == True and target == 6:
    scene.addObject('chain', own, 0)

#picking up weapon
if timer > 15 and timer < 30 and change == True and target == 1:
    cont.activate(upm24)
if timer > 15 and timer < 30 and change == True and target == 2:
    cont.activate(upGlock)  
if timer > 15 and timer < 30 and change == True and target == 3:
    cont.activate(upGren)
if timer > 15 and timer < 30 and change == True and target == 4:
    cont.activate(Sup)
if timer > 15 and timer < 30 and change == True and target == 5:
    cont.activate(Kup)
if timer > 15 and timer < 30 and change == True and target == 6:
    cont.activate(chainup)
if timer > 15 and timer < 45 and change == True and movement['door'] == True and target == 6:
    cont.activate(opendoor)

#open sesame
doorsound = cont.actuators['doorsound']
if timer == 30 and change == True and movement['door'] == True and target == 6:
    select = collide.hitObjectList[0]
    own.sendMessage("opendoor", "", str(select))
    cont.activate(doorsound)
#resetting properties
if timer == 30 and change == True and own['equipped'] != own['target'] and movement['door'] == False:
    own['equipped'] = own['target']
    own['timer'] -= 31
    cont.deactivate(upm24)
    cont.deactivate(upGren)
    cont.deactivate(upGlock)
    cont.deactivate(Sup)
    cont.deactivate(Kup)
    cont.deactivate(chainup)

#resetting after cutscene
if timer == 45 and change == True and movement['door'] == True and own['equipped'] != 6:
    own['equipped'] = own['target']
    movement['door'] = False
    movement['control'] = True
    movement['cutscene'] = 0
    self['timer'] = 0
    own.sendMessage("restorecontrol")
    cont.deactivate(opendoor)
    own['target'] = 2
    
#intial weapon selection
if equipped == 0:
    self['target'] = 2

if equipped == 6 and change == True and timer == 0:
** cont.activate(chaindown)**

The bricks are connected, the code has been edited. Either it doesn’t work because the way the armature has been setup and the 6 brick is connected to the changed.py, and the action brick called chain is connected to the and which is connected with the changed.py.

I even tried using 7 and renamed brick.

The arms are setup for everything one way, so the item needs the arms positioned at certain points. So holding the gun.

Moved it to the game layer, so it starts with it, as seen, it is very very slow.

The bottom code would be the item selected from start up.

#intial weapon selection
if equipped == 0:
    self['target'] = 2

But doesn’t really solve my problem with getting the items to load, and with this new one, but damn it is very slow. I never tried testing it with the gunspawn. Only when it was on its own, so it loaded fine.

In the line 60, there’s a missing close parenthesis:

    cont.activate(Kdown <----

I did correct that, it hasn’t change anything. I also tried to open a door, I think it is triggered by the player walking towards it, it doesn’t open. Just freezes.

I know there are a lot of bricks, but I am not sure what more i can do. The problem is now, the item doesn’t work as is.

Here are the properties.

Could be that model object may not be workable with many other objects.

I’m guessing I’d need to do something much more basic, either I edit that object or try and use something with less detail.

import bge

cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
own = cont.owner

equipped = own['equipped']
target = own['target']
timer = own['timer']
change = own['change']
reload = own['reload']
Grenades = own['Grenades']
Smoke = own['Smoke']
shoot = own['shoot']

collide = cont.sensors['cutscene']

#animations
down_m24 = cont.actuators['downm24']
downGlock = cont.actuators['downGlock']
upm24 = cont.actuators['pickupm24']
upGlock = cont.actuators['pickupGlock']
downGren = cont.actuators['down_Gren']
upGren = cont.actuators['pickup_Gren']
Sdown = cont.actuators['Sdown']
Sup = cont.actuators['Sup']
Kdown = cont.actuators['knifedown']
Kup = cont.actuators['knifeup']
opendoor = cont.actuators['opendoor']

self = scene.objects[own.name]
movement = scene.objects['player']

#sets change == True
if own['target'] != own['equipped'] and reload == False and shoot == True or own['equipped'] == 0 or own['target'] == 6:
    self['change'] = True
elif own['target'] == own['equipped']:
    self['change'] = False

#timer  
if change == True and timer < 30 and movement['door'] == False:
    own['timer'] += 1

if change == True and movement['door'] == True and timer < 45:
    own['timer'] += 1
    
#putting down weapon
if equipped == 0 and change == True and timer == 0:
    cont.activate(downGlock)
if equipped == 1 and change == True and timer == 0:
    cont.activate(down_m24)
if equipped == 2 and change == True and timer == 0:
    cont.activate(downGlock)
if equipped == 3 and change == True and timer == 0:
    cont.activate(downGren)
if equipped == 4 and change == True and timer == 0:
    cont.activate(Sdown)
if equipped == 5 and change == True and timer == 0:
    cont.activate(Kdown)
if equipped == 7 and change == True and timer == 0:
    cont.activate(Kdown)
    
#ends old weapon + animation
if timer == 15 and change == True and equipped == 0:
    cont.deactivate(downGlock)
if timer == 15 and change == True and equipped == 1:
    own.sendMessage("endm24")
    cont.deactivate(down_m24)
if timer == 15 and change == True and equipped == 2:
    own.sendMessage("endglock")
    cont.deactivate(downGlock)
if timer == 15 and change == True and equipped == 3:
    own.sendMessage("endGren")
    cont.deactivate(downGren)
if timer == 15 and change == True and equipped == 4:
    own.sendMessage("endSmoke")
    cont.deactivate(Sdown)
if timer == 15 and change == True and equipped == 5:
    own.sendMessage("endKnife")
    cont.deactivate(Kdown)
if timer == 15 and change == True and equipped == 7:
    own.sendMessage("endKnife")
    cont.deactivate(Kdown)
    
#spawn new weapon
if timer == 15 and change == True and target == 1:
    scene.addObject('m24', own, 0)
if timer == 15 and change == True and target == 2:
    scene.addObject('Glock', own, 0)
if timer == 15 and change == True and target == 3:
    scene.addObject('Grenade', own, 0)
if timer == 15 and change == True and target == 4:
    scene.addObject('smoke', own, 0)
if timer == 15 and change == True and target == 5:
    scene.addObject('knife', own, 0)
if timer == 15 and change == True and target == 7:
    scene.addObject('knife', own, 0)

#picking up weapon
if timer > 15 and timer < 30 and change == True and target == 1:
    cont.activate(upm24)
if timer > 15 and timer < 30 and change == True and target == 2:
    cont.activate(upGlock)  
if timer > 15 and timer < 30 and change == True and target == 3:
    cont.activate(upGren)
if timer > 15 and timer < 30 and change == True and target == 4:
    cont.activate(Sup)
if timer > 15 and timer < 30 and change == True and target == 5:
    cont.activate(Kup)
if timer > 15 and timer < 30 and change == True and target == 7:
    cont.activate(Kup)
if timer > 15 and timer < 45 and change == True and movement['door'] == True and target == 6:
    cont.activate(opendoor)

#open sesame
doorsound = cont.actuators['doorsound']
if timer == 30 and change == True and movement['door'] == True and target == 6:
    select = collide.hitObjectList[0]
    own.sendMessage("opendoor", "", str(select))
    cont.activate(doorsound)
#resetting properties
if timer == 30 and change == True and own['equipped'] != own['target'] and movement['door'] == False:
    own['equipped'] = own['target']
    own['timer'] -= 31
    cont.deactivate(upm24)
    cont.deactivate(upGren)
    cont.deactivate(upGlock)
    cont.deactivate(Sup)
    cont.deactivate(Kup)

#resetting after cutscene
if timer == 45 and change == True and movement['door'] == True and own['equipped'] != 6:
    own['equipped'] = own['target']
    movement['door'] = False
    movement['control'] = True
    movement['cutscene'] = 0
    self['timer'] = 0
    own.sendMessage("restorecontrol")
    cont.deactivate(opendoor)
    own['target'] = 2
    
#intial weapon selection
if equipped == 0:
    self['target'] = 2

I tried change,py and change.001.py, one is default with the same values, and the other the arms are positioned as I did.

If I have the item available on the gunspawn parent, it will show if moved from layer 2 to 1.

As for getting the item to load using key 7, I have created a few bricks and joined them up where I think they would work, based on the knife item. kdown for example, uses the same animation, but just would load a different object called chain.

The object does function, just after a lot of scaling and removing faces. :face_with_diagonal_mouth:

So it should be okay for the moment. The action Action key brick for the movement would just use 15 on one value as the others do, and that should work, I’d guess.

So for the following.

 
#ends old weapon + animation
if timer == 15 and change == True and equipped == 0:
    cont.deactivate(downGlock)
if timer == 15 and change == True and equipped == 1:
    own.sendMessage("endm24")
    cont.deactivate(down_m24)
if timer == 15 and change == True and equipped == 2:
    own.sendMessage("endglock")
    cont.deactivate(downGlock)
if timer == 15 and change == True and equipped == 3:
    own.sendMessage("endGren")
    cont.deactivate(downGren)
if timer == 15 and change == True and equipped == 4:
    own.sendMessage("endSmoke")
    cont.deactivate(Sdown)
if timer == 15 and change == True and equipped == 5:
    own.sendMessage("endKnife")
    cont.deactivate(Kdown)
if timer == 15 and change == True and equipped == 7:
    own.sendMessage("endKnife")
    cont.deactivate(Kdown)
    
#spawn new weapon
if timer == 15 and change == True and target == 1:
    scene.addObject('m24', own, 0)
if timer == 15 and change == True and target == 2:
    scene.addObject('Glock', own, 0)
if timer == 15 and change == True and target == 3:
    scene.addObject('Grenade', own, 0)
if timer == 15 and change == True and target == 4:
    scene.addObject('smoke', own, 0)
if timer == 15 and change == True and target == 5:
    scene.addObject('knife', own, 0)
if timer == 15 and change == True and target == 7:
    scene.addObject('knife', own, 0)

7 would be called chain instead of knife? As the object is chain, so if this make sense, just change the value to the new one, and it just uses the same animation of up and down, so grenade, stun grenade, hand gun. I guess knife.py would be the link for the action brick for chain object. I can’t see too well with the bricks, but it probably is that one.

I downloaded a few blends from blend swap, I can’t append any of them into the demo blend file I’m trying to add to.

It could be a few of them are too new, but not sure on this. An oldest file I tried is from twelve years back, and another is from ten years back, another four years back. :face_with_raised_eyebrow:

feelgoodcomics_fgc_skeleton.blend (2.1 MB)

import bge

cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
own = cont.owner

equipped = own['equipped']
target = own['target']
timer = own['timer']
change = own['change']
reload = own['reload']
Grenades = own['Grenades']
Smoke = own['Smoke']
shoot = own['shoot']

collide = cont.sensors['cutscene']

#animations
down_m24 = cont.actuators['downm24']
downGlock = cont.actuators['downGlock']
upm24 = cont.actuators['pickupm24']
upGlock = cont.actuators['pickupGlock']
downGren = cont.actuators['down_Gren']
upGren = cont.actuators['pickup_Gren']
Sdown = cont.actuators['Sdown']
Sup = cont.actuators['Sup']
Kdown = cont.actuators['knifedown']
Kup = cont.actuators['knifeup']
opendoor = cont.actuators['opendoor']

self = scene.objects[own.name]
movement = scene.objects['player']

#sets change == True
if own['target'] != own['equipped'] and reload == False and shoot == True or own['equipped'] == 0 or own['target'] == 6:
    self['change'] = True
elif own['target'] == own['equipped']:
    self['change'] = False

#timer  
if change == True and timer < 30 and movement['door'] == False:
    own['timer'] += 1

if change == True and movement['door'] == True and timer < 45:
    own['timer'] += 1
    
#putting down weapon
if equipped == 0 and change == True and timer == 0:
    cont.activate(downGlock)
if equipped == 1 and change == True and timer == 0:
    cont.activate(down_m24)
if equipped == 2 and change == True and timer == 0:
    cont.activate(downGlock)
if equipped == 3 and change == True and timer == 0:
    cont.activate(downGren)
if equipped == 4 and change == True and timer == 0:
    cont.activate(Sdown)
if equipped == 5 and change == True and timer == 0:
    cont.activate(Kdown)
if equipped == 7 and change == True and timer == 0:
    cont.activate(Kdown)
    
#ends old weapon + animation
if timer == 15 and change == True and equipped == 0:
    cont.deactivate(downGlock)
if timer == 15 and change == True and equipped == 1:
    own.sendMessage("endm24")
    cont.deactivate(down_m24)
if timer == 15 and change == True and equipped == 2:
    own.sendMessage("endglock")
    cont.deactivate(downGlock)
if timer == 15 and change == True and equipped == 3:
    own.sendMessage("endGren")
    cont.deactivate(downGren)
if timer == 15 and change == True and equipped == 4:
    own.sendMessage("endSmoke")
    cont.deactivate(Sdown)
if timer == 15 and change == True and equipped == 5:
    own.sendMessage("endKnife")
    cont.deactivate(Kdown)
if timer == 15 and change == True and equipped == 7:
    own.sendMessage("endchain")
    cont.deactivate(Kdown)
    
#spawn new weapon
if timer == 15 and change == True and target == 1:
    scene.addObject('m24', own, 0)
if timer == 15 and change == True and target == 2:
    scene.addObject('Glock', own, 0)
if timer == 15 and change == True and target == 3:
    scene.addObject('Grenade', own, 0)
if timer == 15 and change == True and target == 4:
    scene.addObject('smoke', own, 0)
if timer == 15 and change == True and target == 5:
    scene.addObject('knife', own, 0)
if timer == 15 and change == True and target == 7:
    scene.addObject('chain', own, 0)

#picking up weapon
if timer > 15 and timer < 30 and change == True and target == 1:
    cont.activate(upm24)
if timer > 15 and timer < 30 and change == True and target == 2:
    cont.activate(upGlock)  
if timer > 15 and timer < 30 and change == True and target == 3:
    cont.activate(upGren)
if timer > 15 and timer < 30 and change == True and target == 4:
    cont.activate(Sup)
if timer > 15 and timer < 30 and change == True and target == 5:
    cont.activate(Kup)
if timer > 15 and timer < 30 and change == True and target == 7:
    cont.activate(Kup)
if timer > 15 and timer < 45 and change == True and movement['door'] == True and target == 6:
    cont.activate(opendoor)

#open sesame
doorsound = cont.actuators['doorsound']
if timer == 30 and change == True and movement['door'] == True and target == 6:
    select = collide.hitObjectList[0]
    own.sendMessage("opendoor", "", str(select))
    cont.activate(doorsound)
#resetting properties
if timer == 30 and change == True and own['equipped'] != own['target'] and movement['door'] == False:
    own['equipped'] = own['target']
    own['timer'] -= 31
    cont.deactivate(upm24)
    cont.deactivate(upGren)
    cont.deactivate(upGlock)
    cont.deactivate(Sup)
    cont.deactivate(Kup)

#resetting after cutscene
if timer == 45 and change == True and movement['door'] == True and own['equipped'] != 6:
    own['equipped'] = own['target']
    movement['door'] = False
    movement['control'] = True
    movement['cutscene'] = 0
    self['timer'] = 0
    own.sendMessage("restorecontrol")
    cont.deactivate(opendoor)
    own['target'] = 2
    
#intial weapon selection
if equipped == 0:
    self['target'] = 2

The animation does work to change to nothing on key 7.

I did try adding an action brick for the 7 key by itself, linked to action knife animation brick. Probably isn’t the solution.

If I add this, it changes to the position I setup the arms. So I removed that. ```
Kup = cont.actuators[‘knifeup’]

As chain instead of knife.

These videos give a view of what I’ve got working.

And the following, the bricks. I think the brick example 7 and action knife, and property 7 isn’t correct.

Or any animation could do, just changing the key word of the object name, going up and down in the animation effect.

My alternative is to start removing bricks to see what is what. :sweat_smile:

The 7 And action brick knife, and property 7 just load the hand gun in the beginning, where the FP is holding it, and you can zoom in with the right click button, so it must mean, that the code is not regisering that, since that alone is a brick connection. If I add chain word to the knife code snippet, nothing loads. So I don’t know what exactly is the correct link to getting the new item to load.

I need a few pointers.

The current file.

i think people would hardly be able to help you with that logic mess. Come with more generic questions. People will probably not download the file and debug it for you.

The guy who made that demo makes wonderful bge tutos, but for this fps demo he didn’t took time to make a solid architecture even if he delivered here something that looks descent .

So if you are new, you could learn things by studying his file, but you will progress better in BGE if you start your own project from scratch.

Here, i’m afraid, you will learn “bad pratice” that many people do.

I have done the best I can, changing the code and having a new object add in, using an existing animation of up and down, I thought may work. It works partly, where the key 7 briefly changes and nothing loads.

I did try and add in some objects for AI, but they won’t appear. So I don’t know about that. What there is there, there is potential. I was thinking, what there is, I could use as is, and at some sounds, and a new location, but the location was the problem since it would be a plane setting.

The top section is a good mini level, getting the new object loading is one, then next is the effect, and a basic animation for the use of the object. The object alone I had to remove so many faces, and vertices to keep the game running smooth. It doesn’t matter about that, just that it loads and I can begin some sort of effect, but as for the objects for some characters, stuck with the basic one in the game.

I did remove some of the bricks, but it didn’t change anything concerning the object add in, my guess is, it may not be that the problem. All the bricks for the object point to some of the python scripts, so it can’t be that difficult.

well, i don’t really understand your reply but just have a look here. Just at looking of the name of the bricks , you can see that everything was made on the fly

and that some controllers contain things like “grenade.py” or “senddoor.py” … it just shows there’s no structure or design in the architecture. It’s like features he added one after another without organizing the whole.

I was just saying that you will quickly reach a roof of unnecessary complications without improving the complexity.

But im sure you will quickly figure out what im talking about when you will start to try to modify the project and figure out that many things have to be think again

I have looked, and viewed the tutorial videos, and seen where some of the bricks connect to, so change.py as an example, all items connect to a number of them. So the 7 key will load an item, but it is removed, so nothing shows. I am not sure, why that is. Using the same up and down should load the new item, it is also parented to the gunspawn. So the item is in another layer as the other items are and it loads once a key is pressed. That was my goal, in order to edit the file, I needed a new item.

chain object.

import bge

cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
own = cont.owner

equipped = own[‘equipped’]
target = own[‘target’]
timer = own[‘timer’]
change = own[‘change’]
reload = own[‘reload’]
Grenades = own[‘Grenades’]
Smoke = own[‘Smoke’]
shoot = own[‘shoot’]

collide = cont.sensors[‘cutscene’]

#animations
down_m24 = cont.actuators[‘downm24’]
downGlock = cont.actuators[‘downGlock’]
upm24 = cont.actuators[‘pickupm24’]
upGlock = cont.actuators[‘pickupGlock’]
downGren = cont.actuators[‘down_Gren’]
upGren = cont.actuators[‘pickup_Gren’]
Sdown = cont.actuators[‘Sdown’]
Sup = cont.actuators[‘Sup’]
Kdown = cont.actuators[‘knifedown’]
Kup = cont.actuators[‘knifeup’]
opendoor = cont.actuators[‘opendoor’]

self = scene.objects[own.name]
movement = scene.objects[‘player’]

#sets change == True
if own[‘target’] != own[‘equipped’] and reload == False and shoot == True or own[‘equipped’] == 0 or own[‘target’] == 6:
self[‘change’] = True
elif own[‘target’] == own[‘equipped’]:
self[‘change’] = False

#timer
if change == True and timer < 30 and movement[‘door’] == False:
own[‘timer’] += 1

if change == True and movement[‘door’] == True and timer < 45:
own[‘timer’] += 1

#putting down weapon

if equipped == 5 and change == True and timer == 0:
cont.activate(Kdown)
if equipped == 7 and change == True and timer == 0:
cont.activate(Kdown)

#ends old weapon + animation

if timer == 15 and change == True and equipped == 5:
own.sendMessage(“endKnife”)
cont.deactivate(Kdown)
if timer == 15 and change == True and equipped == 7:
own.sendMessage(“endchain”)
cont.deactivate(Kdown)

#spawn new weapon

if timer == 15 and change == True and target == 5:
scene.addObject(‘knife’, own, 0)
if timer == 15 and change == True and target == 7:
scene.addObject(‘chain’, own, 0)

#picking up weapon

if timer > 15 and timer < 30 and change == True and target == 5:
cont.activate(Kup)
if timer > 15 and timer < 30 and change == True and target == 7:
cont.activate(Kup)
if timer > 15 and timer < 45 and change == True and movement[‘door’] == True and target == 6:
cont.activate(opendoor)

#open sesame
doorsound = cont.actuators[‘doorsound’]
if timer == 30 and change == True and movement[‘door’] == True and target == 6:
select = collide.hitObjectList[0]
own.sendMessage(“opendoor”, “”, str(select))
cont.activate(doorsound)
#resetting properties
if timer == 30 and change == True and own[‘equipped’] != own[‘target’] and movement[‘door’] == False:
own[‘equipped’] = own[‘target’]
own[‘timer’] -= 31
cont.deactivate(upm24)
cont.deactivate(upGren)
cont.deactivate(upGlock)
cont.deactivate(Sup)
cont.deactivate(Kup)

#resetting after cutscene
if timer == 45 and change == True and movement[‘door’] == True and own[‘equipped’] != 6:
own[‘equipped’] = own[‘target’]
movement[‘door’] = False
movement[‘control’] = True
movement[‘cutscene’] = 0
self[‘timer’] = 0
own.sendMessage(“restorecontrol”)
cont.deactivate(opendoor)
own[‘target’] = 2

#intial weapon selection
if equipped == 0:
self[‘target’] = 2

Break it down a little, and item 5, and 7 use the same animation.

I tried using key 7 to load the grenade, and that worked fine. So the method is correct.

The item I used is parented to the gunspawn, so it loads from layer 2 as the other objects. Compared to the grenade the item is at the bottom, I did try moving it up, and rotated it, and also put the origin on the center of the object, but that didn’t change anything. So it loads on the gunspawn, if moved from layer 2 to 1 as the image above in the old post shows. Something to do with the location, could it load but somewhere not in the player’s area. :thinking: