Hello, i'm trying to add weapon for my "handmade job system" on database in game like this:
weapon = $dataWeapons[2] // it's my "blank weapon"
createweapon = weapon
createweapon.id = $dataWeapons.length;
$dataWeapons[$dataWeapons.length] = createweapon //add newweapon on database
$gameVariables.setValue(241, createweapon)
ID Result is = 3001 here, everything is normal.
When i create a new weapon again, the console show me 3002, good again. But when i see back the previous id the "3001 id weapon" show the same 3002 ID too.
Same problem with $dataWeapons[2] is changed too... When i check the id, the console show "3002", everything who use my blank weapon have the same Id..
How i can add new weapon ingame without modifying my blank weapon, and avoiding the "all new weapon use the same ID"?
weapon = $dataWeapons[2] // it's my "blank weapon"
createweapon = weapon
createweapon.id = $dataWeapons.length;
$dataWeapons[$dataWeapons.length] = createweapon //add newweapon on database
$gameVariables.setValue(241, createweapon)
ID Result is = 3001 here, everything is normal.
When i create a new weapon again, the console show me 3002, good again. But when i see back the previous id the "3001 id weapon" show the same 3002 ID too.
Same problem with $dataWeapons[2] is changed too... When i check the id, the console show "3002", everything who use my blank weapon have the same Id..
How i can add new weapon ingame without modifying my blank weapon, and avoiding the "all new weapon use the same ID"?