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
LocalVar
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#2
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
Find


Messages In This Thread
LocalVar - by i3670 - 09-11-2012, 10:43 PM
RE: LocalVar - by Adny - 09-11-2012, 11:16 PM
RE: LocalVar - by Tomato Cat - 09-11-2012, 11:16 PM
RE: LocalVar - by FlawlessHappiness - 09-12-2012, 07:01 AM



Users browsing this thread: 1 Guest(s)