Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Restoring broken item
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#11
RE: Restoring broken item

Ok, as a temporary measure, in the CreateEntity function try iterating the names yourself with an integer, so your creating "potash_"+x and adding 1 to x each time. Then you can set up a For loop for the collide callback to set, say, 10, which gives you a testable situation - if 10 work then they stop, you know that you're having iterated the names can solve the problem, so set up as many as you think you need
Kind of a hacky solution but hey, if it works it works right?

void OnStart()
{
     for (int x=1;x<=10;x++) AddEntityCollideCallback("potash_"+x, "BlowPillarArea", "PillarVar", false, 0);
     SetLocalVarInt("PotAshNumber", 1);
}

...

void CheckGold(string &in asTimer)
{
     ...

     int x = GetLocalVarInt("PotAshNumber");
     CreateEntityAtArea("potash_"+x, "crystal_rock_02.ent", "FulmGoldArea", false);
     AddLocalVarInt("PotAshNumber", 1);

(This post was last modified: 08-06-2013, 11:00 AM by Adrianis.)
08-06-2013, 10:53 AM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#12
RE: Restoring broken item

Yeah, I will give that a try later tonight! I say if they haven't solved the puzzle after 10 tries, than they don't really deserve anymore tries. Big Grin

Thank you very much!

08-07-2013, 01:40 AM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#13
RE: Restoring broken item

(Sorry for the double post)

I tried what you said, but it's still not working, and I can't determine why. Destroying the first potash ("potash_1") causes a second one to pop up, but no more are created after that.

PHP Code: (Select All)
void CheckGold(string &in asTimer)
{
    
int x GetLocalVarInt("PotAshNumber");
    if (
GetPropHealth("potash_"+x) < 1)
    {
        if (
GetLocalVarInt("Pillar") == 1)
        {
            
AddTimer(""0.0f"StartScene");
            
SetEntityActive("SignArea_1"false);
        }
        else
        {
            
AddLocalVarInt("PotAshNumber"1);
            if (
GetLocalVarInt("PotAshNumber") < 11)
            {
                
CreateEntityAtArea("potash_"+x"crystal_rock_02.ent""FulmGoldArea"false);
                
AddTimer("check"0.1f"CheckGold");
            }
        }
    }
    else
    {
        
AddTimer("check"0.1f"CheckGold");
    }


08-07-2013, 04:30 AM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#14
RE: Restoring broken item

Damn ok, I'll test this out when I get home later on, I've got debugging so should be able to tell whats going on with the names.

In the meantime, could you post the full code?

Also,
Quote: Destroying the first potash ("potash_1") causes a second one to pop up, but no more are created after that
Without knowing what you puzzle actually is, does the second potash activate the collide callback correctly?
(if its hard to tell, you can 'debug' it (old-school style) by including a light in your map to turn on in the callback, so you know whether that code is being executed)

(This post was last modified: 08-07-2013, 09:40 AM by Adrianis.)
08-07-2013, 09:40 AM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#15
RE: Restoring broken item

(08-07-2013, 09:40 AM)Adrianis Wrote: Without knowing what you puzzle actually is, does the second potash activate the collide callback correctly?
(if its hard to tell, you can 'debug' it (old-school style) by including a light in your map to turn on in the callback, so you know whether that code is being executed)

Nope, it looks like the second potash doesn't activate the callback. Here's the entire puzzle, basically: The potash explodes when it's thrown against something, and the goal is to throw it against a pillar to cause it to collapse. If they accidently drop it or throw it and cause it to explode somewhere else, I'd like to respawn the potash to give them another shot at it.

Here's the full code for the level:
PHP Code: (Select All)
//////////////////////
////////////////////////////
// Run first time starting map
void OnStart()
{
    
PreloadParticleSystem("ps_orb_room_alex_die.ps");
    
PreloadParticleSystem("ps_hit_rock.ps");
    
PreloadParticleSystem("ps_break_prison_tunnel.ps");
    
PreloadSound("explosion_rock_large.snt");
    
PreloadSound("29_crumble.snt");
    
SetMapDisplayNameEntry("mithraeum");
    
SetEntityPlayerLookAtCallback("BlowPillarArea""PillarMessage"true);
    
PlayPropAnimation("alexander_1""Death"0.3false"");
    
AddTimer("rumble"RandFloat(15.0f25.0f), "TimerRumble");
    
SetEntityConnectionStateChangeCallback("elevator_lever_1""Switch1");
    
SetEntityConnectionStateChangeCallback("elevator_lever_2""Switch2");
    
AddTimer("check"0.0f"CheckGold");
    
AddUseItemCallback("""flask01_orpiment""potash""FormGold"false);
    for(
int x=1;x<=10;x++)
    {
        
AddEntityCollideCallback("potash_"+x"BlowPillarArea""PillarVar"false0);
    }
    
SetLocalVarInt("PotAshNumber"1);
    
SetEntityPlayerInteractCallback("orb""GotOrb"true);
    
AddEntityCollideCallback("Player""HaakArea""ActivateHaak"true1);
    
AddCombineCallback("""chemical_container_1""vitriol""AquaRegia"true);
    
AddCombineCallback("""flask01_aqua_regia""gold""AuricHydro"true);
    
AutoSave();
}

////////////////////////////
// Run when entering map
void OnEnter()
{    
    if(
GetGlobalVarInt("GotOrb") == 0)
    {
        
PlayMusic("TGW_35_anatomy"true150true);
    }
    if(
GetGlobalVarString("Ending") == "Captured")
    {
        
AddTimer(""0.0f"TimerCaptured");
    }
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
    
SetupLoadScreen("LoadingText7""Loading"7"ch7load.jpg");
}

void AquaRegia(string &in asItemAstring &in asItemB)
{
RemoveItem(asItemA); RemoveItem(asItemB);
PlayGuiSound("puzzle_add_chemical"1.0f);
GiveItem("flask01_aqua_regia""flask01_aqua_regia""aqua_regia""flask01_aqua_regia.tga"1);
}

void AuricHydro(string &in asItemAstring &in asItemB)
{
RemoveItem(asItemA); RemoveItem(asItemB);
PlayGuiSound("puzzle_acid"1.0f);
GiveItem("flask01_orpiment""flask01_orpiment""auric_hydroxide""flask01_orpiment.tga"1);
}

void TimerRumble(string &in asTimer)
{
    
StartScreenShake(0.01f3.0f1.0f1.0f);
    
CreateParticleSystemAtEntity("","ps_green_wind_breeze.ps""SmokeArea"false);
    
PlayGuiSound("03_cloud_solo.snt"1.0f);
    
AddTimer("rumble"RandFloat(20.0f45.0f), "TimerRumble");
}

void ActivateHaak(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("college_1"true);
    for (
int i 05i++)
    {
        if (
== 5)
        {
            
0;
        }
        
AddEnemyPatrolNode("college_1""PathNodeArea_"+i0.001f"");
    }
}

///////////////////////
// BRIDGES
////////////////////////

void Switch1(string &in asEntityint alState)
{
    if (
alState == -1)
    {
        if(
GetLocalVarInt("Lift") == 0)
        {
            
SetLeverStuckState("elevator_lever_1", -1true);
            
AddTimer(""0.0"LiftUp");
        }
    }
    if (
alState == 1)
    {
        if(
GetLocalVarInt("Lift") == 1)
        {
            
SetLeverStuckState("elevator_lever_1"1true);
            
AddTimer(""0.0"LiftDown");
        }
    }
}

void Switch2(string &in asEntityint alState)
{
    if (
alState == -1)
    {
        if(
GetLocalVarInt("Lift") == 0)
        {
            
SetLeverStuckState("elevator_lever_2", -1true);
            
AddTimer(""0.0"LiftUp");
        }
    }
    if (
alState == 1)
    {
        if(
GetLocalVarInt("Lift") == 1)
        {
            
SetLeverStuckState("elevator_lever_2"1true);
            
AddTimer(""0.0"LiftDown");
        }
    }
}

void LiftUp(string &in asTimer)
{
    
SetLocalVarInt("Lift"1);
    
SetEntityInteractionDisabled("elevator_lever_1"true);
    
SetEntityInteractionDisabled("elevator_lever_2"true);
    
SetMoveObjectState("bridge_metal_vert_1"1);
    
StartScreenShake(0.005f0.5f0.2f0.6f);
    
PlaySoundAtEntity("""14_elevator_clank""Player"0.5ffalse);
    
PlaySoundAtEntity("bridge1""16_winch_bridge""bridge_metal_vert_1"1.0ftrue);
    
AddTimer(""13.0"TimerStopLift");
}

void LiftDown(string &in asTimer)
{
    
SetLocalVarInt("Lift"0);
    
SetEntityInteractionDisabled("elevator_lever_1"true);
    
SetEntityInteractionDisabled("elevator_lever_2"true);
    
SetMoveObjectState("bridge_metal_vert_1"0);
    
StartScreenShake(0.005f0.5f0.2f0.6f);
    
PlaySoundAtEntity("""14_elevator_clank""Player"0.5ffalse);
    
PlaySoundAtEntity("bridge1""16_winch_bridge""bridge_metal_vert_1"1.0ftrue);
    
AddTimer(""13.0"TimerStopLift");
}

void TimerStopLift(string &in asTimer)
{
    
SetLeverStuckState("elevator_lever_1"0true);
    
SetLeverStuckState("elevator_lever_2"0true);
    
SetEntityInteractionDisabled("elevator_lever_1"false);
    
SetEntityInteractionDisabled("elevator_lever_2"false);
    
StopSound("bridge1"1.0f);
    
PlaySoundAtEntity("""14_elevator_clank""Player"0.5ffalse);
    
StartScreenShake(0.005f0.5f0.2f0.6f);
    
SetLeverInteractionDisablesStuck("elevator_lever_1"true);
}

///////////////////////////////
//Fulminating Gold
///////////////////////////////

void FormGold(string &in asItemstring &in asEntity)
{
    
FadeLightTo("PointLight_2"0.6f0.55f0.05f1.0f, -11);
    
PlaySoundAtEntity("""puzzle_add_chemical""potash"1.0ffalse);
    
SetPropActiveAndFade("potash"false2.0f);
    
SetPropActiveAndFade("potash_1"true1.0f);
    
AddTimer(""1.0f"TimerEndlight");
    
AddTimer("check"0.0f"CheckGold");
    
GiveSanityBoost();
}

void TimerEndlight(string &in asTimer)
{    
    
FadeLightTo("PointLight_2"0.0f0.0f0.0f0.0f, -11);
}

void CheckGold(string &in asTimer)
{
    
int x GetLocalVarInt("PotAshNumber");
    if (
GetPropHealth("potash_"+x) < 1)
    {
        if (
GetLocalVarInt("Pillar") == 1)
        {
            
AddTimer(""0.0f"StartScene");
            
SetEntityActive("SignArea_1"false);
        }
        else
        {
            
AddLocalVarInt("PotAshNumber"1);
            if (
GetLocalVarInt("PotAshNumber") < 11)
            {
                
CreateEntityAtArea("potash_"+x"crystal_rock_02.ent""FulmGoldArea"false);
                
AddTimer("check"0.1f"CheckGold");
            }
        }
    }
    else
    {
        
AddTimer("check"0.1f"CheckGold");
    }


void DoOver(string &in asTimer)
{
    if(
asTimer == "doover1")
    {
        
SetMessage("Ch07Misc""gold"0);
    }
    if(
asTimer == "doover2")
    {
        
PlayGuiSound("intelligencer1_attack_claw"1);
    }
    if(
asTimer == "doover3")
    {
        
PlaySoundAtEntity("""attack_claw_hit.snt""Player"0false);
        
GivePlayerDamage(110.0f"Slash"truetrue);
    }
}

void PillarVar(string &in asParentstring &in asChildint alState)
{
    if (
alState == 1)
    {
        
SetLocalVarInt("Pillar"1);
        
SetLampLit("torch_static01_5"truetrue);
    }
    else if (
alState == -1)
    {
        
SetLocalVarInt("Pillar"0);
        
SetLampLit("torch_static01_5"falsetrue);
    }
}

void StartScene(string &in asTimer)
{
    
SetPlayerJumpDisabled(true);
    
SetPlayerCrouchDisabled(true);
    
SetPlayerRunSpeedMul(0);
    
SetPlayerMoveSpeedMul(0);
    
SetPlayerLookSpeedMul(0.06f);
    
StopMusic(0.0f0);
    
PlayMusic("TGW_35_column.ogg"false0.71.010false);
    
CreateParticleSystemAtEntity("AlexAura""ps_orb_room_agrippa_end_effect.ps""BlowPillarArea_1"false);
    
StartEffectFlash(1.0f1.0f1.0f);
    
FadeOut(2);
    
AddTimer(""2.0f"Teleport");
    
AddTimer(""3.0f"BlowPillar");
}

void Teleport(string &in asTimer)
{
    
TeleportPlayer("PlayerStartArea_4");
    
StartPlayerLookAt("BlowPillarArea"444.4f444.4f"");
}

void BlowPillar(string &in asTimer)
{
    
FadeIn(2);
    
StartPlayerLookAt("CrackArea_5"0.5f0.5f"");
    
StartScreenShake(0.1f,6.0f,4.0f,2.0f);
    
PlaySoundAtEntity("""29_crumble.snt""Player"0false);
    
AddTimer(""5.0f"PillarDone");
    
AddTimer("crack1"0.0f"PillarCrack");
    
AddTimer("crack2"0.6f"PillarCrack");
    
AddTimer("crack3"1.2f"PillarCrack");
    
AddTimer("crack4"2.0f"PillarCrack");
    
AddTimer("crack5"3.4f"PillarCrack");
}

void PillarCrack(string &in asTimer)
{
    if(
asTimer == "crack1")
    {
        
CreateParticleSystemAtEntity("""ps_hit_rock.ps""CrackArea_1"false);
    }
    if(
asTimer == "crack2")
    {
        
CreateParticleSystemAtEntity("""ps_hit_rock.ps""CrackArea_2"false);
    }
    if(
asTimer == "crack3")
    {
        
CreateParticleSystemAtEntity("""ps_hit_rock.ps""CrackArea_3"false);
    }
    if(
asTimer == "crack4")
    {
        
CreateParticleSystemAtEntity("""ps_hit_rock.ps""CrackArea_4"false);
    }
    if(
asTimer == "crack5")
    {
        
CreateParticleSystemAtEntity("""ps_hit_rock.ps""CrackArea_5"false);
    }
}

void BlowPillarArea(string &in asEntityint alState)
{
    if(
alState == -1)
    {
        
SetMessage("Ch07Misc""weak"0);
    }
}

void PillarDone(string &in asTimer)
{
    
StartPlayerLookAt("alexander_1"0.5f0.5f"");
    
FadeLightTo("PointLight_1", -1, -1, -1, -1010.0f);
    
FadeLightTo("SpotLight_1", -1, -1, -1, -1010.0f);
    
FadeLightTo("SpotLight_2", -1, -1, -1, -1010.0f);
    
FadeLightTo("SpotLight_3", -1, -1, -1, -1010.0f);
    
PlaySoundAtEntity("killalex""explosion_rock_large.snt""pillar_gigantic_1"0.0ffalse);
    
SetEntityActive("pillar_gigantic_1"false);
    
SetEntityActive("pillar_gigantic_2"true);
    
CreateParticleSystemAtEntity("""ps_break_prison_tunnel.ps""CrackArea_1"false);
    
CreateParticleSystemAtEntity("""ps_break_prison_tunnel.ps""CrackArea_2"false);
    
CreateParticleSystemAtEntity("""ps_break_prison_tunnel.ps""CrackArea_3"false);
    
CreateParticleSystemAtEntity("""ps_break_prison_tunnel.ps""CrackArea_4"false);
    
CreateParticleSystemAtEntity("""ps_break_prison_tunnel.ps""CrackArea_5"false);
    
SetEntityActive("bridge_torch_1"false);
    
SetEntityActive("bridge_torch_2"false);
    
SetEntityActive("bridge_torch_3"false);
    
SetEntityActive("bridge_torch_4"false);
    
SetEntityActive("bridge_torch_5"true);
    
SetEntityActive("bridge_torch_6"true);
    
SetEntityActive("bridge_torch_7"true);
    
SetEntityActive("bridge_torch_8"true);
    
SetEntityActive("orb_altar_1"false);
    
SetEntityActive("orb_altar_2"true);
    
CompleteQuest("Ritual""Ritual");
    
StartScreenShake(0.22313);
    
SetEntityActive("orb_6_of_7"false);
    
SetEntityActive("orb"true);
    
DestroyParticleSystem("ParticleSystem_1");
    
DestroyParticleSystem("ParticleSystem_2");
    
DestroyParticleSystem("ParticleSystem_3");
    
StopSound("Sound_1"10.0f);
    
StopSound("Sound_2"2.0f);
    
RemoveTimer("rumble");
    
AddTimer(""3.0f"MoriaenSplode");
}

void MoriaenSplode(string &in asTimer)
{
    
SetEntityActive("orb_altar_2"false);
    
SetPropActiveAndFade("alexander_1"false2);
    
DestroyParticleSystem("AlexAura");
    
PlaySoundAtEntity("""27_orb_implode.snt""BlowPillarArea_1"0.0ffalse);
    
CreateParticleSystemAtEntity("AlexExplode","ps_orb_room_alex_die.ps""BlowPillarArea_1"false);
    
CreateParticleSystemAtEntity("AlexExplode2","ps_orb_shockwave.ps""BlowPillarArea_1"false);
    
AddTimer("scene1"5.0f"SceneEnd");
    
AddTimer("scene2"8.0f"SceneEnd");
}

void SceneEnd(string &in asTimer)
{
    if(
asTimer == "scene1")
    {
        
FadeOut(2);
        
SetPropActiveAndFade("bridge_torch_5"false2.0f);
        
SetPropActiveAndFade("bridge_torch_6"false2.0f);
        
SetPropActiveAndFade("bridge_torch_7"false2.0f);
        
SetPropActiveAndFade("bridge_torch_8"false2.0f);
    }
    if(
asTimer == "scene2")
    {
        
TeleportPlayer("PlayerStartArea_5");
        
FadeIn(2);
        
StopPlayerLookAt();
        
SetPlayerJumpDisabled(false);
        
SetPlayerCrouchDisabled(false);
        
SetPlayerMoveSpeedMul(1.0f);
        
SetPlayerRunSpeedMul(1.0f);
        
SetPlayerLookSpeedMul(1.0f);
    }
}

///////////////////////////////
//ORB CAPTURED
///////////////////////////////

void GotOrb(string &in asEntity)
{
    
CheckPoint ("check2""PlayerStartArea_2""Captured""Death""allover");
    
AddEntityCollideCallback("Player""CollegeCharge_1""HullCharge"true1);
    
AddEntityCollideCallback("Player""CollegeCharge_2""HaakCharge"true1);
    
AddEntityCollideCallback("Player""HullArea""ActivateHull"true1);
    
SetGlobalVarInt("GotOrb"1);
    
AutoSave();
}

void ActivateHull(string &in asParentstring &in asChildint alState)
{
    
CheckPoint ("check2""PlayerStartArea_2""Captured""Death""allover");
    
AddTimer(""2.0f"TimerMusic");
    
SetEntityActive("college_2"true);
    for (
int i 06i++)
    {
        if (
== 6)
        {
            
0;
        }
        
AddEnemyPatrolNode("college_2""HullNodeArea_"+i0.001f"");
    }
}

void TimerMusic(string &in asTimer)
{
    
PlayMusic("TGW_35_chase"true1100true);
}

void HullCharge(string &in asParentstring &in asChildint alState)
{
    
ShowEnemyPlayerPosition("college_2");
}

void HaakCharge(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("college_1"false);
    
SetEntityActive("college_3"true);
    
ShowEnemyPlayerPosition("college_3");
}

///////////////////////////////
// CAPTURED ENDING
///////////////////////////////

void Captured(string &in asNameint alCount)
{
    
SetGlobalVarString("Ending""Captured");
    
AddTimer(""0.0f"TimerCaptured");
}

void TimerCaptured(string &in asTimer)
{
    
StopMusic(100);
    
FadeOut(0);
    
SetEntityActive("orb_6_of_8"true);
    
SetPropStaticPhysics("orb_6_of_8"true);
    
SetEntityActive("stone_table_1"true);
    
PlaySoundAtEntity("orbloop""03_orb_loop""orb_6_of_8"0.5ffalse);
    
FadeImageTrailTo(2,1);
    
MovePlayerHeadPos(0, -1.5f010.5f);
    
FadePlayerRollTo(90100100);
    
SetPlayerLookSpeedMul(0.25f);
    
SetPlayerMoveSpeedMul(0.0f);
    
SetLanternDisabled(true);
    
SetPlayerJumpDisabled(true);
    
SetInventoryDisabled(true);
    
SetEntityActive("bridge_torch_5"false);
    
SetEntityActive("bridge_torch_6"false);
    
SetEntityActive("bridge_torch_7"false);
    
SetEntityActive("bridge_torch_8"false);
    
SetEntityActive("orb_altar_2"false);
    
SetEntityActive("college_4"true);
    
AddEnemyPatrolNode("college_4""PathNodeArea_197"60.0f"");
    
PlayMusic("TGW_35_sacrifice"true110true);
    
AddTimer("drag"3.0f"PlayerDrag");
    
AddTimer("sac1"5.0f"TimerSacrifice");
    
AddTimer("sac2"7.5f"TimerSacrifice");
    
AddTimer("sac3"12.0f"TimerSacrifice");
    
AddTimer("sac4"16.0f"TimerSacrifice");
    
AddTimer("sac5"18.0f"TimerSacrifice");
    
AddTimer("sac6"20.0f"TimerSacrifice");
    
AddTimer("sac7"22.0f"TimerSacrifice");
    
AddTimer("sac8"28.0f"TimerSacrifice");
    
AddTimer("sac9"30.0f"TimerSacrifice");
    
AddTimer("sac10"35.0f"TimerSacrifice");
    
AddTimer("sac11"37.0f"TimerSacrifice");
    
FadeIn(2);
}

void PlayerDrag(string &in asTimer)
{
    
AddPlayerBodyForce(80000, -8000false);
    
PlayGuiSound("35_drag.snt"1.0f);
    
AddTimer(asTimer1.5f"PlayerDrag");
}

void TimerSacrifice(string &in asTimer)
{
    if(
asTimer == "sac1")
    {
        
FadeOut(1);
        
PlayGuiSound("react_breath_slow.snt"1.0f);
    }
    if(
asTimer == "sac2")
    {
        
FadeIn(2);
    }
    if(
asTimer == "sac3")
    {
        
FadeOut(2);
        
PlayGuiSound("react_sigh.snt"1.0f);
        
AddEffectVoice("intelligencer_body.ogg""""Ch07Misc""haak"true"college_4"020);
    }
    if(
asTimer == "sac4")
    {
        
PlayGuiSound("35_place.snt"1.0f);
        
RemoveTimer("drag");
        
TeleportPlayer("PlayerStartArea_3");
        
StartPlayerLookAt("orb_6_of_8"1.0f5.0f"");
        
FadePlayerRollTo(0100100);
    }
    if(
asTimer == "sac5")
    {
        
FadeIn(3);
    }
    if(
asTimer == "sac6")
    {
        
StopPlayerLookAt();
    }
    if(
asTimer == "sac7")
    {
        
SetPropStaticPhysics("orb_6_of_8"false);
        
PlayGuiSound("react_breath.snt"1.0f);
    }
    if(
asTimer == "sac8")
    {
        
StopMusic(100);
        
PlayGuiSound("puzzle_acid.snt"1.0f);
        
PlayGuiSound("react_scare.snt"1.0f);
        
StopSound("orbloop"2.0f);
        
StartEffectFlash(0.5f4.0f0.5f);
        
SetPlayerSanity(100.0f);
        
SetSanityDrainDisabled(true);
    }
    if(
asTimer == "sac9")
    {
        
FadeOut(3);
    }
    if(
asTimer == "sac10")
    {
        
PlayGuiSound("react_breath_slow.snt"1.0f);
        
SetEntityActive("college_4"false);
    }
    if(
asTimer == "sac11")
    {
        
AddEffectVoice("moriaen_012.ogg""""Ch07Misc""moriaen12"true"Player"416);
        
SetEffectVoiceOverCallback("EndGame");
    }
}

void EndGame()
{
    
StartCredits("END_anatomy.ogg"false"Ending""MainCredits"5);
}

///////////////////////////////
// FAILED ENDING
///////////////////////////////

void Failed(string &in asNameint alCount)
{
    
SetGlobalVarString("Ending""Failed");
    
ChangeMap("33_prison_redux.map""PlayerStartArea_3""intell_haak/intelligencer1_victory""22_end");


If I need to, I'm starting to like the idea of only giving them a limited amount of tries, in which case I can just make five copies of the necessary script. A lot of clutter, but it should get the job done.

(This post was last modified: 08-07-2013, 08:53 PM by Damascus.)
08-07-2013, 08:51 PM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#16
RE: Restoring broken item

Hmmm ok, well in that case, is there any reason you need these things to actually 'respawn' instead of just having 5 of them lying around?

You could cut out a whole load of these issues by just having 5 copies ready in the level, and you can still keep the relevant functions generic enough to deal with any of those 5, since you will know the names and can iterate through them easily, and if you are limiting the number of tries the player has then there doesn't seem to be any reason (to my limited understanding of your situation) to keep the respawn, other than the excitement and respect of solving a scripting issue Smile

It'll then be clear to the player without any abstract message that they have a limited number of tries.

If you want to keep track of how many have been destroyed then instead of copying the function 5 times you can run the check inside a For loop to iterate through all of the potash's to check their health. Then you have the choice of whether to track them through a single variable adding 1 up to 5 every time one is destroyed, or a variable for each of them depending on which suits your situation better

Would that work?

08-07-2013, 10:27 PM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#17
RE: Restoring broken item

I can't believe I actually didn't think about that. Tongue

I now have three of them (yeah, I keep cutting down on how many times they get to try), lying around, and that pretty much takes away my problem. Thanks for all your help!

08-08-2013, 12:24 AM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#18
RE: Restoring broken item

No problem, glad it's sorted Smile
Once you go far enough down one path it's easy to convince yourself that it has to work like that, it can be hard to look for a whole different approach right?

08-08-2013, 11:11 AM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#19
RE: Restoring broken item

Yeah, once I got going, I was just getting obsessed with making it work. Very easy to get stuck in that train of though. Tongue

08-08-2013, 09:26 PM
Find




Users browsing this thread: 2 Guest(s)