Art of War Central
View in iTunes
Please help us to raise in the ranks of podcasting and subscribe to our itunes feed using the link above.
The next MODSonair show will air LIVE on:
03/14/2010 12:03 EST

Time remaining:
We Dontated to PixelEquity
"Modding refers to the act of modifying a piece of hardware or software or anything else for that matter, to perform a function not originally conceived or intended by the designer." 4
 
Site News   |   Aggregated News   |   Forums   |   Tutorials   |   Downloads   |   Projects   |   Weblinks
Latest Forum Threads 
CoD4 MP Mapping.. Posts: (1) Views: (4) by {UST}Hogan
CoD4 MP Mapping.. Posts: (7) Views: (69) by Ray
CoD2 General.. Posts: (1) Views: (9) by tomalla
CoD4 General.. Posts: (17) Views: (117) by Samuel033
CoD4 MP Mapping.. Posts: (22) Views: (133) by DeekCiti
CoD4 Map + Mod R.. Posts: (9) Views: (127) by voidsource
Software Help.. Posts: (9) Views: (101) by Uzumakibro93
CoD+UO General.. Posts: (1) Views: (11) by Uzumakibro93
CoD Mapping.. Posts: (3) Views: (54) by Uzumakibro93
CoD4 Scripting.. Posts: (1) Views: (26) by Samuel033
Back to Home Page
MODSCON 2010 L4D2 Contest
Dr. Nano Free for the iPhone and iPod Touch
 
Forums
MODSonline.com Forums
 

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, StrYdeR, techno2sl, batistablr, Welshy, Rasta, supersword, batistablr, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Restricted Access
Page
Next Page
subscribe
Author Topic: Crosshair in thirdperson & xmodel collision
n3BuL
General Member
Since: Nov 10, 2008
Posts: 41
Last: Jan 8, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Friday, Jan. 1, 2010 12: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]
Level 3
Category: CoD2 Scripting
Posted: Friday, Jan. 1, 2010 02:45 pm
Are you using the same images and content as the original author? If you are then you would have to ask permission before getting help however since this is a different game they can't stop you from creating it from scratch so if you have come up with the images and textures yourself then don't worry about asking for permission. Just don't name it the same.
n3BuL
General Member
Since: Nov 10, 2008
Posts: 41
Last: Jan 8, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Friday, Jan. 1, 2010 03:06 pm
Well.. the models are from standard CoD2, and I know I could just rename it to something like.. Cratemod ? .. But I don't want to do that since the person made the mod already for another game, so he should be credited anyways. I'm sending emails to a couple guys, and I might have found the correct one now. If I fail to find him, I will rename it, since the name is pretty much the only thing it has in common (and then of course the concept of players being boxes).

Update: I found the creator of the mod, and got full permission to create this - as long as it remains free and is not for profit of any kind.
n3BuL
General Member
Since: Nov 10, 2008
Posts: 41
Last: Jan 8, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Tuesday, Jan. 5, 2010 07:22 am
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
[IBS]MattY
General Member
Since: Sep 11, 2007
Posts: 208
Last: Mar 9, 2010
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Tuesday, Jan. 5, 2010 07:37 am
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.
n3BuL
General Member
Since: Nov 10, 2008
Posts: 41
Last: Jan 8, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Tuesday, Jan. 5, 2010 07:41 am
Then how about making a map with a couple of scriptmodels dedicated for this problem, and make one of the scriptmodels, go to "self.origin", when a player dies?
Sevenz
General Member
Since: Apr 24, 2006
Posts: 1988
Last: Mar 6, 2010
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Tuesday, Jan. 5, 2010 11:06 am
possible, but you'll need as many collision script_brushmodels as players / dead bodies are on the map
clanhelio
General Member
Since: Aug 30, 2008
Posts: 113
Last: Feb 28, 2010
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Wednesday, Jan. 6, 2010 08:23 pm
You could just start reusing them after a certain number of "dead" boxes are on the map.

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.

And for the crosshair, you can try a makeshift one with a new hud element I suppose.
n3BuL
General Member
Since: Nov 10, 2008
Posts: 41
Last: Jan 8, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Thursday, Jan. 7, 2010 05: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] 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: 113
Last: Feb 28, 2010
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Jan. 8, 2010 01: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.
Restricted Access Restricted Access
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting