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.)
|