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

Members Online

»
0 Active | 66 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

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
Next Page
subscribe
Author Topic: 2 triggers, who works after each other
haggis
General Member
Since: Apr 26, 2006
Posts: 109
Last: Mar 8, 2008
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Feb. 17, 2007 04:09 pm
Hey,

I have a problem. I can't script[2guns]

Now my question:

I made a box with a lock. The player must first shot the lock so it breaks and then he can open the box.

Now I make it with 2 triggers. One triggers is a trigger damage for the lock and the other is a trigger use for open the box.

everything on a row:

Trigger damage: Locktrigger1
Brushmodel Lock: Lock1
Trigger use: Boxtrigger1
Brushmodel Box: Box1

Can someone help me with a script, how I can get it works so first he must break down the lock and then open the box??

edited on Feb. 17, 2007 11:11 am by haggis
Share |
rogue722
General Member
Since: Jan 17, 2006
Posts: 175
Last: Mar 29, 2007
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Feb. 17, 2007 05:12 pm
There are some great beginner tutorials on this website. Look around those to find out what everything does. I can help you in this part, it should be very simple, and hopefully this can help you get off to a good start for scripting.

Code:

main()
{
maps\_load::main();

thread box();
}

box()
{
trig_damage = getent("locktrigger1","targetname");
trig_use = getent("boxtrigger1","targetname");
lock = getent("lock1","targetname");
box = getent("box1","targetname");

trig_damage waittill("trigger"); //Waits till it is triggered
trig_damage delete(); //Deletes trigger

//If you want the lock to remove itself from the map
lock delete();

trig_use waittill("trigger");
trig_use delete();
}


Now if you want the lid of the box to open, then you need to create another script_brushmodel and tell it to rotate in the script. Search around the forums/tutorials to find out how to rotate something. Also, make sure that the targetnames match in your script and your map exactly, including case. Hope this helps!

-Rogue
Share |
babycop
General Member
Since: Feb 18, 2006
Posts: 488
Last: Feb 27, 2010
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Saturday, Feb. 17, 2007 05:18 pm
if you want the 2nd trigger to appear only once the 1st trigger has been used:

in your main put this:

trig_use = getent("boxtrigger1","targetname");
trig_use = triggeroff();//disables this trigger for now
thread box();

in your thread:

box()
{
trig_damage = getent("locktrigger1","targetname");
lock = getent("lock1","targetname");
box = getent("box1","targetname");

trig_damage waittill("trigger"); //Waits till it is triggered
trig_damage delete(); //Deletes trigger

//If you want the lock to remove itself from the map
lock delete();

trig_use triggerOn();//enables the trigger to be used now
trig_use waittill("trigger");
trig_use delete();
}
Share |
haggis
General Member
Since: Apr 26, 2006
Posts: 109
Last: Mar 8, 2008
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Feb. 17, 2007 07:22 pm
Hey,

Thanks for the fast reply but it doesn't work.

I get this error:

******* script compile error *******
unknown function: (file 'maps/mp/mp_forest.gsc', line 38)
trig_use triggerOn();//enables the trigger to be used now
*
This is now my code:

Code:
main()
{

maps\mp\_load::main();

setExpFog(0.0001, 0.55, 0.6, 0.55, 0);
// setCullFog(0, 16500, 0.55, 0.6, 0.55, 0);
ambientPlay("ambient_france");

game["allies"] = "british";
game["axis"] = "german";
game["attackers"] = "axis";
game["defenders"] = "allies";
game["american_soldiertype"] = "normandy";
game["german_soldiertype"] = "normandy";

setCvar("r_glowbloomintensity0", ".25");
setCvar("r_glowbloomintensity1", ".25");
setcvar("r_glowskybleedintensity0",".3");

trig_use = getent("triggerdoos1","targetname");
trig_use = triggeroff();
thread doos1();

}

doos1()
{

trig_damage = getent("slottrigger1","targetname");
trig_use = getent("triggerdoos1");
doos1 = getent("doos1","targetname");

trig_damage waittill("trigger");
trig_damage delete(); //Deletes trigger


trig_use = triggeron();
trig_use waittill("trigger");

doos1 rotatepitch (90,0.5);
doos1 waittill ("rotatedone");


}



