Post: [Tutorial] Spawn Team Icon on Model's
03-10-2011, 03:39 PM #1
xQuZe-
You talkin to me?
(adsbygoogle = window.adsbygoogle || []).push({});
In this tutorial i will be showing you how to spawn team icon's on any model.
Just like on a claymore. Like this:


You must login or register to view this content.



How to do this:
First we need the normal code for spawning a model.
    level.quze = spawn( "script_model", (self.origin+(0,-200,10)) );
level.quze setModel("[COLOR="Red"]com_plasticcase_friendly[/COLOR]");


We can change the model the any model.

You must login or register to view this content.

So we can also just change it to a Blow-up Doll.
You must login or register to view this content.

Here is the code for spawning a team icon.
    quzeTeamHeadIcon( team )
{
self endon( "death" );
wait .05;
if ( level.teamBased )
self maps\mp\_entityheadicons::setTeamHeadIcon( team, ( 0, 0, [COLOR="Blue"]30[/COLOR] ) );
else if ( isDefined( self.owner ) )
self maps\mp\_entityheadicons::setPlayerHeadIcon( self.owner, (0,0,[COLOR="blue"]30[/COLOR]) );
}


Back to our model spawning code.
    [COLOR="red"]level.quze [/COLOR]= spawn( "script_model", (self.origin+(0,-200,10)) );
[COLOR="red"]level.quze [/COLOR]setModel("com_plasticcase_friendly");


See how I named it level.quze?
We can name it everything.
As long as we name it all the same.

So now we gonna add the thread for the team icon.
    level.quze = spawn( "script_model", (self.origin+(0,-200,10)) );
level.quze setModel("com_plasticcase_friendly");
level.quze thread quzeTeamHeadIcon( self.pers[ "team" ] );


We now called the thread for spawning the icon on level.quze ; our model.
Normally we would use self thread... But it now spawns on level.quze.
If you use another model you should change the height of the icon.
Just change it untill you like it.

Now just add the thread somewhere and you're done. Smile
Our code should be something like this:
    spawnModel()
{
level.quze = spawn( "script_model", (self.origin+(0,-200,10)) );
level.quze setModel("com_plasticcase_friendly");
level.quze thread quzeTeamHeadIcon( self.pers[ "team" ] );
}

quzeTeamHeadIcon( team )
{
self endon( "death" );
wait .05;
if ( level.teamBased )
self maps\mp\_entityheadicons::setTeamHeadIcon( team, ( 0, 0, [COLOR="blue"]30[/COLOR] ) );
else if ( isDefined( self.owner ) )
self maps\mp\_entityheadicons::setPlayerHeadIcon( self.owner, (0,0,[COLOR="Blue"]30[/COLOR]) );
}


I'm still figuring out how to add other icon's.
But this should be good for now.
(adsbygoogle = window.adsbygoogle || []).push({});

The following 6 users say thank you to xQuZe- for this useful post:

howcoolisthis, Kameo, killa skillz, Mrs.Drake, PussayPatrol, xCoD_I3eAsT
03-11-2011, 11:04 AM #11
Amanda
Can’t trickshot me!
The awesome thing is if you could make those icons appear above players' heads! I had tried this in the past but it didn't work... When a player is a bomb carrier for example an icon appears over his head so there must be a way to change it...
03-11-2011, 11:32 AM #12
CAMMO-ECKERT
Smash It If You Grab It
oooooooooooOOOOoooo i like alot nice work m8
03-11-2011, 02:00 PM #13
247Yamato
< ^ > < ^ >
Originally posted by xQuZe
It doesn't spawn lol?


Precache in Init the icon...... :p
03-11-2011, 02:19 PM #14
xQuZe-
You talkin to me?
Originally posted by 247Yamato View Post
Precache in Init the icon...... :p


Wow, please tell me that I fail.
03-11-2011, 02:56 PM #15
247Yamato
< ^ > < ^ >
Originally posted by xQuZe
Wow, please tell me that I fail.


omg, is not so hard to do, I put here an example, this, you will find it this weekend in my zombie mod, :p

In init:

    precacheShader("cardicon_moon");


And this is a box, in the zombie mod it has more functions, but this in an example.

    OrangeSoda(pos, angle)
{
block = spawn("script_model", pos );
block setModel("com_plasticcase_beige_big");
block.angles = angle;
block Solid();
block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
invisblock = spawn("script_model", pos+(0,0,60));
invisblock Solid();
invisblock.angles = angle;
invisblock CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
block.headIcon = newHudElem();
block.headIcon.x = block.origin[0];
block.headIcon.y = block.origin[1];
block.headIcon.z = block.origin[2] + 50;
block.headIcon.alpha = 0.85;
block.headIcon setShader( "cardicon_moon", 2,2 );
block.headIcon setWaypoint( true, true, false );
wait 0.01;
}
03-11-2011, 03:05 PM #16
xQuZe-
You talkin to me?
Originally posted by 247Yamato View Post
omg, is not so hard to do, I put here an example, this, you will find it this weekend in my zombie mod, :p

In init:

    precacheShader("cardicon_moon");


And this is a box, in the zombie mod it has more functions, but this in an example.

    OrangeSoda(pos, angle)
{
block = spawn("script_model", pos );
block setModel("com_plasticcase_beige_big");
block.angles = angle;
block Solid();
block CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
invisblock = spawn("script_model", pos+(0,0,60));
invisblock Solid();
invisblock.angles = angle;
invisblock CloneBrushmodelToScriptmodel( level.airDropCrateCollision );
block.headIcon = newHudElem();
block.headIcon.x = block.origin[0];
block.headIcon.y = block.origin[1];
block.headIcon.z = block.origin[2] + 50;
block.headIcon.alpha = 0.85;
block.headIcon setShader( "cardicon_moon", 2,2 );
block.headIcon setWaypoint( true, true, false );
wait 0.01;
}


Hahaha i know dude, I just wanted you to tell me that i fail for forgetting to precache :P
03-11-2011, 03:09 PM #17
247Yamato
< ^ > < ^ >
Originally posted by xQuZe
Hahaha i know dude, I just wanted you to tell me that i fail for forgetting to precache :P


Yes, but I didnt knew in what you failed, :pedo:
03-11-2011, 03:10 PM #18
xQuZe-
You talkin to me?
Originally posted by 247Yamato View Post
Yes, but I didnt knew in what you failed, :pedo:


C'mon you can do it, give me a sexy facepalm Happy
03-11-2011, 05:32 PM #19
Beta-
< ^ > < ^ >
xQuZe- U getn Better Hope You Win Prem

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo