Help with Singleplayer Scripted Objectives please

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
carlpenn
Lance Corporal
Posts: 23
Joined: Wed Nov 13, 2002 12:16 pm

Help with Singleplayer Scripted Objectives please

Post by carlpenn »

Can anyone explain how to go from Objective 1 to Objective 2 in the Singlplayer script...................
I have enclosed my objective script to help see if I have gone wrong.


Level waittill spawn

/////objectives/////

waitthread global/objectives.scr::add_objectives 1 1 "Locate and retreive the documents." $documents.origin
waitthread global/objectives.scr::add_objectives 2 1 "terminate Hermann_Vorschtien." $obj2.origin
end


waitthread global/objectives.scr::add_objectives 1 2 "Locate and retreive the documents." $documents.origin
waitthread global/objectives.scr::add_objectives 2 1 "terminate Hermann_Vorschtien." $obj2.origin
waitthread global/objectives.scr::current_objectives 1


///////////////////////////
objective1:
$documents remove
goto objective

end
///////////////////////////
objective:
waitthread global/objectives.scr::add_objectives 1 3 "Locate and retreive the documents." $documents.origin
waitthread global/objectives.scr::current_objectives 0
iprintln_noloc "You have the documents". Mission Complete"
wait 2
end

(( objective 1 alone in the script will work when i add the following the script ceases to work))


/////Objective 2/////

waitthread global/objectives.scr::add_objectives 2 1 "terminate Hermann_Vorschtien." $obj2.origin
set_objective_pos $Hermann_Vorschtien
waitthread global/objectives.scr::current_objectives 2
thread objective2
end

//////////
objective2:
if (IsAlive $Hermann_Vorschtien)
$Hermann_Vorschtien waittill death
thread mission_complete
end



mission_complete:
waitthread global/objectives.scr::add_objectives 2 2 "terminate Hermann_Vorschtien." $obj2.origin
waitthread global/objectives.scr::current_objectives 0
iprintln_noloc "Hermann_Vorschtien has been terminated. Mission Complete"
wait 2

end

Is there anything wrong here??? i have no idea !!!!!!!!!
Fatz
Private
Posts: 7
Joined: Thu Jun 26, 2003 1:04 pm

Post by Fatz »

I may be wrong, I have'nt messed around with signle player objectives much, but do you need to call on your second objective thread somehow?, you have your 1st objective thread ending before the second can run.

put it into a thread maybe?

Code: Select all

thread objective2 

objective2:
waitthread global/objectives.scr::add_objectives 2 1 "terminate Hermann_Vorschtien." $obj2.origin 
set_objective_pos $Hermann_Vorschtien 
waitthread global/objectives.scr::current_objectives 2 
if (IsAlive $Hermann_Vorschtien) 
{
$Hermann_Vorschtien waittill death 
thread mission_complete 
end 
}
That's kind of a guess though, it just seems as though there's nothing to call on the second objective text to make it run.

I hope this helps.
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

The status attribute component determines how the objective is displayed in the objective list. If this attribute is 1, then the objective is not displayed in the objective list. If this attribute is 2, then the objective is displayed, unchecked (not completed), in the objective list. If this attribute is 3, then the objective is displayed, checked (completed), in the objective list.

The location component is optional and marks a location in the level. When the objective becomes the ?current? objective , the location component is used to set the objective pointer on the HUD compass

I assume that the trigger for the objective1 documents uses a setthread command and that the objectives are done in order .


Level waittill spawn

/////objectives/////

waitthread global/objectives.scr::add_objectives 1 2 "Locate and retreive the documents." $documents.origin
waitthread global/objectives.scr::add_objectives 2 2 "terminate Hermann_Vorschtien." $obj2.origin
waitthread global/objectives.scr::current_objectives 1
end

///////////////////////////

objective1:
$documents remove
waitthread global/objectives.scr::add_objectives 1 3 "Locate and retreive the documents." $documents.origin
waitthread global/objectives.scr::add_objectives 2 2 "terminate Hermann_Vorschtien." $obj2.origin
waitthread global/objectives.scr::current_objectives 2
iprintln_noloc "You have the documents". Mission 1 Complete"
wait 2
goto objective2
end

/////Objective 2/////

