(08-01-2012, 03:02 PM)SilentStriker Wrote: else if works and I don't think that part of the script is your problem. It has something to do with a Checkvalue function
Te pongo todo el el script, ya he arreglado lo de CheckValue ahora me da otro FATAL ERROR que es: main(86,2) Unexpected end of file
Script :
////////////////////////////
// Run first time starting map
void OnStart()
{
}
void SixLevers(string &in asEntity, int alState)
{
/*Set values depending on up/down postion or 0 for middle
*/
if(alState == -1){
if(asEntity == "lever_machine_lever01_1") SetLocalVarInt("up_"+asEntity, 3);
else if(asEntity == "lever_machine_lever01_2") SetLocalVarInt("up_"+asEntity, 3);
else if(asEntity == "lever_machine_lever01_3") SetLocalVarInt("up_"+asEntity, 5);
else if(asEntity == "lever_machine_lever01_4") SetLocalVarInt("up_"+asEntity, 1);
else if(asEntity == "lever_machine_lever01_5") SetLocalVarInt("up_"+asEntity, 2);
else if(asEntity == "lever_machine_lever01_6") SetLocalVarInt("up_"+asEntity, 4);
CheckValue(asEntity);
AddDebugMessage("Lever Min & up value: " + GetLocalVarInt("up_value"), false);
}
else if(alState == 1){
if(asEntity == "lever_machine_lever01_1") SetLocalVarInt("down_"+asEntity, 1);
else if(asEntity == "lever_machine_lever01_2") SetLocalVarInt("down_"+asEntity, 5);
else if(asEntity == "lever_machine_lever01_3") SetLocalVarInt("down_"+asEntity, 6);
else if(asEntity == "lever_machine_lever01_4") SetLocalVarInt("down_"+asEntity, 5);
else if(asEntity == "lever_machine_lever01_5") SetLocalVarInt("down_"+asEntity, 2);
else if(asEntity == "lever_machine_lever01_6") SetLocalVarInt("down_"+asEntity, 2);
CheckValue(asEntity);
AddDebugMessage("Lever Max & down value: " + GetLocalVarInt("down_value"), false);
}
else if(alState == 0){
SetLocalVarInt("up_"+asEntity, 0);
SetLocalVarInt("down_"+asEntity, 0);
AddDebugMessage("Lever Mid", false);
}
/*All rods correct
*/
if(GetLocalVarInt("up_value") == 8 && GetLocalVarInt("down_value") == 8){
SetMessage("Ch01Level13", "EvenFlow", 0);
SetLocalVarInt("SticksOK", 1);
for(int i=1;i<7;i++)
SetLeverStuckState("machine_lever_"+i, GetLeverState("machine_lever_"+i), true);
for(int i=1;i<=6;i++){
CreateParticleSystemAtEntity("FlowP"+i, "ps_steam.ps", "FlowParticles_"+i, true);
PlaySoundAtEntity("FlowS"+i, "13_steam", "FlowParticles_"+i, 0.5, true);
}
PlaySoundAtEntity("done"+asEntity, "13_flow_done", asEntity, 0.0f, false);
}
}
/* Set value to 0 the add all the values from the levers to see sum of lever posotions*/
void CheckValue(string sEntity)
{
PlaySoundAtEntity("s"+sEntity, "lever_mech_min_max", sEntity, 0.0f, false);
SetLocalVarInt("up_value", 0);
SetLocalVarInt("down_value", 0);
for(int i=1;i<=6;i++){
AddLocalVarInt("up_value", GetLocalVarInt("up_machine_lever_+i));
AddLocalVarInt("down_value", GetLocalVarInt("down_machine_lever_"+i));
}
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}