09-11-2012, 10:43 PM
Hi got this small problem with my script.
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)
{
if(GetLocalVarInt("InsaneImages") == 1)
{
SetEntityActive("armour_nice_complete_1", true);
SetEntityActive("", true);
}
if(GetLocalVarInt("InsaneImages") == 2)
{
SetEntityActive("armour_nice_complete_2", true);
SetEntityActive("", true);
}
AddLocalVarInt("InsaneImages", 1);
All_Active();
}
void All_Active()
{
if(GetLocalVarInt("InsaneImages") == 3)
{
SetEntityActive("armour_nice_complete_3", true);
SetEntityActive("", true);
}
}
After I've interacted with 1 flask, doesn't matter which one, 1 armour is supposed to get active This, however, doesn't really work exactly to plan.
If I for instance interact with flask_3 first all armours gets activated, regardless if I've interacted with the other 2. If I interact with flask_1 nothing happens, this also goes for flask_2. However if I interact with 1 and then 2 or the other way around only 1 armour gets activated.
Spoiler below!
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)
{
if(GetLocalVarInt("InsaneImages") == 1)
{
SetEntityActive("armour_nice_complete_1", true);
SetEntityActive("", true);
}
if(GetLocalVarInt("InsaneImages") == 2)
{
SetEntityActive("armour_nice_complete_2", true);
SetEntityActive("", true);
}
AddLocalVarInt("InsaneImages", 1);
All_Active();
}
void All_Active()
{
if(GetLocalVarInt("InsaneImages") == 3)
{
SetEntityActive("armour_nice_complete_3", true);
SetEntityActive("", true);
}
}
After I've interacted with 1 flask, doesn't matter which one, 1 armour is supposed to get active This, however, doesn't really work exactly to plan.
If I for instance interact with flask_3 first all armours gets activated, regardless if I've interacted with the other 2. If I interact with flask_1 nothing happens, this also goes for flask_2. However if I interact with 1 and then 2 or the other way around only 1 armour gets activated.