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

Members Online

»
0 Active | 7 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
Category: CoD Mapping
CoD mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Script for a gate that opens with a trigger_damage
LennardN95
General Member
Since: Sep 9, 2009
Posts: 35
Last: Oct 26, 2009
[view latest posts]
Level 2
Category: CoD Mapping
Posted: Sunday, Sep. 27, 2009 07:08 pm
ok, i'm noob at scripting, that's why I'm asking you guys for help. Ok here's my idea, I wanna make a script, that if you shoot a texture in, a gate opens.

Now i have a texture named Mushroom, and I placed it in my (test) map. I right clicked on it @ 2D view and made it a Trigger_damage. Then i made the gate and made it a Script_brushmodel.

Mushroom texture:
Classname: Trigger_Damage
Targetname: Mushroom

Gate:
Classname: Script_Brushmodel
Targetname: Gate

Now I made this script (which is obvious wrong):

Quote:

mushroom()
{
trig = getent ("mushroom", "targetname");

while (1)
{
trig waittill ("trigger", user);
user.code = "";
}
}


mushroom_1()
{
code_1 = getent ("mushroom", "targetname");
while (1)
{
code_1 waittill ("trigger", user);
user.code += "1";
}
}

cannon()
{
code_trig = getEnt ("mushroom", "targetname");
code_door = getEnt ("gate", "targetname");

while (1)
{
mushroom waittill ("trigger", user);
if (user.code == "1")
{
user iPrintLnBold ("^2Access Granted");
wait 0.5;
code_door rotateYaw (-90, 2, 0.5, 0.5);
code_door waittill("rotatedone");
wait 5;
code_door rotateYaw (90, 2, 0.5, 0.5);
code_door waittill ("rotatedone");
}
else
{
user iPrintLnBold ("^1Access Denied");
user.code = "";
}
wait 3;
}
}


I used a diff script to make this one, and forgot to change the movements, but i can do that later.

Then I compiled my map, and when I shot the Mushroom, the gate didn't open?

Can anybody please help me?

Thx!
Share |
GomerPyle
General Member
Since: Oct 1, 2006
Posts: 357
Last: Jul 14, 2011
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD Mapping
Posted: Sunday, Sep. 27, 2009 07:49 pm
scripting is not my forte' but it seems to me that you have to have the trigger activated. You can do this by making the trigger damage as you did but then give it a value to trigger when it's shot. The accumulate works for this:

Key: accumulate
value: 20 /or something like that

and then check off what weapons will work with it. Then when the trigger is shot it will start the process you have in your waittill.

I hope that's right
Share |
oppdelta
General Member
Since: Jun 3, 2007
Posts: 143
Last: Apr 27, 2011
[view latest posts]
Level 4
Category: CoD Mapping
Posted: Sunday, Sep. 27, 2009 11:16 pm
NuuuuUU!

A trigger MUST HAVE the trigger texture. Make another brush around ya mushroom or w/e and get it the targetname "trig_mush"

Code:

main()
{
	thread gate();
}

gate()
{
            trigger = getent("trig_mush","targetname")
	while(1)
	{
		trigger waittill("trigger", user)

		user iPrintLnBold ("^2Access Granted");
		wait 0.5;
		gate rotateYaw (-90, 2, 0.5, 0.5);
		gate waittill("rotatedone");
		wait 5;
		gate rotateYaw (90, 2, 0.5, 0.5);
		gate waittill ("rotatedone");
	}
}




Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD Mapping
Posted: Monday, Sep. 28, 2009 12:29 am
you need a gate and a trigger brush. and if i'm not mistaken, it should be trigger waittill("damage"); and not "trigger"
Share |
LennardN95
General Member
Since: Sep 9, 2009
Posts: 35
Last: Oct 26, 2009
[view latest posts]
Level 2
Category: CoD Mapping
Posted: Monday, Sep. 28, 2009 03:48 pm
OK thx for the replies, but it still doesn't work.

Here's what I did.

I selected the trigger texture from ''common'' and made a trigger in front of the mushroom, and made it a trigger_damage surface or entity or whatever its called, targetname: trigger_mush, after pressing enter, I pressed escape to deselect.

Then I selected the gate, and made it a script_brushmodel, targetname: gate.

