Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds
Watch MODSonair

Members Online

»
0 Active | 15 Guests
Online:

LATEST FORUM THREADS

»
Kharkov xmodels
CoD+UO General
Node is floating???
CoD4 SP Mapping
new scripter cod4
CoD4 Scripting
[Release]SP East Prussian ...
CoD2 Map + Mod Releases

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 4
Category: CoD4 MP Mapping
CoD 4 mapping and level design for multiplayer.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Restricted Access
Page
Previous Page
subscribe
Author Topic: Can Brushmodels take a Players Damage/Health?
DeekCiti
General Member
Since: Mar 12, 2008
Posts: 1245
Last: Jun 13, 2013
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Tuesday, Apr. 22, 2008 01:26 pm
ok, your right, I forgot/missed one...

Code:

main()
{
	thread metal_blade();
}

metal_blade()
{
	bladetrigger = getentarray("metal_blade_trig","targetname");
	for(i=0;i<bladetrigger.size;i++)
		bladetrigger[i] thread blade_think();
}

blade_think()
{
	self.blademoving = false;
	self.bladeclosed = true;
	self.blademodel = getent(self.target, "targetname");
	while (1)
	{
		self waittill("trigger");
		if(!self.blademoving)
			self thread blade_move();
	}
}

blade_move()
{
	iPrintln("test1");
	self.blademodel thread kill_players();
	self.blademoving = true;
	if(self.bladeclosed)
	{
		self.blademodel playsound ("blade_slice");
		self.blademodel rotateyaw(180, 4, 0.5, 0.5);
		self.blademodel waittill("rotatedone");
//		self.bladeclosed = false;
//	}
//	else
//	{
		self.blademodel playsound ("blade_slice");
		self.blademodel rotateyaw(-180, 4, 0.5, 0.5);
		self.blademodel waittill("rotatedone");
		self.bladeclosed = true;
	}
	self.blademoving = false;
}

kill_players()
{
	iPrintln("test2");
	self endon("rotatedone");
	while(1)
	{
		iPrintln("test3");
		players = getentarray("player","classname");
		for(i=0;i<players.size;i++)
		{
			iPrintln("test4");
			if(players[i].sessionstate != "playing")
				continue;
			iPrintln("test5");
			if(players[i] isTouching(self))
			{
				iPrintln("player killed");
				players[i] suicide();
			}
		wait 0.05;
		}
	}
}


but it only prints the 3,4,5 and not player killed

Still doesn't kill player. Although its the same, just a iPrint added.

So does this mean isTouching won't work for a script brushmodel?

You think this can work?
Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1408
Last: Jun 11, 2013
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Tuesday, Apr. 22, 2008 01:57 pm
hmm, ok so the istouching dont work for script_brushmodels [sad]

plan B:
make a brush covering the blade and texture tools > trigger, make a second one for the origin and texture tools > origin (put origin is same place as the blade origin)

select the to brushes u just made > right click > trigger > hurt
give it a dmg value

unselect everything

select the blade (just 1 brush of it will do) and the trigger

press W

and use this script

Code:
<br />
main()<br />
{<br />
	thread metal_blade();<br />
}<br />
<br />
metal_blade()<br />
{<br />
	bladetrigger = getentarray("metal_blade_trig","targetname");<br />
	for(i=0;i<bladetrigger.size;i++)<br />
		bladetrigger[i] thread blade_think();<br />
}<br />
<br />
blade_think()<br />
{<br />
	self.blademoving = false;<br />
	self.bladeclosed = true;<br />
	self.blademodel = getent(self.target, "targetname");<br />
	kill_trig = getent(self.blademodel.target, "targetname");<br />
	kill_trig enablelinkto();<br />
	kill_trig linkto(self.blademodel);<br />
	while (1)<br />
	{<br />
		self waittill("trigger");<br />
		if(!self.blademoving)<br />
			self thread blade_move();<br />
	}<br />
}<br />
<br />
blade_move()<br />
{<br />
	self.blademoving = true;<br />
	if(self.bladeclosed)<br />
	{<br />
		self.blademodel playsound ("blade_slice");<br />
		self.blademodel rotateyaw(180, 4, 0.5, 0.5);<br />
		self.blademodel waittill("rotatedone");<br />
//		self.bladeclosed = false;<br />
//	}<br />
//	else<br />
//	{<br />
		self.blademodel playsound ("blade_slice");<br />
		self.blademodel rotateyaw(-180, 4, 0.5, 0.5);<br />
		self.blademodel waittill("rotatedone");<br />
		self.bladeclosed = true;<br />
	}<br />
	self.blademoving = false;<br />
}<br />


Share |
DeekCiti
General Member
Since: Mar 12, 2008
Posts: 1245
Last: Jun 13, 2013
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Tuesday, Apr. 22, 2008 04:46 pm
Sorry I had to go pick up someone from work... just got back and tested it.

Thanks for the reply and explanation, and !

[thumbs_up] Genius

Works like a charm! Very nice work .KiLL3R., can't thank you enough for helping me out.

So all you did was add the 3 kill_trig/linkto lines... ? Looks as to be. So does this mean you can add these three lines to anything similar to this to kill with a trigger that moves with the brushmodel? I'll try this method with some other booby traps. I don't see why it wouldn't work with other ideas.

Anyways, thanks again, works great!
Share |
Larrabee
General Member
Since: Feb 5, 2010
Posts: 113
Last: Aug 23, 2012
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Sunday, Jun. 10, 2012 07:21 pm
Old post -but it worked great! Thanks
Share |
Restricted Access Restricted Access
Page
Previous Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 MP Mapping

Latest Syndicated News

»
Codutility is for sale!
Seems like a plan to save Codutility ..Quote:Well guys I heard what you said...
Codutility is for sale!
Well as modding dies, so does the sites that support it.. Its a sad sad day,...
Codutility is for sale!
Quote:Codutility is for sale! Yes, you read well. Codutility ( sites/do...
Why console gaming is dying
Quote:Consider this: Dedicated gaming sales — including living-room consoles...
Devs: Games are being dumb...
Click 'read more' to view the contents of this post.

Partners & Friends

»