So I finally got my little mod working, except now there's one problem:
object oArmor = CreateItemOnObject(R"gen_im_arm_cht_lgt_rlr.uti",GetObjectByTag("bhn200ip_chest_pc")); object oBoots = CreateItemOnObject(R"gen_im_arm_bot_lgt_rlr.uti",GetObjectByTag("bhn200ip_chest_pc")); object oGloves = CreateItemOnObject(R"gen_im_arm_glv_lgt_ltr.uti",GetObjectByTag("bhn200ip_chest_pc")); object oBow = CreateItemOnObject(R"gen_im_wep_rng_lbw_lbw.uti",GetObjectByTag("bhn200ip_chest_pc")); object oDagger1 = CreateItemOnObject(R"gen_im_wep_mel_dag_dag.uti",GetObjectByTag("bhn200ip_chest_pc"));
Not sure why, but when I go to loot the chest, I have five of every item inside. It doesn't increase the amount if I reload, it's just always five. I tried doing ),1); at the end but that didn't work.
How can I get it to spawn only one of each item?
Removing duplicates of an item from a container
Débuté par
Jsmith0730
, déc. 22 2009 11:51
#1
Posté 22 décembre 2009 - 11:51
#2
Posté 23 décembre 2009 - 02:57
Where are these lines of code? Are they tied to the spawn event of the container? Maybe they are executed for several events. The error does not seem to be in these lines themselves.
If you like to improve the code, you could declare the object variable first, then use it later on:
object oChest = GetObjectByTag("bhn200ip_chest_pc");
object oArmor = CreateItemOnObject(R"gen_im_arm_cht_lgt_rlr.uti",oChest);
object oGloves = CreateItemOnObject(R"gen_im_arm_glv_lgt_ltr.uti",oChest);
Similar lines for the other items (oChest line only once). It reduces potential problems if you change the code later on. Just a suggestion though.
If you like to improve the code, you could declare the object variable first, then use it later on:
object oChest = GetObjectByTag("bhn200ip_chest_pc");
object oArmor = CreateItemOnObject(R"gen_im_arm_cht_lgt_rlr.uti",oChest);
object oGloves = CreateItemOnObject(R"gen_im_arm_glv_lgt_ltr.uti",oChest);
Similar lines for the other items (oChest line only once). It reduces potential problems if you change the code later on. Just a suggestion though.
Modifié par Magic, 23 décembre 2009 - 02:58 .
#3
Posté 23 décembre 2009 - 03:11
Magic wrote...
Where are these lines of code? Are they tied to the spawn event of the container? Maybe they are executed for several events. The error does not seem to be in these lines themselves.
The lines are indeed fine, and are most likely simply executed several times.
That being said, we folks will need a more complete code excerpt before we're able to actually point the mistake out.





Retour en haut






