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.

Syntax Error on a Script

Page: 1 of 1
 harIII
10-26-2009, 6:42 PM
#1
I have absolutely no idea what is going on with this script:

void main() {

int nInventorySlot01 = ("INVENTORY_SLOT_HEAD");
int nInventorySlot02 = ("INVENTORY_SLOT_BODY");


AssignCommand(GetFirstPC(), ActionEquipItem("g_w_lghtsbr01", nInventorySlot01);

AssignCommand(GetFirstPC(), ActionEquipItem("g_w_lghtsbr02", nInventorySlot02);

}

I keep getting an syntax error at line 7 and 9 with the ";" but I don't see anything that I can do with it.

Does anybody have any suggestions?
 Laar_Dha
10-26-2009, 6:55 PM
#2
It looks alike you forgot to close your first set of parentheses at the end of each line. Try it this way.
AssignCommand(GetFirstPC(), ActionEquipItem("g_w_lghtsbr01", nInventorySlot01));

AssignCommand(GetFirstPC(), ActionEquipItem("g_w_lghtsbr02", nInventorySlot02));
 harIII
10-26-2009, 7:12 PM
#3
I'm sorry but I'm still getting some problems, there were about 8 errors; can you try compiling it?
 Laar_Dha
10-26-2009, 8:22 PM
#4
Well, some progress. Errors reduced. The problem seems to be that the ActionEquipItem() commands wants an integer in the first parameter. Unfortunately, I have no I idea how to assign a value that will point to the lightsabers. This is what I came up with so far, but it needs more help. void main()
{

object oPC=GetFirstPC();

AssignCommand(oPC, ActionEquipItem("g_w_lghtsbr01", INVENTORY_SLOT_HEAD));

AssignCommand(oPC, ActionEquipItem("g_w_lghtsbr02", INVENTORY_SLOT_BODY));

}
 harIII
10-26-2009, 8:29 PM
#5
Thanks Laar_Dha, but I still can't get it, if anybody else knows what to do, it will be greatly appreciated.
 DarthStoney
10-26-2009, 9:33 PM
#6
Give this a shot and see if it's what you need,not sure but I don't think lightsabers will go into head or body inventory
void main(){
object oPC=GetFirstPC();
object oLS2 = CreateItemOnObject("g_w_lghtsbr02", oPC, 1, 1);
object oLS = CreateItemOnObject("g_w_lghtsbr01", oPC, 1, 1);
AssignCommand(oPC, ActionEquipItem(oLS, INVENTORY_SLOT_RIGHTWEAPON));
AssignCommand(oPC, ActionEquipItem(oLS2, INVENTORY_SLOT_LEFTWEAPON));
}
 harIII
10-26-2009, 10:02 PM
#7
I know that the items wouldn't go to the head and body but I didn't want to reveal what I going to do because I'm part of a project that hasn't been announced yet.

It's compiling but I'm not seeing the items equip this is the ultimate script. It's suppose to give you the helmet and armor, equip both, and then start a conversation on spawn:

void main() {
object oPC=GetFirstPC();

object oLS2 = CreateItemOnObject("storm_helmet", oPC, 1, 1);
object oLS = CreateItemOnObject("storm_armour", oPC, 1, 1);

AssignCommand(oPC, ActionEquipItem(oLS, INVENTORY_SLOT_BODY));
AssignCommand(oPC, ActionEquipItem(oLS2, INVENTORY_SLOT_HEAD));

}

It's compiling correctly but it's not equiping the items. Any ideas?
 DarthStoney
10-26-2009, 11:10 PM
#8
Forgot the void main(){ ? :)
void main(){
object oPC=GetFirstPC();

object oLS2 = CreateItemOnObject("storm_helmet", oPC, 1, 1);
object oLS = CreateItemOnObject("storm_armour", oPC, 1, 1);

AssignCommand(oPC, ActionEquipItem(oLS, INVENTORY_SLOT_BODY));
AssignCommand(oPC, ActionEquipItem(oLS2, INVENTORY_SLOT_HEAD));

}
 harIII
10-26-2009, 11:43 PM
#9
That wouldn't allow me to compile. I had the void main in the script but simply forgot to copy everything. The problem is that it will compile but won't equip the items in the game.
 DarthStoney
10-27-2009, 7:43 AM
#10
Oh,ok are you using the res_referance value for these;
object oLS2 = CreateItemOnObject("storm_helmet", oPC, 1, 1);
object oLS = CreateItemOnObject("storm_armour", oPC, 1, 1);

or if your using the tag value try this,(not sure if this is correct)
object oLS2 = CreateItemOnObject(GetObjectByTag("storm_helmet") , oPC, 1, 1));
object oLS = CreateItemOnObject(GetObjectByTag("storm_armour") , oPC, 1, 1));
 glovemaster
10-27-2009, 8:30 AM
#11
CreateItemOnObject("storm_helmet", oPC, 1, 1)
This parameter is the name of the UTI file, or the "resref". If you are using the tag, then that's probably the problem. Otherwise there could be a problem with the UTI files you are using.

Hope that helps ;)
 harIII
10-27-2009, 11:17 AM
#12
I still had a problem with a parenthese and fooled around with it for a while but got it working. Here is the final script that I used for those curious:

void main() {

object oPC=GetFirstPC();

object oHelmet = CreateItemOnObject("storm_helmet",oPC);
object oArmour = CreateItemOnObject("storm_armour",oPC);
object oSaber = CreateItemOnObject("g_w_lghtsbr02",oPC);


AssignCommand (oPC, ActionEquipItem(oHelmet, INVENTORY_SLOT_HEAD));
AssignCommand (oPC, ActionEquipItem(oArmour, INVENTORY_SLOT_BODY));
AssignCommand (oPC, ActionEquipItem(oSaber, INVENTORY_SLOT_RIGHTWEAPON));

ExecuteScript("start_zorin", OBJECT_SELF);

}

I think the problem was that the uti files were in a subfolder in the override.
 glovemaster
10-27-2009, 12:02 PM
#13
I think the problem was that the uti files were in a subfolder in the override.

That shouldn't have been a problem, but if it's working now I wouldn't look into it :p
Page: 1 of 1