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

Members Online

»
0 Active | 76 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: script help please!
ukdjaj
General Member
Since: Jun 1, 2008
Posts: 2726
Last: Nov 15, 2020
[view latest posts]
Level 9
Category: CoD2 Scripting
Posted: Tuesday, Aug. 10, 2010 12:12 pm
ok i am trying to make a script a bit like WaW where as theres a plank of wood, you bash / shoot it it disapears after 20 seconds you can use the trigger use to show the wood again

Code:
main()
{
thread block();
}

block()
{
plank = getent("plank","targetname");
trig_damage = getent("trig_damage","targetname");
trig_use = getent("trig_use","targetname");	
while (1)
{
trig_damage waittill ("trigger");
plank hide();
wait 20;
plank waittill ("movedone");
trig_use waittill ("trigger");
plank show();
plank waittill ("movedone");
}
}


this is my script, i shoot the plank, it disapears but i have 2 errors

1. after 20 seconds it does not show again.
2. it disapears, but it makes it in to chaulk texture (because i cant walk through it)
Share |
ukdjaj
General Member
Since: Jun 1, 2008
Posts: 2726
Last: Nov 15, 2020
[view latest posts]
Level 9
Category: CoD2 Scripting
Posted: Tuesday, Aug. 10, 2010 12:22 pm
Right, i have fixed both of them errors, by using the notsold(); and solid(); function and taking out trig_use waittil ("movedone");

i now have this
Code:
main()
{
thread block();
}

block()
{
plank = getent("plank","targetname");
trig_damage = getent("trig_damage","targetname");
trig_use = getent("trig_use","targetname");	
while (1)
{
trig_damage waittill ("trigger");
plank hide();
plank notsolid();
wait 1;            //change this so i dont have to wait 20 seconds when testing!
trig_use waittill ("trigger");
plank solid();
plank show();
plank waittill ("movedone");
trig_damage waittill ("movedone");
trig_use waittill ("movedone");
}
}


new error though, it works fine but after i show it again i go to shoot it and it does nothing. but it should because

)
)
loops it right so it should start over?

anyway im going to check the introduction to scripting again[crazy] lol to see if i have got it right.

ALL HELP APPRECIATED!

Thanks, Ukdjaj[thumbs_up]
Share |
hyper1234
General Member
Since: Mar 17, 2009
Posts: 358
Last: Apr 14, 2011
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Tuesday, Aug. 10, 2010 12:26 pm
Well, first of all, the hide function does exactly what it says on the tin, it hides it. So its hidden, but still structural.

To solve that, you need to use the function:

Code:
plank delete();


However, then you have deleted it so it won't come back. However, you could use the function:

Code:
plank notsolid();

Then make it solid again as so:
Code:
plank solid();


As for the other issue, your hiding the plank, then waiting 20 seconds and then what? After 20 seconds somebody can press the trigger_use and it shows again? Thats what it looks like.

Maybe try reduce the waiting time to like 5 seconds for testing, wait 5 seconds after it has been hidden, then use the trigger_touch to make it show again and solid. Also, throw an iprintlnbold bold in there to see if when you press the trigger_use it actually works, if it doesn't print anything, the trigger isn't working properly, try the script below (no promises and not tested)

Code:
main()
{
	thread block();
}

block()
{
	plank = getent("plank","targetname");
	trig_damage = getent("trig_damage","targetname");
	trig_use = getent("trig_use","targetname");
	trig_damage show();
	trig_use hide();	

	while (1)
	{
		trig_damage waittill ("trigger");
		plank hide();
		plank notsolid();
		trig_damage hide();
		wait 5;
		trig_use show();
		trig_use waittill ("trigger");
		self iprintlnbold("Test");
		plank show();
		plank solid();
		trig_use hide();
		trig_damage show();
	}
}
Share |
hyper1234
General Member
Since: Mar 17, 2009
Posts: 358
Last: Apr 14, 2011
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Tuesday, Aug. 10, 2010 12:28 pm
ukdjaj writes...
Quote:

new error though, it works fine but after i show it again i go to shoot it and it does nothing. but it should because

)
)
loops it right so it should start over?


No, the

}
}

Closes the the first two sets of { in your script, the

Code:
while(1)
{


Loops it. i thought that might be a probl#em in that it doesn't work over and over.

Share |
ukdjaj
General Member
Since: Jun 1, 2008
Posts: 2726
Last: Nov 15, 2020
[view latest posts]
Level 9
Category: CoD2 Scripting
Posted: Tuesday, Aug. 10, 2010 12:33 pm
so how would i go about looking it at the end of a script?

Code:
			}
		}
	}


