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.

Giving multiple items in script

Page: 1 of 1
 Mandalore_The_Great
11-27-2008, 4:40 PM
#1
How do I give two or more items to myself in a script?
This is a sample script I made up

void main()
{
object oItem=CreateItemOnObject( "g_a_class4002", GetFirstPC());
}

Putting it twice doesn't work. Ideas?
 zbyl2
11-27-2008, 4:44 PM
#2
Use CreateItemOnObject() function more times? :)
void main() {
object oItem=CreateItemOnObject("item", GetFirstPC());
object oItem1=CreateItemOnObject("item1", GetFirstPC());
object oItem2=CreateItemOnObject("item2", GetFirstPC());
}
 Mandalore_The_Great
11-27-2008, 5:26 PM
#3
I meant two or more of the same item
 zbyl2
11-27-2008, 5:29 PM
#4
So put same tag few times...
void main() {
object oItem=CreateItemOnObject("g_a_class4002", GetFirstPC());
object oItem1=CreateItemOnObject("g_a_class4002", GetFirstPC());
object oItem2=CreateItemOnObject("g_a_class4002", GetFirstPC());
}
It will spawn three item with ResRef "g_a_class4002" in PC's inventory.
 Star Admiral
11-27-2008, 5:58 PM
#5
Add an additional parameter with the number of items needed.

void main() {

object oItem = CreateItemOnObject( "g_a_class4002", GetFirstPC(), nAmount );

}

- Star Admiral
 Mandalore_The_Great
11-27-2008, 6:09 PM
#6
where you put nAmount, do I put the N in front of it? or do I just put 2 there?
 Darth333
11-27-2008, 6:29 PM
#7
just replace nAmount by 2 (or any number of items you want to add) :)
 Mandalore_The_Great
11-27-2008, 6:51 PM
#8
alright thanks
one other thing: I'm trying to skin g_w_blstrrfl001 but when I try it in game it just flat out doesn't work. I made two new .uti files, mandalore_rifle and republic_rifle, and I named the file the same exact thing, and I can't get it to work. help?
Edit: oh never mind. I was using a different tut than the one on this site. I'll follow that one
thanks again!
Page: 1 of 1