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
"Puzzle"
Froge Offline
Posting Freak

Posts: 2,955
Threads: 176
Joined: Jul 2012
Reputation: 125
#1
"Puzzle"

For the GiveItem function:

GiveItem(string& asName, string& asType, string& asSubTypeName, string& asImageName, float afAmount);

asName - internal name
asType - item to give
asSubTypeName - item name for .lang file
asImageName - image.tga

I'm a bit confused about the difference between asName and asType. I'm thinking asName is the name of the item to give, but then what's asType? In FG's "Inventory.hps" folder I noticed that for asType under all the GiveItem functions they put "Puzzle."

[Image: scaled.php?server=405&filename=puzzleuo.png&res=landing]

So what does that do?

[Image: p229xcq]
08-30-2012, 05:01 AM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#2
RE: "Puzzle"

I'm not sure about your specific question, but if you wish to use that type of function, use GiveItemFromFile:

GiveItemFromFile(string& asName, string& asFileName);


asName = the name you want to give that item
asFileName the entity (.ent) file name

I rate it 3 memes.
08-30-2012, 05:07 AM
Find
Froge Offline
Posting Freak

Posts: 2,955
Threads: 176
Joined: Jul 2012
Reputation: 125
#3
RE: "Puzzle"

Wiki says that function is used almost exclusively for debugging only.

[Image: p229xcq]
08-30-2012, 05:25 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: "Puzzle"

I would argue the second argument relates to the subtype for items.

Tutorials: From Noob to Pro
08-30-2012, 06:27 AM
Website Find
Zaffre Away
Posting Freak

Posts: 867
Threads: 50
Joined: Jul 2012
Reputation: 30
#5
RE: "Puzzle"

Note: This may be inaccurate, as I am relatively new to coding AngelScript and coding in general, but this seems to work fine for what I do.

I usually just use the same for asName and asType. For instance, take a look at a script I'm making for my upcoming story Rising Water. I've bolded the parts that are important.

void OnStart()
{
SetEntityPlayerInteractCallback("stone_hammer_1", "TorchScare", true);
AddUseItemCallback("chemical_container_1", "chemical_container_1", "acid_container_1", "FillJarWithAcid", false);
}

void TorchScare(string &in item)
{
SetLampLit("torch_static01_1", false, true);
GiveSanityDamage(10, true);
PlaySoundAtEntity("react_scare", "react_scare", "Player", 0, false);
PlaySoundAtEntity("enemy_hallucination_disappear", "enemy_hallucination_disappear", "torch_static01_1", 0, false);
}

void FillJarWithAcid(string &in item, string &in entity)
{
GiveSanityBoostSmall();
RemoveItem("chemical_container_1");
GiveItem("chemical_container_full", "chemical_container_full", "AcidPot", "chemical_container_full.tga", 1);
PlaySoundAtEntity("ui_use_oil", "ui_use_oil", "Player", 0, false);
}


void OnEnter()
{
StopMusic(0, 0);
StopMusic(1, 0);
PlayMusic("23_amb02", true, 1, 6, 0, false);
}

void OnLeave()
{

}

For the GiveItem command, I used "chemical_container_1" for both the type and name. When I use the chemical pot on the acid container, it fills with acid with a sound playing, and gives sanity. In fact, I just use the same for type and name for pretty much any command, like the torch scare, where I use the same text input for the PlaySoundAtEntity which plays "enemy_hallucination_disappear" and extinguishes a torch when I pick up a hammer. I also used "react_scare" for the gasp afterward.

Basically speaking, the input I use for type and name are usually identical, and the script functions correctly. I hope this helps you, Chronofox.

EDIT: In case you still don't get it, I'll use a PlaySoundAtEntity example.

PlaySoundAtEntity("react_pant", "react_pant", "Player", 0, false);

I used the same thing for type and name. The first strings of the command are type and name. I used "react_pant" for both the type and name. Type and name are the same thing. They still function correctly.

As of September 2nd, 2014, I've left the Frictional forums. Check my profile for more details.
(This post was last modified: 09-01-2012, 01:37 AM by Zaffre.)
09-01-2012, 01:30 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: "Puzzle"

@Zaffre, i would argue that if the type doesn't match an internal type, it would default to Puzzle.

Tutorials: From Noob to Pro
09-01-2012, 07:34 AM
Website Find




Users browsing this thread: 1 Guest(s)