I'm posting here to share, and to hope getting some infos/tweaks about a script i'm trying to do and which is already in a post @ TMT
The idea is to make a 'shake' effect when the nade explode (like earthquake)...
I've currently setup the things in the models/fx/m2fgrenadeexplosion.tik file which exec a check_nadetrig.scr to see if the nade already exploded or not, and if you're in the area, exec another script (courtesy of LeBabouin) which have to shake your screen (but don't seems to works for me
Here is m2fgrenadeexplosion.tik :
Code: Select all
TIKI
setup
{
scale 1.0
path models/fx/dummy
skelmodel dummy2.skd
}
init
{
server
{
classname Explosion
// ghost
// svflags +sendonce
rendereffects +dontdraw
notsolid
// radiusdamage 200
radiusdamage 500 //[UR]
// radius 400
radius 500 //[UR]
meansofdeath grenade
life 0.25
dlight 1 1 1 800
//exec global/earthquake.scr 1.2 .3 0 0
//exec global/quake4me.scr
[color=red]exec global/check_nadetrig.scr[/color]
}
}
animations
{
idle dummy2.skc
{
server
{
// make the explosion effect
// entry explosioneffect grenade
first explosioneffect grenade
// last stopanimating
}
}
}
Code: Select all
main:
if(!self.exploded){
self.exploded = 1
while (self!=NULL && self!=NIL){
local.kaboom = self.origin
waitframe
}
if(local.kaboom!=( 0.000000 0.000000 0.000000 ) && local.kaboom!=NIL)
thread shakeItToMe local.kaboom
}
end
shakeItToMe local.kaboom:
iprintln "Kaboom !"
for(local.player=1;local.player<=$player.size;local.player++)
{
if(vector_within local.kaboom $player[local.player].origin 550 && $player[local.player].health != 0)
{
iprintln "in the area : quake4me coming!"
exec global/quake4me.scr
}
}
end
Here is the quake4me.scr :
Code: Select all
//////////////////////////////////////////////////////////////////////
//earthQuakeForOnePlayer:
//////////////////////////////////////////////////////////////////////
// local.maxTilt = 3
local.maxTilt = 0.25
local.velocity = 0
// local.constant = -.002
// local.constant = -1.9
local.constant = -2
local.player = self
while(local.player&&(isalive local.player)&&(local.player.electroSpotted == 1)){
if(local.player.beamTilt!=1)
{
local.viewangles = local.player.viewangles
// local.viewangles[2] = local.maxTilt
local.viewangles[0] = local.maxTilt
local.player.viewangles = local.viewangles
local.player.beamTilt = 1
}
// if (local.viewangles[2] > local.maxTilt && local.velocity > 0)
if (local.viewangles[0] > local.maxTilt && local.velocity > 0)
{
local.velocity = 0
}
else
{
// if (local.viewangles[2] < -local.maxTilt && local.velocity < 0)
if (local.viewangles[0] < -local.maxTilt && local.velocity < 0)
{
local.velocity = 0
}
}
local.viewangles = local.player.viewangles
// local.velocity += local.constant * local.viewangles[2]
local.velocity += local.constant * local.viewangles[0]
// local.viewangles[2] += local.velocity
local.viewangles[0] += local.velocity
local.player.viewangles = local.viewangles
waitframe
}
local.viewangles = local.player.viewangles
// local.viewangles[2] = 0
local.viewangles[0] = 0
local.player.viewangles = local.viewangles
local.player.beamTilt = 0
end
Thanks in advance,
Dj

