• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Release] Improved 3D icons
#1
Hello

This is another code I found out while I was exploring my zombie mod folder, it is meant to be used on boxes, it spawns a shader over it that only appears when you are close and looking at it, it fades in and out to give a better effect.

Code:
iShader( shader )
{
    trigger = Spawn( "trigger_radius", self.origin, 0, 150, 72 );
    icon = NewHudElem( );
    icon SetShader( shader, 150, 150 );
    icon.alpha = 0;
    icon.color = ( 1, 1, 1 );
    icon.x = self.origin[ 0 ];
    icon.y = self.origin[ 1 ];
    icon.z = self.origin[ 2 ] + 55;
    icon SetWayPoint( true, true );
    wait ( 0.05 );
    while( 1 )
    {
        trigger waittill( "trigger", player );
        if( !isplayer( player ) )
            continue;
        while( player IsTouching( trigger ) )
        {
            if( VectorDot( anglesToForward( player.angles ), VectorNormalize( trigger.origin - player.origin ) ) > 0.766 )
                FadeIcon( icon, "in" );
        else
                FadeIcon( icon, "out" );
        wait ( 0.25 );
        }
        FadeIcon( icon, "out" );
    }
}

FadeIcon( icon, what )
{
    if( what == "in" )
    {
        icon FadeOverTime( 0.2 );
        icon.alpha = 1;
        wait ( 0.2 );
    }
    else if( what == "out" )
    {
        icon FadeOverTime( 0.2 );
        icon.alpha = 0;
        wait ( 0.2 );
    }
    else
    {
        if( icon.alpha == 0 )
        {
            icon FadeOverTime( 0.2 );
            icon.alpha = 1;
            wait ( 0.2 );
        }
        else
        {
            icon FadeOverTime( 0.2 );
            icon.alpha = 0;
            wait ( 0.2 );
        }
    }
}

Example of use:

Code:
block = spawn( "script_model", ( 100, 30, -1000 ) );
block setModel( "com_plasticcase_beige_big" );
block thread iShader( "hudicon_neutral" );

Thanks for reading
  Reply
#2
nice, also you can do it by using simple line. (i used it in mw2rotu)
I will post it there if i will find it.
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
  Reply
#3
How can I invert it to be if you're farther from it, the shader shows. But the closer you are it, the less it shows?

Edit: Never mind I got it, just had to replace the fadeicon( icon, "in" ); and so with the opposites.

Edit 2: I'm going to use this in AIZombies eXtreme 2.0, just a heads up. Credits obviously given.
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
  Reply
#4
(06-18-2013, 20:01)DidUknowiPwn Wrote: How can I invert it to be if you're farther from it, the shader shows. But the closer you are it, the less it shows?

Edit: Never mind I got it, just had to replace the fadeicon( icon, "in" ); and so with the opposites.

Edit 2: I'm going to use this in AIZombies eXtreme 2.0, just a heads up. Credits obviously given.

Could you post 1-2 picture about how does it look w/ the added shader and w/o?
  Reply
#5
(06-18-2013, 21:41)TheRaZ Wrote:
(06-18-2013, 20:01)DidUknowiPwn Wrote: How can I invert it to be if you're farther from it, the shader shows. But the closer you are it, the less it shows?

Edit: Never mind I got it, just had to replace the fadeicon( icon, "in" ); and so with the opposites.

Edit 2: I'm going to use this in AIZombies eXtreme 2.0, just a heads up. Credits obviously given.

Could you post 1-2 picture about how does it look w/ the added shader and w/o?

Okay so they're basically the same thing but it just hides the icon when you're looking at it (using a transition, in my version at least).
Original it's hidden until you look at it.
Video coming.
Edit:
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
  Reply
#6
There is a bug where if let's say the area it was threaded from i.e. box location in point A in the map. And the box moved to point B the waypoint will still be at A. Any idea on how to fix it?
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
  Reply
#7
(06-20-2013, 01:58)DidUknowiPwn Wrote: There is a bug where if let's say the area it was threaded from i.e. box location in point A in the map. And the box moved to point B the waypoint will still be at A. Any idea on how to fix it?

Create wp1, if box moved Destroy wp1 and if destroyed create new waypoint?
  Reply
#8
Or put this inside a while, so it keeps changing its position according to the box.

Code:
trigger setOrigin( (x,y,z ) );
    icon.x = trigger.origin[ 0 ];
    icon.y = trigger.origin[ 1 ];
    icon.z = trigger.origin[ 2 ] + 55;
  Reply
#9
Code:
Error: uninitialised variable 'z' at file maps/mp/gametypes/mapedit.gsc, line 2161:
  trigger SetOrigin( (x,y,z) );

Edit 3: Now it's working ;P
Code:
    while( 1 )
    {
        trigger SetOrigin( (icon.x,icon.y,icon.z) );
        icon.x = self.origin[ 0 ];
        icon.y = self.origin[ 1 ];
        icon.z = self.origin[ 2 ] + 55;
        wait (0.01);
    }
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help Stop music, change icons anedaktos13 2 2,288 06-12-2012, 15:50
Last Post: SuperNovaAO
  [Tutorial] 3D Icons Yamato 14 8,101 01-24-2012, 02:40
Last Post: ScHmIdTy56789
  COD MW3 Prestige Ranks level Icons DarthVader 1 4,188 11-19-2011, 03:08
Last Post: JariZ
  [Release] Lord Scripts' Improved Default Texture Scripts18 11 6,000 08-02-2011, 20:56
Last Post: Scripts18
  Help how to set custom team icons|SOLVED rotceh_dnih 13 6,923 07-12-2011, 13:58
Last Post: Cyborgking
  killstreak hud icons? Kylaii 1 1,967 06-30-2011, 01:55
Last Post: Kylaii
  Help Custom team icons Lemon 3 3,694 06-25-2011, 10:38
Last Post: Lemon
  [Request] Zombie and Survivor Icons Lemon 6 3,293 06-24-2011, 16:42
Last Post: Lemon
  [Request] Shaders/Icons 4FunPlayin 5 3,637 03-11-2011, 16:52
Last Post: 4FunPlayin
  [News] Some nice icons Eekhoorn 7 4,497 03-01-2011, 07:32
Last Post: Kazaa

Forum Jump:


Users browsing this thread: 1 Guest(s)