Zokrar
Member
Posts: 85
Threads: 16
Joined: May 2013
Reputation:
0
[SOLVED] Script help required
What would I do with the GruntOneTimer and GruntTwoTimer? The big problem for me with this code is that I don't know how to go about organizing it to flow properly with the timer included. I tried using variables and alState, and for reasons I can't see it didn't work. I fixed the typo too, thanks for catching that.
EDIT: Got it working! I feel stupid now, lol. I went about it the hard way.
Here's the code, incase anyone's wondering.
Spoiler below!
void OnStart()
{
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
}
//****** ATTACKING GRUNTS *********
SetEntityPlayerLookAtCallback("gruntOne", "GruntOne", false);
SetEntityPlayerLookAtCallback("gruntTwo", "GruntTwo", false);
AddLocalVarInt("Grunt1State", 1);
AddLocalVarInt("Grunt2State", 1);
//****** ATTACKING GRUNTS *********
SetSkyBoxActive(true);
SetSkyBoxTexture("nighttime.dds");
PlayMusic("ending_alexander.ogg", true, 0.30, 2.00, 5, true);
}
//****** ATTACKING GRUNTS *********
void GruntOne(string &in asEntity, int alState)
{
if(alState == 1)
{
if(GetLocalVarInt("Grunt1State") == 1)
{
SetEntityActive("gruntOne", false);
CreateParticleSystemAtEntity("electro1", "ps_electro_charge.ps", "gruntOne", true);
PlaySoundAtEntity("grunt1", "15_bang.snt", "Player", 0, false);
AddTimer("GruntOneSpawnDelay", 3, "GruntOneTimer");
SetLocalVarInt("Grunt1State", 0);
}
}
}
void GruntTwo(string &in asEntity, int alState)
{
if(alState == 1)
{
if(GetLocalVarInt("Grunt2State") == 1)
{
SetEntityActive("gruntTwo", false);
CreateParticleSystemAtEntity("electro2", "ps_electro_charge.ps", "gruntTwo", true);
PlaySoundAtEntity("grunt2", "15_bang.snt", "Player", 0, false);
AddTimer("GruntTwoSpawnDelay", 3, "GruntTwoTimer");
SetLocalVarInt("Grunt2State", 0);
}
}
}
void GruntOneTimer(string &in asTimer)
{
SetEntityActive("gruntTwo", true);
DestroyParticleSystem("electro2");
SetLocalVarInt("Grunt1State", 1);
}
void GruntTwoTimer(string &in asTimer)
{
SetEntityActive("gruntOne", true);
DestroyParticleSystem("electro1");
SetLocalVarInt("Grunt2State", 1);
}
//****** ATTACKING GRUNTS *********
(This post was last modified: 06-23-2013, 02:32 AM by Zokrar .)