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
Script Help Some complex issue (SOLVED)
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#7
RE: Some complex issue (SOLVED)

(08-16-2014, 10:41 PM)Neelke Wrote: What I find weird here though is the fact that I had to delete the alLumpIdx premanently. For some reason it refused to work no matter what I changed. [...] The only thing here now that's making it worse is that the random guardian sound might be played at the first step, but I guess I gotta accept that as it is.

That happens for the same reason: aLumpIdx is used near the top of the function, but the script engine doesn't know what it is since it is declared at the very bottom of the function
(where it says "int alLumpIdx = GetLocalVarInt(sEvent);").
But in this case, you can't simly move that line, because the script changes the local variable's value, so you still need to make the call to GetLocalVarInt.

Try something like this:
PHP Code: (Select All)
void TimerGuardian(string &in asTimer)
{
    
float fShadowLumpFadeMul RandFloat(2.03.0);
    
float fShadowNewStep 3.0f;
    
float fDelayToEvent 0.25f;
    
    
string sEvent asTimer//Sets the timer name to the variable name
    
int alLumpIdx GetLocalVarInt(sEvent);
    
    
//If step > 5, set up a random scream (33% chance)
    
int iRandom RandInt(0,2);
    if(
alLumpIdx && iRandom == 0)
    {
        
PlaySoundAtEntity("GuardianScream""25_guardian_ontop.snt""Player"0false);
    }        
    
    
AddLocalVarInt(sEvent1); //Sets a variable to the guardians step
    
string sDmgDeathArea "AreaGuardianKill_" GetLocalVarInt(sEvent); //Sets a new dmg area after each variable
    
    //No need for further steps after 12
    
if(GetLocalVarInt(sEvent) == 12) return;
    
    for(
int i=1i<=6; ++iSetPropActiveAndFade("slime_"+GetLocalVarInt(sEvent)+"_"+itruefShadowLumpFadeMul);
    
GuardianGroundEffect("AreaGuardianEffectFloor_"+GetLocalVarInt(sEvent), true);
    
SetEntityActive(sDmgDeathAreatrue);
    
FadeInGuardianLight("ShadowLight_"+GetLocalVarInt(sEvent));
    
    
StartScreenShake(0.1fRandFloat(0.15f,0.6f), 00.1);
    
PlaySoundAtEntity("GuardianSplashSound""25_guardian_slime_appear.snt""Player"0false);
    
    
AddTimer(sEventfShadowNewStep"TimerGuardian");
    
    
//Set checkpoint
    
CheckPoint("reset""PlayerStartArea_1""ResetGuardian""Hints""DeathByWorm1");
    
    
//Extra events depending on the step
    
alLumpIdx GetLocalVarInt(sEvent);
    
AddTimer("EventStep"+alLumpIdxfDelayToEvent"EventStep"+alLumpIdx);


Unless I missed something, that should work.
These are the parts I changed:
PHP Code: (Select All)
// NOTE: just reorganized the code and added one line
    
string sEvent asTimer//Sets the timer name to the variable name
    
int alLumpIdx GetLocalVarInt(sEvent);  // <-- NOTE: the added line
    
    //If step > 5, set up a random scream (33% chance)
    
int iRandom RandInt(0,2);
    if(
alLumpIdx && iRandom == 0)
    {
        
PlaySoundAtEntity("GuardianScream""25_guardian_ontop.snt""Player"0false);
    }        
    
    
AddLocalVarInt(sEvent1); //Sets a variable to the guardians step
    
string sDmgDeathArea "AreaGuardianKill_" GetLocalVarInt(sEvent); //Sets a new dmg area after each variable 

and
PHP Code: (Select All)
//Extra events depending on the step
    
alLumpIdx GetLocalVarInt(sEvent);    // NOTE: removed the "int" 
08-17-2014, 01:11 PM
Find


Messages In This Thread
Some complex issue (SOLVED) - by Neelke - 08-16-2014, 01:19 AM
RE: Some complex issue - by FlawlessHappiness - 08-16-2014, 02:32 AM
RE: Some complex issue - by Neelke - 08-16-2014, 12:07 PM
RE: Some complex issue - by Mudbill - 08-16-2014, 03:44 PM
RE: Some complex issue - by TheGreatCthulhu - 08-16-2014, 07:25 PM
RE: Some complex issue - by Neelke - 08-16-2014, 10:41 PM
RE: Some complex issue (SOLVED) - by TheGreatCthulhu - 08-17-2014, 01:11 PM
RE: Some complex issue (SOLVED) - by Neelke - 08-17-2014, 02:16 PM



Users browsing this thread: 1 Guest(s)