Getting "'int' object has no attribute '_getitem_'" error

Users who are viewing this thread

Ok, so I'm trying to add muskets into my pet mod, and I've succeeded in creating the weapon itself, and want to add the muzzle, smoke and sound effects to the gun. I copy-pasted the effects code from the native flintlock pistol, but when I'm trying to compile, here's what I'm getting:
Loading module... FAILED.
MODULE `scripts` ERROR:
Traceback (most recent call last):
File "compile.py", line 109, in <module>
from module_scripts import *
File "C:\Users\Administrator\Desktop\Xmastown source\module_scripts.py", line
25, in <module>
from module_items import *
File "C:\Users\Administrator\Desktop\Xmastown source\module_items.py", line 13
03, in <module>
[(ti_on_weapon_attack, [(play_sound,"snd_pistol_shot"),(position_move_x, pos
1,27),(position_move_y, pos1,36),(particle_system_burst, "psys_pistol_smoke", po
s1, 15)])]],
TypeError: 'int' object has no attribute '__getitem__'

COMPILATION FAILED.
Any particular reason as to why it doesn't see the native code? I've tried to check if the flintlock pistol's entry has anything different, and apart from it being type_pistol (and the associated shoot_pistol and reload_pistol variables), I really don't see any difference. Is it that these effects are coded to only read pistol items?

Thank you.
 
[(ti_on_weapon_attack, [(play_sound,"snd_pistol_shot"),(position_move_x, pos
1,27),(position_move_y, pos1,36),(particle_system_burst, "psys_pistol_smoke", po
s1, 15)])]],

recount these square brackets (2 vs 3).
That's just it, I copy-pasted the code from the flintlock pistol, and since I'm using Notepad++ I can see which bracket closes what.

["coal_shooter", "Coal Shooter", [("mortar_1",0)], itp_type_musket |itp_merchandise|itp_primary|itp_next_item_as_melee|itp_two_handed, itcf_shoot_musket|itcf_reload_musket| itcf_carry_crossbow_back,
349 , weight(4.5)|spd_rtng(41) | shoot_speed(6:cool: | thrust_damage(58 ,pierce)|max_ammo(1),imodbits_crossbow
[(ti_on_weapon_attack, [(play_sound,"snd_pistol_shot"),(position_move_x, pos1,27),(position_move_y, pos1,36),(particle_system_burst, "psys_pistol_smoke", pos1, 15)
])]],

Just in case:
Last square bracket (green) is for "coal_shooter";
Second square bracket (red) is for "ti_on_weapon_attack";
Round bracket (blue) is also for "ti_on_weapon_attack";
Next square bracket (purple) is for "play_sound";
Last round bracket (yellow) is for "particle_system_burst".
 
Back
Top Bottom