| Author |
Topic: Hurting player with vehcile |
| WHC_Grassy |
General Member Since: Apr 20, 2005 Posts: 1426 Last: Aug 25, 2007 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Wednesday, Jan. 24, 2007 07:53 pm |
 |
Good one mate
If you are rotating the vehicle then it might pay to add and angle update as well.
//self is the trigger_hurt collected from another thread.
//model is the entity that you want the trigger hurt to follow.
//Call this thread before you start moving the model in other threads.
self thread trackpos(model);
trackpos(model)
{
while(1)
{
self.origin = model.origin;
self.angles = model.angles;
wait(0.1);
}
}
To reuse the whole lot again more than once, in the early stages of the script set level variables that define the starting origins of each part, then instead of deleting them just move them to some position in the map out of players view (below the ground maybe).
Next time you need them reposition them back to those start origins.
For single player maps this wont be an issue as you probably would only run it once.
Grassy |
 |
|
|
| FlesyM |
General Member Since: Jul 24, 2005 Posts: 399 Last: Jan 24, 2008 [view latest posts] |
|
|
|
|
| WHC_Grassy |
General Member Since: Apr 20, 2005 Posts: 1426 Last: Aug 25, 2007 [view latest posts] |
|
|
|
|
| Spikenaylor |
General Member Since: Oct 12, 2004 Posts: 163 Last: Feb 22, 2009 [view latest posts] |
|
|
|
|
| Spikenaylor |
General Member Since: Oct 12, 2004 Posts: 163 Last: Feb 22, 2009 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Tuesday, Jan. 30, 2007 06:17 am |
 |
|
 |
|
|
| Spikenaylor |
General Member Since: Oct 12, 2004 Posts: 163 Last: Feb 22, 2009 [view latest posts] |
|
|
|
|
| Spikenaylor |
General Member Since: Oct 12, 2004 Posts: 163 Last: Feb 22, 2009 [view latest posts] |
|
|
|
|
| dixie265 |
General Member Since: Feb 15, 2006 Posts: 30 Last: Apr 4, 2007 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Wednesday, Feb. 28, 2007 12:51 am |
 |
WHC_Grassy writes...Quote: Success!!
Having a celebratory drink! ![[drink]](images/BBCode/smilies/drink.gif)
It was so simple I dont know why I didnt think of it ages ago.
Note this WORKS FOR ALL TRIGGERS _damage _hurt _multiple _use etc etc, BUT you must have a small origin textured brush as part of the trigger makeup for origin tracking.
//self is the trigger_hurt collected from another thread.
//model is the entity that you want the trigger hurt to follow.
//Call this thread before you start moving the model in other threads.
self thread trackpos(model);
trackpos(model)
{
while(1)
{
self.origin = model.origin;
wait(0.1);
}
}
If you want the trigger to follow just in front of a vehicle then you might need to place a script_origin there and link that to the vehicle first, then track the origin of the script_origin (which would be model is this case), that way the trigger_hurt will stay at the front of the vehicle instead of the centre origin of the vehicle.
Grassy
Hi al , im ne wto scripting and i can not work this out can someone point me in the right direction please as i must have it work ? thanxs ..heres my script
main()
{
thread cabin_slider ();
}
cabin_slider()
{
cabin = getent("cabin","targetname");
trigger = getent("move_left","targetname");
while(1)
{
trigger waittill ("trigger");
move_left thread trackpos(cabin);
cabin playsound ("gate");
wait (1);
cabin movex (880,8,1,1);
cabin waittill ("movedone");
}
}
trackpos(cabin)
{
while(1)
{
move_left.origin = cabin.origin;
wait(0.1);
}
} |
 |
|
|
| WHC_Grassy |
General Member Since: Apr 20, 2005 Posts: 1426 Last: Aug 25, 2007 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Wednesday, Feb. 28, 2007 06:32 am |
 |
You didn't pass control of the trigger alias, you used the actual targetname of the trigger (which is wrong, always use the alias you defined).
Also don't edit the trackpos thread, no need to match names with yours, the variables in trackpos will adopt them.
For eg "self" in the function is your trigger, and "model" is the object you want the trigger to follow, in this case "cabin".
Code:
main()
{
thread cabin_slider ();
}
cabin_slider()
{
cabin = getent("cabin","targetname");
trigger = getent("move_left","targetname");
while(1)
{
trigger waittill ("trigger");
//trigger is your trigger alias, cabin is your entity alias
trigger thread trackpos(cabin);
cabin playsound ("gate");
wait (1);
cabin movex (880,8,1,1);
cabin waittill ("movedone");
}
}
trackpos(model)
{
while(1)
{
self.origin = model.origin;
wait(0.1);
}
}
Grassy
edited on Feb. 28, 2007 01:36 am by WHC_Grassy |
 |
|
|
| dixie265 |
General Member Since: Feb 15, 2006 Posts: 30 Last: Apr 4, 2007 [view latest posts] |
|
|
|
|
|
|
mp_TempleCall of Duty: Mods: Multiplayer (624.12Kb)
|