| Author |
Topic: Crosshair in thirdperson & xmodel collision |
|
|
Category: CoD2 Scripting Posted: Friday, Jan. 1, 2010 05:30 pm |
 |
I'm making a mod for CoD2 where all players are boxes, and maps are full of boxes so you can hide yourself.
The mod is originally made for Half-Life and is called Boxwar (I'm trying to find the creator's email to ask for permission, so if anyone knows it, please let me know).
The mod is played in thirdperson, so you can position yourself among the other boxes easier - but there are a few problems with this..
1. While being in thirdperson, the crosshair is gone - How do I prevent the crosshair from disappearing?
2. While being a box, the weapon is still shown, how can I remove it ?
I tried searching a bit and found something which might would help ( http://modsonline.com/Forums-top-100698.html) - altering the weapon files - would it work or not ?
3. The players are boxes, but you can only kill them with a nade - you will shoot right through them if you try with a normal weapon.
Is this caused by the xmodel files not having collision files / hitbox ? If it is, wouldn't it be possible to make such files ?

Sorry for the dark picture, forgot to put more lights in the map :P
I don't want you to make the mod for me, since I'm still trying to learn - it would be better to give me tips on how to do it and then let me test myself :d.
|
 |
|
|
| sherlokpwnz |
General Member Since: May 1, 2009 Posts: 95 Last: Jan 13, 2010 [view latest posts] |
|
|
|
|
|
|
|
|
|
Category: CoD2 Scripting Posted: Tuesday, Jan. 5, 2010 12:22 pm |
 |
Could still use some help ;p especially at number 3.
Also, another thing I would like to do. When dying, it should replace the dead box (which you can walk through), with a static box (solid).
Can this be done with something like..
Code: self delete();
addmodel("xmodel\xxxxxx") self.origin
if not, is it even possible to do that? :D |
 |
|
|
| tHMatt |
 |
General Member Since: Sep 11, 2007 Posts: 473 Last: Mar 20, 2013 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Tuesday, Jan. 5, 2010 12:37 pm |
 |
n3BuL writes...Quote: Could still use some help ;p especially at number 3.
Also, another thing I would like to do. When dying, it should replace the dead box (which you can walk through), with a static box (solid).
Can this be done with something like..
Code: self delete();
addmodel("xmodel\xxxxxx") self.origin
if not, is it even possible to do that? :D
You cannot spawn collision in cod2. |
 |
|
|
|
|
|
| Sevenz |
 |
General Member Since: Apr 24, 2006 Posts: 2390 Last: May 10, 2013 [view latest posts] |
|
|
|
|
| clanhelio |
General Member Since: Aug 30, 2008 Posts: 223 Last: Mar 24, 2011 [view latest posts] |
|
|
|
|
|
|
Category: CoD2 Scripting Posted: Thursday, Jan. 7, 2010 10:24 am |
 |
clanhelio writes...Quote: And if you're going to do that, you may as well attach trigger_damages onto that to compensate for the lack of hitboxes and script some kind of fancy health system, less so if you disallow health regen.
Great idea with attaching trigger_damage !
Can it be done by making 64 (max clients available) of them - each of them with targetname "player_hitbox".
Then in a script (fx in a place with "onplayerconnect"), write:
Code: hitbox = getentarray("targetname", "player_hitbox");
hitbox enablelinkto();
hitbox linkto self(); // Is it possible to use "self" here? or would you have use "player" or anything else?
I'm not that good at using getentarray yet - so is it correct in this situation? ![[ohwell]](images/BBCode/smilies/ohwell.gif)
I did already make a health system with a health bar - so you aren't able to regenerate health just by hiding/waiting.
About the static dead "body":
Code: init();
model = getentarray("targetname","static_model");
player = getentarray("player","classname");
while(1)
{
for (i = 0; i < player.size; i++)
{
player[i] getEntityNumber()
player[i] thread deadbox();
wait 0.1;
}
}
deadbox()
{
model[i] getEntityNumber()
model[i] moveto(player[i].origin, 0.1);
wait (60);
model[i] moveZ(-300,0,0,1);
model[i] waittill ("movedone");
}
Or would I need something which classifies the [ i ] in "model[ i ] ? This was written in 5 minutes, so there might be some errors in it :) |
 |
|
|
| clanhelio |
General Member Since: Aug 30, 2008 Posts: 223 Last: Mar 24, 2011 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Friday, Jan. 8, 2010 06:02 am |
 |
Holding off on the dead boxes for a moment (as you should ensure you get everything else done right first)
Right here everything will be set up, it assumes:
-You made a number of the boxes all somewhere out of sight while they wait
-You made each box set (the box xmodel, the player clip, and trigger_damage) each one at a time, i.e. the 1st player clip belongs to the same box set ad the 1st trigger_damage and the 1st box xmodel.
Code: boxsetup()
{
hitbox = getentarray("targetname", "player_hitbox"); //trigger_damage
colbox = getentarray("targetname","player_colbox"); //player clip
model = getentarray("targetname","player_model"); //actual box script_model
for (i = 0; i < hitbox.size; i++)
{
hitbox[i] enablelinkto();
hitbox[i] linkto(colbox[i]);
model[i] linkto(colbox[i]);
colbox[i].isinuse = 0; //set all boxes as not belonging to any players
}
}
That sets everything up
This will establish the boxes players will be assigned to them when they connect
Code: waitforconnect()
{
colbox = getentarray("targetname","player_colbox");
while(1)
{
level waittill("connected",player); //wait until someone connects
for (i = 0; i < colbox.size; i++)
{
if(colbox[i].isinuse == 0) //check each box until one is free
{
player.colboxnum = i; //establishes box set # "belonging" to the player
colbox[i].isinuse = 1; //box belongs to someone now
break;
}
}
player thread checkstillexists(i); //carry over the box set #
}
}
Here you check if/when the player disconnects, when that happens, you dis-assign the box and set it up so it's free to be used by the next player who connects
Code: checkstillexists(i)
{
colbox = getentarray("targetname","player_colbox");
while(1)
{
if( !isdefined(self) )
{
colbox[i].isinuse = 0;
colbox[i] moveto (Some_place_I_Have_No_Idea_where,.0001);
return;
}
wait(0.5);
}
}
Sound good? Maybe I'm a bit ahead of myself/wrong, etc, I did this ina bout 15 min. |
 |
|
|
|
|
mp_TempleCall of Duty: Mods: Multiplayer (624.12Kb)
|