edited on Feb. 17, 2007 02:32 pm by haggis

edited on Feb. 17, 2007 02:40 pm by haggis
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, Feb. 17, 2007 09:53 pm
[banghead]

By moving trig_use into main, when the script gets to the waittill line it will crash with and undefined error.

The error you are getting now is the statement triggerOn() is a function in maps/ inside a utility script, it's not an embeded command.

Grassy
Share |
haggis
General Member
Since: Apr 26, 2006
Posts: 109
Last: Mar 8, 2008
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Sunday, Feb. 18, 2007 08:55 am
Hi people,

It works fine now, with some help from another guy.

And what Grassy said: triggeron doesn't exist.

Now I made my script so, and it work's perfect after each other:

Code:
main()
{
//hide enz.

	//doos1
	trig_use = getent("triggerdoos1","targetname");
	trig_use hide();
	//doos2

//threads enz

	//doos1
	thread doos1();
	//doos2
}

//scripts

	//doos1
	doos1()
	{

	trig_damage = getent("slottrigger1","targetname");
	trig_use = getent("triggerdoos1","targetname");
	doos1 = getent("doos1","targetname");

	trig_damage waittill("trigger");
	trig_damage delete();


	trig_use show();
	trig_use waittill("trigger");

	doos1 rotateroll (-90,0.5);
	doos1 waittill ("rotatedone");
	trig_use delete();

	}

	//doos2


Now, I have some other questions:

1) Is it possible that I see the hand of the trig use, only when the lock is shot. Now I can see it all the time, or I don't see it because I have delete it in radiant by pressing N.

2) Is it possible that there is something like the hand by trigger use, that is a kind of the same by damage. So you know there is something where you can shoot on?

edited on Feb. 18, 2007 04:02 am by haggis
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Sunday, Feb. 18, 2007 12:13 pm
LOL, ach laddie I like yer doos oi do fur sure.

Yes it is possible, when you hide the trigger it is still there, thats why you see the hand icon.

Allow me a little tweakin of yer doos script if oi may.
What ya need to do move the trig_use away out of the picture until it's time to be used.

Code:
main()
{
	thread _Doos1();
	//I changed the thread name as it not good to have same name as entities, can cause errors.
}

//scripts

	//doos1
	_Doos1()
	{

	trig_damage = getent("slottrigger1","targetname");
	trig_use = getent("triggerdoos1","targetname");
	doos1 = getent("doos1","targetname");

	//store trig_use origin in oldorg
	oldorg = trig_use.origin;
	
	//now move trig_use into Davey Jones Locker
	trig_use.origin = oldorg - (0,0,10000);

	trig_damage waittill("trigger");
	trig_damage delete();

	//bring trig_use back
	trig_use.origin = oldorg;
  
	trig_use waittill("trigger");

	doos1 rotateroll (-90,0.5);
	doos1 waittill ("rotatedone");
	trig_use delete();

	}


See how that goes [thumbs_up]
Grassy

edited on Feb. 18, 2007 07:24 am by WHC_Grassy
Share |
haggis
General Member
Since: Apr 26, 2006
Posts: 109
Last: Mar 8, 2008
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Sunday, Feb. 18, 2007 04:51 pm
Hey,

Thanks for your quick answer. But must I change something in my .map file??

And do you know something about this??

2) Is it possible that there is something like the hand by trigger use, that is a kind of the same by damage. So you know there is something where you can shoot on?
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Monday, Feb. 19, 2007 06:25 am
No you dont have to change anything in your map, I only changed the scripting.

Visual id on trigger_damage ? no, not that I'm aware of anyway.
You could place a trigger_multiple around the chest, and when a player is in the trigger it gives the player a message telling him to "shoot the lock", when the trigger_damage is shot delete the trigger_multiple.

Grassy
Share |
haggis
General Member
Since: Apr 26, 2006
Posts: 109
Last: Mar 8, 2008
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Monday, Feb. 19, 2007 06:44 am
Hey,

Thanks I will try it, but how can I make it so that he tells "shoot the lock". I tried it with a hintstring but that doesn't work
Share |
Restricted Access Topic is Locked
Page
Next 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

»