Yeah, I added it so you can queue earthquakes if the function is called again before previous ones have finished.
Yeah, I added it so you can queue earthquakes if the function is called again before previous ones have finished.
I will have to look at the Earthquake stuff once this annoying error message is fixed:
I suspect the following weapon causing it: models\statweapons\mg42_gun_fake.tik^~^~^ Event 'spawnrangelinked' does not exist.
^~^~^ Failed execution of event for class 'ClientGameCommandManager'
It spams the console so bad it has a real impact on the gameplay.
Not sure about that error, sorry.
I'm not gonna bother working on the earthquake code more than this, but it's currently not bad and similar to the source (didn't bother with queue stuff in the end). If it's helpful to someone then go ahead and make it better :
Earthquake local.duration local.magnitude local.no_rampup local.no_rampdown:
if (self.quakes == NIL)
self.quakes = 0
if (local.duration <= 0 || local.magnitude <= 0 || self.quakes > level.MAX_EARTHQUAKES)
end
// he's quaking
self.quakes++
// make the earthquake ent
local.e = spawn Listener
local.e.magnitude = local.magnitude
local.e.starttime = level.time
local.e.endtime = local.e.starttime + local.duration
// do the quakes
local.shakeangles = (0 0 0)
while (local.e.endtime > level.time)
{
local.timedelta = level.time - local.e.starttime // grab earthquake time
local.magnitude = local.e.magnitude // peak magnitude
if (local.timedelta >= local.duration / 2)
{
// in the rampdown phase of the earthquake
if (!local.no_rampdown)
local.magnitude = local.magnitude * ((level.time - local.e.endtime) * 3.0 / local.duration)
}
else
{
// in the rampup phase of the earthquake
if (!local.no_rampup)
local.magnitude = local.magnitude * ((local.timedelta) * 3.0 / local.duration)
}
local.shakeangles[0] = ((randomint(2) - 1) * local.magnitude * 2)
local.shakeangles[1] = ((randomint(2) - 1) * local.magnitude * 2)
local.shakeangles[2] = ((randomint(2) - 1) * local.magnitude * 3)
self.viewangles += local.shakeangles
waitframe
self.viewangles -= local.shakeangles
}
// get rid!
local.e remove
self.quakes--
end
Last edited by 1337Smithy; September 10th, 2018 at 06:28 AM.
So I have a new issue
How do I remove a hud that was drawn this way ?
huddraw_shader 200 "textures/hud/gasmask_overlay"
huddraw_align 200 left top
huddraw_rect 200 0 0 640 480
huddraw_virtualsize 200 1
huddraw_color 200 1 1 1
huddraw_alpha 200 1
empty the shader or alpha
Discord: RyBack#4239
fb: https://www.facebook.com/mohabhassan312
I believe if you just set your alpha to 0, it will turn it off, so...
huddraw_alpha 200 0
Tode
Last edited by Todesengel; November 11th, 2018 at 09:58 AM.
Thanks, the alpha approach worked.
I have not tested the other.
In client internals it checks for string or shader, then checks for alpha. In that sequence. If first check is false or second one in sequence is false hud is not drawn.
Discord: RyBack#4239
fb: https://www.facebook.com/mohabhassan312
is there a command to force the primary weapon of a player ?
I just need the player to hold primary weapon for 1 frame time, it doesn't matter if he switches back
maybe something like,
local.player give models/weapons/kar98sniper.tik