Then I copied oppdelta's script, and followed Sevenz instruction, so I replaced trigger waittill ("trigger") to trigger waittill ("damage")

I made a .pk3 map, and put it in maps/mp, called trigger_mush.gsc

Then I tested my map, shot to the Mushroom, but nothing happened?
s
Should I ''connect'' the Mushroom and the Gate together? Or did I do anything wrong at scripting? Here's my script.

Quote:
main()
{
thread gate();
}

gate()
{
trigger = getent("trig_mush","targetname")
while(1)
{
trigger waittill("damage", user)

user iPrintLnBold ("^2Access Granted");
wait 0.5;
gate rotateYaw (-90, 2, 0.5, 0.5);
gate waittill("rotatedone");
wait 5;
gate rotateYaw (90, 2, 0.5, 0.5);
gate waittill ("rotatedone");
}
}


I hope you know how to fix.

Thx!
Share |
oppdelta
General Member
Since: Jun 3, 2007
Posts: 143
Last: Apr 27, 2011
[view latest posts]
Level 4
Category: CoD Mapping
Posted: Monday, Sep. 28, 2009 07:33 pm
GRRRR... Maybe on COD4/5 It's "damage" but on vCOD it's "trigger"


Put it back to my way >.>

Oh i forgot to add somthign to the script, use this.

Code:

main()
{
thread gate();
}

gate()
{
trigger = getent("trigger_mush","targetname");
gate = getent("gate","targetname");
while(1)
{
trigger waittill("trigger", user);

user iprintlnbold ("^2Access Granted");
wait .5;
gate rotateYaw (-90, 2, 0.5, 0.5);
gate waittill("rotatedone");
wait 5;
gate rotateYaw (90, 2, 0.5, 0.5);
gate waittill ("rotatedone");
}
}


edited on Sep. 28, 2009 03:34 pm by oppdelta

edited on Sep. 29, 2009 12:12 am by oppdelta
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD Mapping
Posted: Monday, Sep. 28, 2009 08:21 pm
ok "trigger", i don't really know vCoD

but the problem is obvious:

targetname: trigger_mush

trigger = getent("trig_mush","targetname")
Share |
LennardN95
General Member
Since: Sep 9, 2009
Posts: 35
Last: Oct 26, 2009
[view latest posts]
Level 2
Category: CoD Mapping
Posted: Monday, Sep. 28, 2009 08:31 pm
It says: Script Compile Error.
The error in console is: bad syntax.

This is what I did.

I selected the Mushroom, then I made it a trigger_damage
I deselected, and made a common trigger brush around it, and made it a trigger_damage too.

I selected both entities, and entered this:

classname: trigger_damage
targetname: trigger_mush

Then I compiled map, no errors yet.

After that I made a .GSC file with this script:

Quote:
main()
{
thread gate();
}

gate()
{
trigger = getent("trig_mush","targetname");
gate = getent("gate","targetname");
while(1)
{
trigger waittill("trigger", user)

user iprintlnbold ("^2Access Granted");
wait .5;
gate rotateYaw (-90, 2, 0.5, 0.5);
gate waittill("rotatedone");
wait 5;
gate rotateYaw (90, 2, 0.5, 0.5);
gate waittill ("rotatedone");
}
}


And put it in my maps/mp folder of my .pk3 file.

But when I tried to test it, it failed?

Should the gate be a Script_brushmodel?

Thanks for the help!
Share |
LennardN95
General Member
Since: Sep 9, 2009
Posts: 35
Last: Oct 26, 2009
[view latest posts]
Level 2
Category: CoD Mapping
Posted: Monday, Sep. 28, 2009 08:33 pm
Can anybody make me a test map? Like a .pk3 file with the .map file included where you show how it works?

I mean like you quickly make some brushes, doesnt have to be a gate and a mushroom but just some examples, and quickly follow the right instructions and send me?

If so, thank you so much!
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD Mapping
Posted: Monday, Sep. 28, 2009 09:11 pm
if is wasn't clear enough
you missed "ger" in the script:

trigger = getent("trigger_mush","targetname");

if it doesn't accept while(1), which shouldn't happen, use for(;;) instead

missing semicolon:
trigger waittill("trigger", user);

i don't think you can call iprintlnbold on a player entity, but idk vcd that well
user iprintlnbold ("^2Access Granted");
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty : CoD Mapping

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

»