Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
RE: LocalVar
Try something like this:
void OnStart()
{
SetLocalVarInt("InsaneImages", 0);
AddEntityCollideCallback("Player", "AreaActivateInteract", "ActivateInsaneImages", true, 1);
}
void ActivateInsaneImages(string &in asParent, string &in asChild, int alState)
{
for(int i=1;i<=3;++i)
SetEntityPlayerInteractCallback("Flask_" + i, "AddLocalNumber", false);
}
void AddLocalNumber(string &in asEntity)
{
AddLocalVarInt("InsaneImages", 1);
CheckArmor();
}
void CheckArmor()
{
if(GetLocalVarInt("InsaneImages") == 1)
{
SetEntityActive("armour_nice_complete_1", true);
}
if(GetLocalVarInt("InsaneImages") == 2)
{
SetEntityActive("armour_nice_complete_2", true);
}
if(GetLocalVarInt("InsaneImages") == 3)
{
SetEntityActive("armour_nice_complete_3", true);
}
}
The only problem I see (with the original) is that since the callback doesn't remove automatically, the player can interact with 1 flask 3 times and achieve the same effect. You would have to make 3 separate callbacks (1 for each flask) to get rid of that problem.
Hope that helped :o
I rate it 3 memes.
(This post was last modified: 09-11-2012, 11:17 PM by Adny.)
|
|
09-11-2012, 11:16 PM |
|