and using
Code:
for( ;; )
instead of while(1);? or something else?


edited on Aug. 10, 2010 08:34 am by ukdjaj
Share |
ukdjaj
General Member
Since: Jun 1, 2008
Posts: 2726
Last: Nov 15, 2020
[view latest posts]
Level 9
Category: CoD2 Scripting
Posted: Tuesday, Aug. 10, 2010 12:37 pm
Thanks will try the script now (btw i didnt see your first post) until now =)
Share |
ukdjaj
General Member
Since: Jun 1, 2008
Posts: 2726
Last: Nov 15, 2020
[view latest posts]
Level 9
Category: CoD2 Scripting
Posted: Tuesday, Aug. 10, 2010 12:51 pm
right i tried what you said (but added it to mine didint just copy yours )
Code:
main()
{
thread block();
}

block()
{
plank = getent("plank","targetname");
trig_damage = getent("trig_damage","targetname");
trig_use = getent("trig_use","targetname");
trig_use hide();
trig_damage show();	
while (1)
{
trig_damage waittill ("trigger");
plank hide();
plank notsolid();
trig_damage hide();
wait 1;
trig_use show();
trig_use waittill ("trigger");
iprintlnbold ("test")
plank solid();
plank show();
trig_use hide();
trig_damage show();
plank waittill ("movedone");
trig_damage waittill ("movedone");
trig_use waittill ("movedone");
	}
}

i get a script compile error that says line 24 plank solid();

but when i put // in front of iprintlnbold ("test") it works =)
Share |
ukdjaj
General Member
Since: Jun 1, 2008
Posts: 2726
Last: Nov 15, 2020
[view latest posts]
Level 9
Category: CoD2 Scripting
Posted: Tuesday, Aug. 10, 2010 12:53 pm
NVM that why my stupid fault, i forgot to put ";" at the end of it lol the most basic error =p

anyway i try it loads up fine, when i press the trigger use, "test" comes up on my screen, it just doesnt make it shootable =S any other ideas?
Share |
ukdjaj
General Member
Since: Jun 1, 2008
Posts: 2726
Last: Nov 15, 2020
[view latest posts]
Level 9
Category: CoD2 Scripting
Posted: Tuesday, Aug. 10, 2010 01:00 pm
hmm, i check and double checked the names, there all right, but in the script i tell it to hide at the start, but it doesnt hit at the start of the script so it shouldn't be working, yet when i press it after i have shot the trigger damage it still comes up with test?
Share |
ukdjaj
General Member
Since: Jun 1, 2008
Posts: 2726
Last: Nov 15, 2020
[view latest posts]
Level 9
Category: CoD2 Scripting
Posted: Tuesday, Aug. 10, 2010 01:09 pm
this is what i have so far
Code:
main()
{
thread block();
}

block()
{
plank = getent("plank","targetname");
trig_damage = getent("trig_damage","targetname");
trig_use = getent("trigger_use","targetname");	
for( ;; )
{
trig_damage waittill ("trigger");
trig_use hide();
plank hide();
plank notsolid();
trig_damage hide();
wait 1;
trig_use show();
trig_use waittill ("trigger");
iprintlnbold ("test");
plank solid();
plank show();
trig_use hide();
trig_damage show();
plank waittill ("movedone");
trig_damage waittill ("movedone");
trig_use waittill ("movedone");
	}
}


its back to the start, it sitll says test but it doesn't loop it. how would i loop it?

edited on Aug. 10, 2010 09:17 am by ukdjaj

FYI the hide(); and the show(); dont seem to work for the triggers. so i just did this

Code:
main()
{
thread block();
}

block()
{
plank = getent("plank","targetname");
trig_damage = getent("trig_damage","targetname");
trig = getent("trigopen","targetname");	
trig hide();
for( ;; )
{
trig_damage waittill ("trigger");
plank hide();
plank notsolid();
wait 1;
trig waittill ("trigger");
iprintlnbold ("test");
plank solid();
plank show();
plank waittill ("movedone");
trig_damage waittill ("movedone");
trig waittill ("movedone");
	}
}


BTW should i be using while(1) for my loop at the start or doesnt it matter?
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

»