Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help why wont this work?
oscar1007 Offline
Member

Posts: 64
Threads: 24
Joined: Oct 2011
Reputation: 0
#1
why wont this work?

So, the player har a jar in his inventory, now when he uses that on a body part of a dead grunt, i want the player to get a different jar (filled with blood). This is my script:


void OnStart()
{
AddUseItemCallback("", "hollow_needle_1", "grunt_body_part2_1", "take_blood", true);
}


void take_blood(string &in asItem, string &in asEntity)
{
GiveSanityBoostSmall();
RemoveItem("glass_container_1");
GiveItem("", "glass_container_blood_1", "glass_container_blood_1", "glass_container_blood_1.tga", 1.0f);
}


The "glass_container_blood_1" is in the map, i just placed it so the player cant get it.

And, when i try to use the jar in game, nothing happens. It says cant use item this way or something.

Why wont this script work?

Thanks!

Money can't buy you happiness. But I rather cry in my ferrari.

PROJECT:
http://www.moddb.com/mods/oscar1007
01-28-2012, 02:31 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: why wont this work?

You scripted "hollow_needle_1" to be used on the grunt part, change it to "glass_container_1" and it should work.

Also, your GiveItem line has some errors:

The first argument, which you left empty, needs to be the item's internal name. In this case it looks like you want it to be called "glass_container_blood_1", right?

The second argument is the item's filename. Change it to "glass_container_blood". You don't want the "_1" there because that's just the item's index, which is simply a way to keep track of unique objects in the map, in case you so choose to place multiple ones of the same type.

The third argument is the item type. There are a few different types, but don't worry about that, just change it to "Puzzle".

The fourth argument is the image type. Again, remove the "_1".

The last argument is supposed to be an integer. You put a floating point value. The wiki says it's a float but that begs the question: How do you acquire 1.5f jars? Anyways, I don't think it really matters because if you convert a float to an integer I believe it simply rounds down. But it wouldn't hurt to change it Smile

(This post was last modified: 01-28-2012, 02:53 PM by palistov.)
01-28-2012, 02:49 PM
Find
oscar1007 Offline
Member

Posts: 64
Threads: 24
Joined: Oct 2011
Reputation: 0
#3
RE: why wont this work?

(01-28-2012, 02:49 PM)palistov Wrote: You scripted "hollow_needle_1" to be used on the grunt part, change it to "glass_container_1" and it should work.

Also, your GiveItem line has some errors:

The first argument, which you left empty, needs to be the item's internal name. In this case it looks like you want it to be called "glass_container_blood_1", right?

The second argument is the item's filename. Change it to "glass_container_blood". You don't want the "_1" there because that's just the item's index, which is simply a way to keep track of unique objects in the map, in case you so choose to place multiple ones of the same type.

The third argument is the item type. There are a few different types, but don't worry about that, just change it to "Puzzle".

The fourth argument is the image type. Again, remove the "_1".

The last argument is supposed to be an integer. You put a floating point value. The wiki says it's a float but that begs the question: How do you acquire 1.5f jars? Anyways, I don't think it really matters because if you convert a float to an integer I believe it simply rounds down. But it wouldn't hurt to change it Smile
Thank you. it works now Smile btw, you were suppose to use the needle Wink

Money can't buy you happiness. But I rather cry in my ferrari.

PROJECT:
http://www.moddb.com/mods/oscar1007
01-28-2012, 04:22 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#4
RE: why wont this work?

Ah, ok. It said in your original post "when you use the jar", that's what got me confused hehe.

01-28-2012, 06:15 PM
Find




Users browsing this thread: 1 Guest(s)