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

New Semiclip Method


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
skyjur
Junior Member
Join Date: Nov 2006
Location: Lithuania
Old 04-10-2008 , 06:16   New Semiclip Method
Reply With Quote #1

I have found a very good way of making semiclip (I think it is new). The main idea is to add SOLID_NOT flag for a player on a right moment.

Lets start with the simplest example.
PHP Code:
plugin_init()
{
      
register_forward(FM_PlayerPreThink"preThink")
      
register_forward(FM_PlayerPostThink"postThink")
}
public 
preThink(id)
{
      if(
pev(idpev_movetype) == MOVETYPE_NOCLIP) return

      
set_pev(idpev_solidSOLID_SLIDEBOX)
}
public 
postThink(id)
{
      if(
pev(idpev_movetype) == MOVETYPE_NOCLIP) return

      
set_pev(idpev_solidSOLID_NOT)

This little example is good enough for a KZ or Surf server. Player during the Think is SOLID_SLIDEBOX, so it means it will Touch all entities. In the same time all other players are SOLID_NOT, so you will go trough them without a touch.

It works pretty nice on KZ servers. Even better than the old way. It is ~5 lines of code and you don't have to worry about trigger_teleport and other stuff bicouse everything works fine. All what has left is to add a transparcy rendering.

The dis advanced of this example is that player is SOLID_NOT almost always. So bullets wont touch the player.

The second example is a bit more recourses consuming, compared to the first one. Now I will change every player to SOLID_NOT (accept 1) before a Think, and put things back to normal after Think.
PHP Code:
new maxplayers
new plr_solid[33]

plugin_init()
{
      
register_forward(FM_PlayerPreThink"preThink")
      
register_forward(FM_PlayerPostThink"postThink")
      
maxplayers get_maxplayers()
}
public 
preThink(id)
{
      if(
pev(idpev_movetype) == MOVETYPE_NOCLIP) return

      for(new 
i=1<= maxplayersi++)
      {
            if(!
pev_valid(i) || == id) continue
            
plr_solid[i] = pev(ipev_solid)
            
set_pev(ipev_solidSOLID_NOT)
      }
}
public 
postThink(id)
{
      if(
pev(idpev_movetype) == MOVETYPE_NOCLIP) return

      for(new 
i=1<= maxplayersi++)
      {
            if(!
pev_valid(i) || == id) continue
            
set_pev(ipev_solidplr_solid[i])
      }

This part of code has a 1 big dis advanced. Everything works fine on the server. However client thinks that everyone is SOLID_BBOX. This gives a very uncomfortable effect for a player when he is going trough others. To manage this problem we will have to use FM_AddToFullPack, which is very resources consuming function bicouse it is called very often.

This is all about the main idea. All the rest are enchantments/optimizations.


In the attachment you will find a fully working semiclip plugin for general-cs/hns/kz/surf. Other mods should work well too. Plugin will make your teammates transparent and you will be able to walk thought them without a touch. At the same time opposite team will be solid, you will be able to shoot them. (note that you should use mp_friendlyfire 0 with this plugin or else you can hurt your team)
Attached Files
File Type: sma Get Plugin or Get Source (semiclip.sma - 13812 views - 1.5 KB)

Last edited by skyjur; 06-11-2008 at 08:23. Reason: changed SOLID_BBOX to SOLID_SLIDEBOX
skyjur is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 04-10-2008 , 07:05   Re: New Semiclip Method
Reply With Quote #2

That's pretty cool, I'll probably update my stuff to use this. Good job.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 04-10-2008 , 08:39   Re: New Semiclip Method
Reply With Quote #3

SOLID_SLIDEBOX is for players, not SOLID_BBOX
__________________
|<-- Retired from everything Small/Pawn related -->|
You know when you've been Rango'd
Orangutanz is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 04-10-2008 , 08:52   Re: New Semiclip Method
Reply With Quote #4

Quote:
Originally Posted by Orangutanz View Post
SOLID_SLIDEBOX is for players, not SOLID_BBOX
SOLID_BBOX works perfect too.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 04-10-2008 , 10:40   Re: New Semiclip Method
Reply With Quote #5

nice
__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 04-10-2008 , 11:20   Re: New Semiclip Method
Reply With Quote #6

Quote:
Originally Posted by Alka View Post
SOLID_BBOX works perfect too.
That maybe the case but it's best to comply with standards/best practices.
We don't exactly want another ScreenFade dilemma on our hands, where people didn't understand the correct flags to use due to someone giving/using bad information!
__________________
|<-- Retired from everything Small/Pawn related -->|
You know when you've been Rango'd
Orangutanz is offline
skyjur
Junior Member
Join Date: Nov 2006
Location: Lithuania
Old 04-10-2008 , 13:56   Re: New Semiclip Method
Reply With Quote #7

Quote:
Originally Posted by Orangutanz View Post
SOLID_SLIDEBOX is for players, not SOLID_BBOX
Tnx Orangutanz, I have changed it to SOLID_SLIDEBOX not to mix peoples.
skyjur is offline
merong
Member
Join Date: Feb 2008
Old 04-14-2008 , 04:19   Re: New Semiclip Method
Reply With Quote #8

When i use this method,

(Surf) Server is usually crash
merong is offline
skyjur
Junior Member
Join Date: Nov 2006
Location: Lithuania
Old 04-14-2008 , 11:37   Re: New Semiclip Method
Reply With Quote #9

Quote:
Originally Posted by merong View Post
When i use this method,

(Surf) Server is usually crash
Given code is just an idea. There should be more checks done before changing pev_solid for player. Because player might be a spectator, or dead player. That could mess some things. If you have just copy pasted some code it might not work.

I have everything working on my kz server. But the semiclip part is build into other plugin so I can not post it.

I will fix and update attached plugin in a few days.
skyjur is offline
FatalisDK
Senior Member
Join Date: Mar 2006
Location: bacon
Old 04-17-2008 , 09:39   Re: New Semiclip Method
Reply With Quote #10

Very nice.
__________________

Last edited by FatalisDK; 04-18-2008 at 04:32. Reason: Found what I was looking for
FatalisDK is offline
Reply


Thread Tools
Display Modes

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 18:04.


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