Stealing Papers OBJ

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
spy0012
Sergeant
Posts: 53
Joined: Thu Jun 17, 2004 10:09 pm

Stealing Papers OBJ

Post by spy0012 »

I am using the tutorial on this page : http://map.moh-central.net/t.php?id=31

I have done the two map edits and compiled the map and copied and pasted the code into a new scr for testing and all it does is loop the allies win, so basically i don't get to do the obj can anyone help me please.

I need this to work before i can add any more objectives
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Post your script within CODE tags, you may have gotten errors when copy pasting it from the tutorial.

Are you getting any errors in the console?
Admin .MAP Forums
Image
Head above heels.
spy0012
Sergeant
Posts: 53
Joined: Thu Jun 17, 2004 10:09 pm

Post by spy0012 »

Code: Select all


// Custom objective test map
// ARCHITECTURE: Bjarne Gr?nnevik
// SCRIPTING: Bjarne Gr?nnevik

main:


setcvar "g_obj_alliedtext1" "Steal the documents." 
setcvar "g_obj_alliedtext2" "- Go get them"
setcvar "g_obj_alliedtext3" "- U know U what to" 
setcvar "g_obj_axistext1" "Prevent the allies"
setcvar "g_obj_axistext2" "from stealing the"
setcvar "g_obj_axistext3" "documents (Please?)."
setcvar "g_scoreboardpic" "none"

level waittill prespawn


exec global/DMprecache.scr
level.script = maps/obj/mp_farm_house_obj.scr // Change to the name of you'r map file
exec global/ambient.scr 


level waittill spawn:

level.dmrespawning = 0 // 1 or 0 (0=no respawn)
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw

// level waittill roundstart

thread desk_document_check // Start the win check thread for allies
level waittill axiswin // If the end of the match is reached, the Axis win


end // end of main

// Document checks

desk_document_check: 

while(1) 
{ // As long as 1 equals 1 ( that would be forever ) $documents_trigger waittill trigger // Dont execute past this line until someone triggers the object
if (parm.other.dmteam == allies) 
{ // parm.other is the triggerer ( testing here to ensure only allies can complete the ojective )
$documents hide // Make the document graphix disappear 
break // break out of the while loop 
} 
waitframe // protection against making this thread use too much CPU 
}
teamwin allies // Make allies win the match
end // end allies victory test
That is my scr copied and pasted, i can't see any differences. I don't get any errors in console either just allies win everytime.
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

One error is this:

Code: Select all

level waittill spawn:
...it should be:

Code: Select all

level waittill spawn
Try correcting that first.
Admin .MAP Forums
Image
Head above heels.
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Oh, crap. Spotted it.

The script should be like this:

Code: Select all

// Custom objective test map
// ARCHITECTURE: Bjarne Gr?nnevik
// SCRIPTING: Bjarne Gr?nnevik

main:

	setcvar "g_obj_alliedtext1" "Steal the documents."
	setcvar "g_obj_alliedtext2" "- Go get them"
	setcvar "g_obj_alliedtext3" "- U know U what to"
	setcvar "g_obj_axistext1" "Prevent the allies"
	setcvar "g_obj_axistext2" "from stealing the"
	setcvar "g_obj_axistext3" "documents (Please?)."
	setcvar "g_scoreboardpic" "none"

	level waittill prespawn

	exec global/DMprecache.scr
	// Change to the name of you'r map file
	level.script = maps/obj/mp_farm_house_obj.scr
	exec global/ambient.scr

	level waittill spawn:

	level.dmrespawning = 0 // 1 or 0 (0=no respawn)
	level.dmroundlimit = 5 // round time limit in minutes
	level.clockside = axis // set to axis, allies, kills, or draw

	// level waittill roundstart

	// Start the win check thread for allies
	thread desk_document_check
	// If the end of the match is reached, the Axis win
	level waittill axiswin

end // end of main

// Document checks
desk_document_check:

	while(1)
	{ // As long as 1 equals 1 ( that would be forever )
		// Dont execute past this line until
		// someone triggers the object
		$documents_trigger waittill trigger
		if (parm.other.dmteam == allies)
		{
			// parm.other is the triggerer ( testing here to
			ensure only allies can complete the ojective )
			// Make the document graphix disappear
			$documents hide
			break // break out of the while loop
		}
		// protection against making this thread use too much CPU
		waitframe
	}
	// Make allies win the match
	teamwin allies
end // end allies victory test
...the line:

Code: Select all

$documents_trigger waittill trigger 
...has ended up after the comment on the line before, ad is therefore never executed :shock:
Admin .MAP Forums
Image
Head above heels.
spy0012
Sergeant
Posts: 53
Joined: Thu Jun 17, 2004 10:09 pm

Post by spy0012 »

I don't understand what ur saying and i can't see any differences in the code, can you change it and show me, i know some basic scripting but if i can't get a tutorial to work by copy and paste i ain't going to get any to work.

Regards
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

In your script, the text:

Code: Select all

$documents_trigger waittill trigger
...is not on a separate line.
It should be, but it was wrong in the tutorial, and I have updated it now.
Look at this original version of the same tutorial instead, it does not have the error: http://gronnevik.se/rjukan/index.php?n= ... ctiveTheft
Admin .MAP Forums
Image
Head above heels.
spy0012
Sergeant
Posts: 53
Joined: Thu Jun 17, 2004 10:09 pm

Post by spy0012 »

Cheers Bjarne BZR,

That worked perfectly, do you have any other tuts for taking the docs to a radio to extend that objective or something similar.

Thanks for what u done works great now.

If anyone knows why when i blow up a door, door being an object stops people walking through the door way, sort of a hidden door there after being Blown up.
User avatar
knuko
Lance Corporal
Posts: 19
Joined: Tue Feb 15, 2005 10:20 am

hi

Post by knuko »

AVATAR TEST :D :P :roll:
Hey, i gonna learn scripting :)
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

spy0012 wrote:That worked perfectly, do you have any other tuts for taking the docs to a radio to extend that objective or something similar.
Got some tuts on combining objective types on my site: http://gronnevik.se/rjukan/
Admin .MAP Forums
Image
Head above heels.
spy0012
Sergeant
Posts: 53
Joined: Thu Jun 17, 2004 10:09 pm

Post by spy0012 »

Your site helped me, some reason the tut on here for combining didn't work for me but tried yours and it worked, but any way scripting has changed somewhat now and coming on good.

Wish to thank you guys for the help in pointing me in the right direction i am learning more now,

Thanks
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Glad to help :D
Admin .MAP Forums
Image
Head above heels.
Post Reply