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?
Use CreateItemOnObject() function more times? :)
void main() {
object oItem=CreateItemOnObject("item", GetFirstPC());
object oItem1=CreateItemOnObject("item1", GetFirstPC());
object oItem2=CreateItemOnObject("item2", GetFirstPC());
}
I meant two or more of the same item
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.
Add an additional parameter with the number of items needed.
void main() {
object oItem = CreateItemOnObject( "g_a_class4002", GetFirstPC(), nAmount );
}
- Star Admiral
where you put nAmount, do I put the N in front of it? or do I just put 2 there?
just replace nAmount by 2 (or any number of items you want to add) :)
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!