home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Revista CD Expert 24
/
PCGamer24_23Demos.iso
/
Vigilance
/
vigilance.exe
/
data1.cab
/
Assets
/
scripts
/
grenade.e
< prev
next >
Wrap
Text File
|
1998-09-21
|
4KB
|
676 lines
int Initialize(string type)
{
global int state;
global real explodeTime = 3.5;
global int hitValue = 20;
global real gEndTime = 0.0;
global real gSmokeTime = 0.01;
global int gSmokeTrail = 0;
global real gExplodeRadius = 30.0;
global real gElasticity = .7;
global int gStartSound = 7;
global int gProgressSound = 18;
global int gEndSound = 27;
global real gMass = 5.0;
Reset("dummy");
return 0;
}
int elas(string str)
{
gElasticity = Str2Real(str);
}
int Reset(string dummy)
{
state = 0;
SetElas(thisObject,gElasticity);
wakeupTime = -1.0;
SetStyle(thisObject,0);
SetCollidableProperties(thisObject,1,0);
return 0;
}
int startsound(string soundname)
{
gStartSound = GetSoundIndex(soundname);
}
int endsound(string soundname)
{
gEndSound = GetSoundIndex(soundname);
}
int progresssound(string soundname)
{
gProgressSound = GetSoundIndex(soundname);
}
int exploderadius(string str)
{
gExplodeRadius = Str2Real(str);
}
int damage(string str)
{
hitValue = Str2Int(str);
return 0;
}
int Fire(int flag)
{
real time ;
time = GetTime(thisObject);
if (state == 0)
{
state = 2;
SetCollidableProperties(thisObject,1,1);
SetStyle(thisObject,0);
PlaySound(thisObject,gStartSound);
SetOldPos(thisObject);
wakeupTime = time + 0.05;
gEndTime = time + explodeTime;
}
return 0;
}
int ExplodeFulfill(int param)
{
real time ;
time = GetTime(thisObject);
state = 4;
KillEFX(thisObject,gSmokeTrail);
gSmokeTrail = 0;
LaunchEFX(thisObject,2,0);
Explode(thisObject,hitValue,gExplodeRadius,gMass);
PlaySound(thisObject,gEndSound);
MakeDecal(thisObject,1,0);
SetCollidableProperties(thisObject,0,0);
SetStyle(thisObject,4);
wakeupTime = time + 1.0;
return 0;
}
int Explosion(int param)
{
FireSaveInfo(thisObject,hitValue,0,gMass,1);
ExplodeFulfill(1);
return 0;
}
int Colliders(string dummy)
{
if (state == 2)
{
int result;
map::iterator ix;
map objInList;
result = 0;
objInList = Collisions(thisObject,0,0,0);
for (ix = begin(objInList) ;ix != end(objInList); ++ix)
{
{
Explosion(0);
break;
}
}
}
return 0;
}
int Collidants(string dummy)
{
if (state == 2)
{
int result;
map::iterator ix;
map objInList;
result = 0;
int exploded;
exploded = 0;
objInList = Collisions(thisObject,1,0,0);
for (ix = begin(objInList) ;ix != end(objInList); ++ix)
{
{
Explosion(0);
exploded = 1;
break;
}
}
if (exploded == 0)
PlaySound(thisObject,gProgressSound);
}
return 0;
}
int TimedEvent(int input)
{
real time;
time = GetTime(thisObject);
if (state == 2)
{
if (time > gEndTime)
{
wakeupTime = time;
state = 3;
}
else
{
if (gSmokeTrail == 0)
{
gSmokeTrail = LaunchEFX(thisObject,1,0);
SetOldPos(thisObject);
}
else
{
MoveEFX(thisObject,gSmokeTrail,1);
SetOldPos(thisObject);
}
wakeupTime = time + gSmokeTime;
}
}
else if (state == 3)
{
Explosion(0);
}
else if (state == 4)
{
Remove(thisObject);
wakeupTime = -1.0;
}
else
wakeupTime = -1.0;
return 0;
}
int Event(int input)
{
AdjustAngle(thisObject);
}