objective2:
$Hermann_Vorschtien waittill death
iprintln_noloc "Hermann_Vorschtien has been terminated. Mission Complete"
waitthread global/objectives.scr::add_objectives 1 3 "Locate and retreive the documents." $documents.origin
waitthread global/objectives.scr::add_objectives 2 3 "terminate Hermann_Vorschtien." $obj2.origin
end
carlpenn
Lance Corporal
Posts: 23
Joined: Wed Nov 13, 2002 12:16 pm

Post by carlpenn »

Thanks for your help guys..............I got it working.........i did it as follows



objective1:
$documents remove // The documents will disappear after the player has reached them
goto objective

end
///////////////////////////
objective:
waitthread global/objectives.scr::add_objectives 1 3 "Locate and remove the documents." $documents.origin
waitthread global/objectives.scr::current_objectives 0
iprintln_noloc "You have retrieved the Documents. Objective 1 Complete"
wait 5
thread objective2
end // place a check behind the objective ingame




/////Objective 2/////

waitthread global/objectives.scr::add_objectives 2 1 "terminate Hermann_Vorschtien." $obj2.origin
//this makes the compass point to the officer
set_objective_pos $Hermann_Vorschtien // this makes the officer to be killed an objective
waitthread global/objectives.scr::current_objectives 2
thread objective2
end

objective2:
waitthread global/objectives.scr::add_objectives 2 2 "terminate Hermann_Vorschtien." $obj2.origin
waitthread global/objectives.scr::current_objectives 2
if (IsAlive $Hermann_Vorschtien) // the "if" must be a lower case, MOHAA is case sensitive
{
$Hermann_Vorschtien waittill death
thread mission_complete
end
}



mission_complete:
waitthread global/objectives.scr::add_objectives 2 3 "terminate Hermann_Vorschtien." $obj2.origin
waitthread global/objectives.scr::current_objectives 0 // clears objectives
iprintln_noloc "Hermann_Vorschtien has been killed. Objective 2 Complete"
wait 5
thread objective3
end

/////Objective3/////

waitthread global/objectives.scr::add_objectives 3 1 "Locate the Weapons Store." $obj3.origin // you will find this in
// map
set_objective_pos $obj3 // sets position for compass by targeting script_origin in your .map
waitthread global/objectives.scr::current_objectives 3
end



objective3:
waitthread global/objectives.scr::add_objectives 3 2 "Locate the Weapons Store." $obj3.origin
set_objective_pos $obj3
waitthread global/objectives.scr::current_objectives 3
end




store:
waitthread global/objectives.scr::add_objectives 3 3 "Locate the Weapons Store." $obj3.origin
waitthread global/objectives.scr::current_objectives 0
iprintln_noloc "Take all you can carry soldier. Objective 3 Complete"
Wait 5
thread objective4
end


That seems to work fine.........thanks again folks
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post by LT.BARNES »

yea dude u need to call the thread before hand ie...


exec global/loadout.scr maps/test_HELPINGYOU.scr

main:

waittill prespawn

level.script = maps/test_HELPINGYOU.scr
exec global/bomber.scr
exec global/cabinet.scr
exec global/ai.scr
exec global/exploder.scr

waittill spawn

//*** SET OBJECTIVES

//*** TEMP reset the Objectives portion of the HUD
// waitthread global/objectives.scr::reset_objectives
// waitthread global/objectives.scr::blank_objectives


//*** START THE THREADS

thread scene1

end

scene1:

//*** Called from thread scene1

//*** UPDATE OBJECTIVES TO HELPING THIS GUY

// waitthread global/objectives.scr::add_objectives 1 2 "Kill The man." $man.origin
waitthread global/objectives.scr::add_objectives 1 2 "Kill The Man." $man.origin
thread global/objectives.scr::current_objectives 1


if (IsAlive $man)
$man waittill death

waitthread global/objectives.scr::add_objectives 1 3

thread scene2
end

scene2:

thread scene2_helping_you

end

scene2_helping_you:

//waitthread global/objectives.scr::add_objectives 2 2 "Any Help?." $good_enough?.origin
waitthread global/objectives.scr::add_objectives 2 2 "Any Help?." $good_enough?.origin
thread global/objectives.scr::current_objectives 2

end



This is a script i jus made up on the spot to help u see about calling threads
...prepare for your finest hour...
Fatz
Private
Posts: 7
Joined: Thu Jun 26, 2003 1:04 pm

Post by Fatz »

carlpenn wrote:Thanks for your help guys..............I got it working.........
Cool!, glad you got it working!

:)
Post Reply