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

Members Online

»
0 Active | 10 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

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, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Previous Page
subscribe
Author Topic: Hurting player with vehcile
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Wednesday, Jan. 24, 2007 07:53 pm
Good one mate [thumbs_up]

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
Share |
FlesyM
General Member
Since: Jul 24, 2005
Posts: 399
Last: Jan 24, 2008
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Saturday, Jan. 27, 2007 12:34 am
that's very cool ... but ... any of you have a good idea on how to implement that in mp so that it's fun ?
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Saturday, Jan. 27, 2007 02:05 am
Yeah I did it in Island_Madness, I had a few sharks roaming around in the water that you could ride on so long as you didnt get near the front of them. :)

For vehicles, a city type map could have trucks traveling around it, going to and from store houses etc, have them stop now and then at certain spots to allow players to get in the back of them.
You could also have a few trucks pass over a spot where you need to stand to plant objectives (mwaaa! :-) ) the planting player would not only have to keep an eye out for the other team but also for moving vehicles that can run him over.

Grassy
Share |
Spikenaylor
General Member
Since: Oct 12, 2004
Posts: 163
Last: Feb 22, 2009
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Jan. 27, 2007 10:35 am
Give me a few days more, I have almost finished a tutorial map with a couple of moving hurting vehicles in for demo.
Share |
Spikenaylor
General Member
Since: Oct 12, 2004
Posts: 163
Last: Feb 22, 2009
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Tuesday, Jan. 30, 2007 06:17 am
Check out the tutorial map I just posted,

Creating moving vehicles that can hurt players
Share |
Spikenaylor
General Member
Since: Oct 12, 2004
Posts: 163
Last: Feb 22, 2009
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Tuesday, Jan. 30, 2007 04:22 pm
Hi

Sorry for the errors the IWD is throwing up, all my fault and I humbly apologise, A fixed version has been uploaded and will be available once admins have checked it.
Share |
Spikenaylor
General Member
Since: Oct 12, 2004
Posts: 163
Last: Feb 22, 2009
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Tuesday, Jan. 30, 2007 09:28 pm
This is the updated fixed file download Page.

Creating moving vehicles that can hurt players
Share |
dixie265
General Member
Since: Feb 15, 2006
Posts: 30
Last: Apr 4, 2007
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Wednesday, Feb. 28, 2007 12:51 am
WHC_Grassy writes...
Quote:
Success!!
Having a celebratory drink! [drink]
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);
}
}
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
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
Share |
dixie265
General Member
Since: Feb 15, 2006
Posts: 30
Last: Apr 4, 2007
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Wednesday, Feb. 28, 2007 08:48 am
Doh!! [rolleyes] something so simple but i couldnt see it for looking ! thanxs grassy [rocking]
Share |
Restricted Access Topic is Locked
Page
Previous Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»