Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

script : give upgrade item to weapon

Page: 1 of 1
 jrc24
07-06-2004, 6:29 PM
#1
hi

how can I give upgrade item to a weapon

I try CreateItemOnObject(oWeapon, "upgrade_item")

but I think it is not the right way because it doesn t work correctly, the weapon get the upgrade item but if I go to see in the weapon wich upgrade item is installed, the upgrade item slot of upgrade item installed by my script is grayed (can t see the upgrade item) and I can t uninstall the upgrade item

and I would try ActionEquipItem but there is no slot for upgrade item of weapon, I think

if somebody know

thanks
 Darth333
07-06-2004, 7:32 PM
#2
I think you could try using functions like:

EffectBlasterDeflectionIncrease(int nChange);
effect EffectDamageDecrease(int nPenalty, int nDamageType=DAMAGE_TYPE_UNIVERSAL);

Combined with ApplyEffectToObject
(search nwscript.nss for more functions)

But I never tried it and it may not work.


Other most possible solution would be to create a new .uti file with an object that has the stats you wish and use a script like the one I give you the other day to replace the old item:

void main()
{
object oNPC=GetObjectByTag("npc_name");
object oOldobject = GetItemInSlot(INVENTORY_SLOT_RIGHTWEAPON,OBJECT_SE
LF);
object oNewobject = CreateItemOnObject("my_item_name",OBJECT_SELF);
if (GetIsObjectValid (oOldobject))
{
DestroyObject(oOldobject);
}

AssignCommand(oNPC,ActionEquipItem(oNewobject,INVE
NTORY_SLOT_RIGHTWEAPON,TRUE));

}

Hope this helps :)
 jrc24
07-07-2004, 6:34 AM
#3
I done that, this script find wich upgrade items is installed in the weapon in every hand, and replace these upgrade items when recreate weapon after destruction.

but with CreateItemOnObject :

for exemple if vibrations cell was installed in my weapon (or other upgrade item), vibrations cell is replaced in the new weapon but when I open workbench screen, I see vibations cell slot, empty but grayed and I can t use this slot. I think, it works but it is not the right way to do that.


void main() {
int nSlot=(INVENTORY_SLOT_RIGHTWEAPON);
int nSlotb=(INVENTORY_SLOT_LEFTWEAPON);
object oNPC=GetObjectByTag("Zaalbar");
object oOldright=GetItemInSlot(nSlot, OBJECT_SELF);
object oOldleft=GetItemInSlot(nSlotb, OBJECT_SELF);
object oNewobject=CreateItemOnObject("jr_w_vbroswrd01", OBJECT_SELF);
string sOldleft=GetTag(oOldleft);
string sOldright=GetTag(oOldright);
object oNewleft=CreateItemOnObject(sOldleft, OBJECT_SELF);
object oNewright=CreateItemOnObject(sOldright, OBJECT_SELF);
object oOldupgradea=GetItemPossessedBy(oOldleft, "g_i_upgrade007");
object oOldupgradeb=GetItemPossessedBy(oOldleft, "g_i_upgrade008");
object oOldupgradec=GetItemPossessedBy(oOldleft, "g_i_upgrade009");
object oOldupgradeaa=GetItemPossessedBy(oOldright, "g_i_upgrade007");
object oOldupgradebb=GetItemPossessedBy(oOldright, "g_i_upgrade008");
object oOldupgradecc=GetItemPossessedBy(oOldright, "g_i_upgrade009");
if (GetTag(oOldleft)=="g_w_vbroswrd05") {
AssignCommand(oNPC, ActionUnequipItem(oOldleft, TRUE));
AssignCommand(oNPC, ActionUnequipItem(oOldright, TRUE));
AssignCommand(oNPC, ActionEquipItem(oNewright, nSlot, TRUE));
AssignCommand(oNPC, ActionEquipItem(oNewobject, nSlotb, TRUE));
if (GetIsObjectValid(oOldupgradea)==TRUE) {
CreateItemOnObject("g_i_upgrade007", oNewobject);
}
if (GetIsObjectValid(oOldupgradeb)==TRUE) {
CreateItemOnObject("g_i_upgrade008", oNewobject);
}
if (GetIsObjectValid(oOldupgradec)==TRUE) {
CreateItemOnObject("g_i_upgrade009", oNewobject);
}
if (GetIsObjectValid(oOldupgradeaa)==TRUE) {
CreateItemOnObject("g_i_upgrade007", oNewright);
}
if (GetIsObjectValid(oOldupgradebb)==TRUE) {
CreateItemOnObject("g_i_upgrade008", oNewright);
}
if (GetIsObjectValid(oOldupgradecc)==TRUE) {
CreateItemOnObject("g_i_upgrade009", oNewright);
}
}
if (GetTag(oOldleft)!="g_w_vbroswrd05") {
AssignCommand(oNPC, ActionUnequipItem(oOldleft, TRUE));
AssignCommand(oNPC, ActionUnequipItem(oOldright, TRUE));
AssignCommand(oNPC, ActionEquipItem(oNewobject, nSlot, TRUE));
AssignCommand(oNPC, ActionEquipItem(oNewleft, nSlotb, TRUE));
if (GetIsObjectValid(oOldupgradeaa)==TRUE) {
CreateItemOnObject("g_i_upgrade007", oNewobject);
}
if (GetIsObjectValid(oOldupgradebb)==TRUE) {
CreateItemOnObject("g_i_upgrade008", oNewobject);
}
if (GetIsObjectValid(oOldupgradecc)==TRUE) {
CreateItemOnObject("g_i_upgrade009", oNewobject);
}
if (GetIsObjectValid(oOldupgradea)==TRUE) {
CreateItemOnObject("g_i_upgrade007", oNewleft);
}
if (GetIsObjectValid(oOldupgradeb)==TRUE) {
CreateItemOnObject("g_i_upgrade008", oNewleft);
}
if (GetIsObjectValid(oOldupgradec)==TRUE) {
CreateItemOnObject("g_i_upgrade009", oNewleft);
}
}
SetLocalBoolean(GetObjectByTag("Zaalbar"),1,TRUE);
}


I search in nwscript.nss file and I find nothing but perhaps I done a bad search, I will search again.

I search a script corresponding to workbench use, because the workbench do the thing that I want but I don t find that.

If you get some informations later, tell me

thanks
 tk102
07-07-2004, 10:38 AM
#4
Hey Darth333, look at this guy. I think jrc24 has emerged as the new script-slinger in town. :D

Wish I could be more help, jrc24. If I find something I'll let you know.
 Darth333
07-07-2004, 10:54 AM
#5
Originally posted by tk102
Hey Darth333, look at this guy. I think jrc24 has emerged as the new script-slinger in town. :D
:D :D :D et en plus il parle franŠ·ais :D

Hey JRC24 I think I found something interesting here but i haven't tried it yet (and have no means of testing it where i am right now).
Perhaps you could try using these inventory slots for the upgrades ( i think they correspond to weapon upgrades but I am not sure):

INVENTORY_SLOT_CWEAPON_L
INVENTORY_SLOT_CWEAPON_R
INVENTORY_SLOT_CWEAPON_B
 jrc24
07-08-2004, 3:26 PM
#6
that does not seem to be the good solution

thank you nevertheless

I continue to seek through

if you get informations later....thanks
Page: 1 of 1