Jump to content

Home

Syntax Error on a Script


harIII

Recommended Posts

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?

Link to comment
Share on other sites

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)); [/Quote]

Link to comment
Share on other sites

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));

 

} [/Quote]

Link to comment
Share on other sites

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));
    } 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Forgot the void main(){ ? :)

[color="Red"]void main(){[/color]
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)); 

}

Link to comment
Share on other sites

Oh,ok are you using the res_referance value for these;

object oLS2 = CreateItemOnObject("[color="Red"]storm_helmet[/color]", oPC, 1, 1); 
object oLS = CreateItemOnObject("[color="red"]storm_armour[/color]", 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));

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...