Raised This Month: $51 Target: $400
 12% 

Earthquake effect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hostingguy
Member
Join Date: Jan 2008
Old 01-14-2008 , 01:57   Earthquake effect
Reply With Quote #1

Hello,

I was wondering how to make an "earthquake" type effect

I was thinking something like this, but please fill in the gaps, I am very new at this and suck at the whole model/sprites/effects part of pawn coding

PHP Code:
 
new gmsgShake get_user_msgid "ScreenShake" );
new 
eq_Sprite precache_model "sprites/shockwave.spr" );
 
new 
origin[3];
get_user_originenemyorigin );
 
// random "earth shaking" - this part doesnt work or look right
message_begin MSG_PVSSVC_TEMPENTITYorigin );
write_byte TE_IMPLOSION );
write_coord origin[0] + random_num ( -100100 ) );
write_coord origin[1] + random_num ( -100100 ) );
write_coord origin[2] + random_num ( -5050 ) );
write_short eq_Sprite );
write_byte random_num 0,20 ) + 20 );
write_byte 12 );
write_byte TE_EXPLFLAG_NONE );
message_end ( );
 
 
//Then I do some code in between here
 
//to determine which players are near the targeted player
//and shake their screen like they were in earth quake
message_beginMSG_ONEgmsgShake, { 00}, targetid );
write_short255<< 14 ); 
write_short10 << 14 );
write_short255<< 14 );
message_end( ); 

Can anyone offer any advice?
hostingguy is offline
lohaxl
BANNED
Join Date: Jan 2008
Old 01-14-2008 , 04:49   Re: Earthquake effect
Reply With Quote #2

Show all of the source code?

If you want help i might beable to help you.
lohaxl is offline
hostingguy
Member
Join Date: Jan 2008
Old 01-14-2008 , 15:18   Re: Earthquake effect
Reply With Quote #3

Hi, thanks - that pretty much is all of the code, the only other thing thre is teh code in between that figures out who the players are that are near the enemey object. The oproblem I have is with this

PHP Code:
// random "earth shaking" - this part doesnt work or look right
message_begin MSG_PVSSVC_TEMPENTITYorigin );
write_byte TE_IMPLOSION );
write_coord origin[0] + random_num ( -100100 ) );
write_coord origin[1] + random_num ( -100100 ) );
write_coord origin[2] + random_num ( -5050 ) );
write_short eq_Sprite );
write_byte random_num 0,20 ) + 20 );
write_byte 12 );
write_byte TE_EXPLFLAG_NONE );
message_end ( ); 
That part doesnt work, it gets a Server Bad Message
and kicks all users

I also dont think those are the correct sprites/coords/bytes for the desired effect, but I odnt know what it should be.
</span></span>
hostingguy is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-14-2008 , 15:27   Re: Earthquake effect
Reply With Quote #4

Try MSG_BROADCAST instead of MSG_PVS
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
hostingguy
Member
Join Date: Jan 2008
Old 01-14-2008 , 21:14   Re: Earthquake effect
Reply With Quote #5

Hi connorr thanks for the reply, I tried that and it doesnt work, still same problem. Each client is kicked and message in console reads

Quote:
Host_Error: CL_ParseServerMessage: Bad server messag
Code is exactly:

PHP Code:
 
//These are global
new gmsgShake get_user_msgid "ScreenShake" );
new 
eq_Sprite precache_model "sprites/shockwave.spr" ); 
public 
EarthQuake_DOparm[] )
{
 new 
enemy parm[0]; //original enemy targeted
  
new id parm[2]; //caster of the earthquake

 //Get the origin of the original enemy cast to use as basis for radius
 
new origin[3];
 
get_user_originenemyorigin );

//Do a ground shockwave
message_begin MSG_BROADCASTSVC_TEMPENTITYorigin );
write_byte TE_IMPLOSION );
write_coord origin[0] + random_num ( -100100 ) );
write_coord origin[1] + random_num ( -100100 ) );
write_coord origin[2] + random_num ( -5050 ) );
write_short eq_Sprite );
write_byte random_num 0,20 ) + 20 );
write_byte 12 );
write_byte TE_EXPLFLAG_NONE );
message_end ( );
 
