lfnetwork.com mark read register faq members calendar

Thread: Equip item to player
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 12-23-2014, 06:07 AM   #1
darthbdaman
Rookie
 
darthbdaman's Avatar
 
Join Date: Apr 2010
Location: Hoth
Posts: 31
Current Game: TSLRCM
Equip item to player

I am trying to add and equip clothing to the player at the beginning of the game. The adding item part of the script works, as does the execution of the original area script, and the clothes are added to the inventory fine. However the item will not equip. No matter what I try. Increasing the delay, firing the script in different spots. I cannot get items to equip to the PC. Does anyone know a solution?

Code:
void main()
{
    object oEnter = GetEnteringObject();
    
    if ((oEnter == GetFirstPC()) && !GetLocalBoolean(OBJECT_SELF, 2))
    {
        object oItem = CreateItemOnObject("g_a_clothes01", oEnter);
        DelayCommand(0.5, AssignCommand(oEnter, ActionEquipItem(oItem, INVENTORY_SLOT_BODY, TRUE)));

        SetLocalBoolean(OBJECT_SELF, 2, TRUE);
    }
    
    ExecuteScript("k_pend_area01_1", OBJECT_SELF);
}


█∭⊤ị▩ị⊤≣(Φ)█Ξ██████████████████████)
"No game of dejarik can be won without pawns, and this may prove to be a very long game."

Deadly Stream Profile

My Mods:
Jedi from the Start

Last edited by darthbdaman; 12-23-2014 at 06:19 AM.
darthbdaman is offline   you may: quote & reply,
Old 12-23-2014, 07:30 AM   #2
Fair Strides 2
Witty Programmer
 
Fair Strides 2's Avatar
 
Join Date: Jan 2012
Location: Oregon, United States
Posts: 627
Current Game: Master of Orion 2
Helpful! 
Quote:
Originally Posted by darthbdaman View Post
I am trying to add and equip clothing to the player at the beginning of the game. The adding item part of the script works, as does the execution of the original area script, and the clothes are added to the inventory fine. However the item will not equip. No matter what I try. Increasing the delay, firing the script in different spots. I cannot get items to equip to the PC. Does anyone know a solution?

Code:
void main()
{
    object oEnter = GetEnteringObject();
    
    if ((oEnter == GetFirstPC()) && !GetLocalBoolean(OBJECT_SELF, 2))
    {
        object oItem = CreateItemOnObject("g_a_clothes01", oEnter);
        DelayCommand(0.5, AssignCommand(oEnter, ActionEquipItem(oItem, INVENTORY_SLOT_BODY, TRUE)));

        SetLocalBoolean(OBJECT_SELF, 2, TRUE);
    }
    
    ExecuteScript("k_pend_area01_1", OBJECT_SELF);
}
Try adding SetCommandable(1, oEnter); before the equip piece.


All of my mods are available on Deadlystream.

Always remember modders: "Quality= Effort*Time"

KSE 3.3.4 is LIVE!!! Check it out here.

Check out WalkSwitch, the Walkmesh-changing tool!
Fair Strides 2 is offline   you may: quote & reply,
Old 12-23-2014, 01:40 PM   #3
darthbdaman
Rookie
 
darthbdaman's Avatar
 
Join Date: Apr 2010
Location: Hoth
Posts: 31
Current Game: TSLRCM
Quote:
Originally Posted by Fair Strides 2 View Post
Try adding SetCommandable(1, oEnter); before the equip piece.
Didn't fix it

Code:
void main()
{
	object oPC = GetFirstPC();
	object oItem = CreateItemOnObject("g_a_clothes01", oPC);
	SetCommandable(1, oPC);
	DelayCommand(0.5, AssignCommand(oPC, ActionEquipItem(oItem, INVENTORY_SLOT_BODY, TRUE)));
}


█∭⊤ị▩ị⊤≣(Φ)█Ξ██████████████████████)
"No game of dejarik can be won without pawns, and this may prove to be a very long game."

Deadly Stream Profile

My Mods:
Jedi from the Start
darthbdaman is offline   you may: quote & reply,
Old 12-23-2014, 08:20 PM   #4
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 571
Try spawning the item directly on the PC. For example here's how the PC gets Pazaak cards in TSLRCM 1.8.3;

Code:
DelayCommand(0.2, AssignCommand(oPC, ActionEquipItem(CreateItemOnObject("w_pazaak_01", oPC, 1, 1), 4, 1)));
Do note that that completely deletes the item previously in that slot, while that might not be a problem for this mod specifacally, for most you want to spawn the actual used item in the inventory before overriding it like this...
Hassat Hunter is offline   you may: quote & reply,
Old 12-23-2014, 08:29 PM   #5
darthbdaman
Rookie
 
darthbdaman's Avatar
 
Join Date: Apr 2010
Location: Hoth
Posts: 31
Current Game: TSLRCM
Quote:
Originally Posted by Hassat Hunter View Post
Try spawning the item directly on the PC. For example here's how the PC gets Pazaak cards in TSLRCM 1.8.3;

Code:
DelayCommand(0.2, AssignCommand(oPC, ActionEquipItem(CreateItemOnObject("w_pazaak_01", oPC, 1, 1), 4, 1)));
Do note that that completely deletes the item previously in that slot, while that might not be a problem for this mod specifacally, for most you want to spawn the actual used item in the inventory before overriding it like this...
It worked!!!

Thanks


█∭⊤ị▩ị⊤≣(Φ)█Ξ██████████████████████)
"No game of dejarik can be won without pawns, and this may prove to be a very long game."

Deadly Stream Profile

My Mods:
Jedi from the Start
darthbdaman is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > Equip item to player

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:04 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.