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

New Semiclip Method


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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 - 13829 views - 1.5 KB)

Last edited by skyjur; 06-11-2008 at 08:23. Reason: changed SOLID_BBOX to SOLID_SLIDEBOX
skyjur is offline
 



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 03:43.


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