new 
players[32], targetorigin[3], numberofplayersidistancebetweendamage 45;
get_players playersnumberofplayers );
for ( 
0numberofplayers; ++)
{
 
get_user_origin players[i], targetorigin );
 
distancebetween get_distance origintargetorigin );
 if ( ( 
distancebetween 300  ) && is_user_alive players[i] ) )
 {
  
//Deal damage
  
do_damage players[i], iddamage26300);
 
  
//Shake the users screen 
  
message_beginMSG_ONEgmsgShake, { 00}, players[i] );
  
write_short255<< 14 ); //ammount
  
write_short10 << 14 ); //lasts this long
  
write_short255<< 14 ); //frequency
  
message_end( );
 }

So apparently I am doing something wrong, I dont even know if thats teh right model/sprite to use to accomplish an earthquake effect, but even if its not it doesnt work at all
hostingguy is offline
hugz`
Veteran Member
Join Date: Jul 2007
Location: In a house
Old 01-14-2008 , 21:37   Re: Earthquake effect
Reply With Quote #6

After a bomb blows up a bomb site.. isn't there shaking? You could use that..
__________________
hugz` is offline
Send a message via AIM to hugz`
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-14-2008 , 23:21   Re: Earthquake effect
Reply With Quote #7

Quote:
Originally Posted by hostingguy View Post
PHP Code:
//These are global
new gmsgShake get_user_msgid "ScreenShake" );
new 
eq_Sprite precache_model "sprites/shockwave.spr" ); 
This is not how you are supposed to do...
PHP Code:
new gmsgShake;
new 
eq_Sprite;

public 
plugin_precache() {
    
eq_Sprite precache_model "sprites/shockwave.spr" );
}

public 
plugin_cfg() {
    
gmsgShake get_user_msgid "ScreenShake" );


For the message, try :
PHP Code:
    //Do a ground shockwave
    
message_begin MSG_BROADCASTSVC_TEMPENTITYorigin );
    
write_byte TE_IMPLOSION );
    
write_coord origin[0] + random_num ( -100100 ) );
    
write_coord origin[1] + random_num ( -100100 ) );
    
write_coord origin[2] + random_num ( -5050 ) );
    
write_byte random_num 20,40 ) );
    
write_byte 12 );
    
write_byte );
    
message_end ( ); 
Quote:
Originally Posted by message_const.inc
#define TE_IMPLOSION 14 // Tracers moving toward a point
// write_byte(TE_IMPLOSION)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_byte(radius)
// write_byte(count)
// write_byte(life in 0.1's)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
hostingguy
Member
Join Date: Jan 2008
Old 01-15-2008 , 01:52   Re: Earthquake effect
Reply With Quote #8

Quote:
Originally Posted by connorr View Post
This is not how you are supposed to do...
PHP Code:
new gmsgShake;
new 
eq_Sprite;
 
public 
plugin_precache() {
    
eq_Sprite precache_model "sprites/shockwave.spr" );
}
 
public 
plugin_cfg() {
    
gmsgShake get_user_msgid "ScreenShake" );

yeah I do it that way, its just in the interest of saving time I didnt write it that way, sorry for the confusion.

I do this:
PHP Code:
public plugin_precache ( ) 

PreCache_Sounds ( );
PreCache_Models ( );
PreCache_Sprites ( );

return 
PLUGIN_CONTINUE;

And then just add w/e it is into the seperate function.

Quote:
Originally Posted by connorr View Post
For the message, try :
PHP Code:
    //Do a ground shockwave
    
message_begin MSG_BROADCASTSVC_TEMPENTITYorigin );
    
write_byte TE_IMPLOSION );
    
write_coord origin[0] + random_num ( -100100 ) );
    
write_coord origin[1] + random_num ( -100100 ) );
    
write_coord origin[2] + random_num ( -5050 ) );
    
write_byte random_num 20,40 ) );
    
write_byte 12 );
    
write_byte );
    
message_end ( ); 
So this has the desired effect on the users themselves, but there is basically nothing broadcast to everyone else that is noticable. So one problem solved
hostingguy is offline
hostingguy
Member
Join Date: Jan 2008
Old 01-17-2008 , 00:12   Re: Earthquake effect
Reply With Quote #9

Does anyone know of a sprite (and the code to use it) that makes it look like rocks are falling, or something like that?

I want to use a broadcast message similar to this to do that, but cant find anything
hostingguy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode