earthquake.scr

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

earthquake.scr

Post by G3mInI »

If I have a player targeted in script using local.player = parm.other, can I make just that one players' screen shake by lets say adding some lines like:

Code: Select all

self waitexec global/earthquake.scr .3 1 0 0

self waitexec global/earthquake.scr .3 .75 0 0

self waitexec global/earthquake.scr .3 .3 0 0

Will that cause just the one players' screen to shake or will all the players' screen shake that are in the server? Keep in mind this is for a server side mod to a stock map. I want to accomplish this while the player is standing inside a trigger_multiple.

G3mInI
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

It will shake the view for all players.
Image
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Post by G3mInI »

Not possible at all to shake just one screen or a few but not all ?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Hey.. I didn't say that :wink:

s/th like this will shake a player's view just a little, you could easily adjust it to your needs though :)

Code: Select all

shakemyview local.player:
  local.offset = (0 0 0) // make vector
  for(local.i = 0; local.i <= 2; local.i++)
    local.offset[local.i] = (randomfloat 2.0 - 1.0) * 5.0 // randnum [-5,5]
  local.player.viewangles += local.offset // tilt view
  waitframe
  wait (randomfloat 1.0)
  if(local.player != NIL && isAlive local.player)
    local.player.viewangles -= local.offset // reset view
end
Image
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Post by G3mInI »

Sweet! Now I have some new commands to study. .. lol ... half of that is greek to me. Such as += and -= ... never seen those used. And why the wait randomfloat instead of just wait 1?

Nevertheless I will make use of this little tidbit. I just like to understand what is I am using.

G3mInI
Angex
Major
Posts: 293
Joined: Mon Dec 30, 2002 1:23 pm
Contact:

Post by Angex »

G3mInI wrote:+= and -= ... never seen those used.
These operators are a "short hand" way of writing the following expressions:

Code: Select all

// local.number += 1 is equivalent to the line below.
// It means add one to local.number, and store the result in local.number.

local.number = local.number + 1


// local.number -= 1 is equivalent to the line below.
// It means minus one from local.number, and store the result in local.number.

local.number = local.number - 1
I'm guessing the random number is used to make the screen shake more varied, otherwise a shake of the same magnitude would look the same everytime (which is a bit boring).
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Post by G3mInI »

Thanks angex. It all makes sense to me now.
Post Reply