I would like to script an sp map for AA with 2 obj's. The 1st one i want is for the player to find explosives. The second i want is the player to blow something up. The second one i can do no prob using the tuts, but adding the first one to find and add the explosives to the inventory, i can't do.
How do i add this into my objectives, get the player there, and add the explosives to my inventory. Then how do i remove this obj, and move to the second one? Any quickie scripts i can try?
Thanks
I still suck at scripting and understanding the scripting language.
Multiple objects
Moderator: Moderators
Multiple objects
PSYCHO - Who you callin a PSYCHO?


Documents
Picking up bombs would be like picking up documents, and there is a tutorial for that. If you want the bombs to show up on the screen (hud) it will be a little harder. Your best bet is to find a singleplay script in the game that has it, and just copy the lines--I think the second mission had it.
I have no problem getting any of these tuts to work on their own, but once i try and add another objective things go screwy.
I tried playing around with the scripting language, but can't get them both to work.
Is there something I can read about having more than 1 objective, and the commands that go with it? Something basic and easy to understand for ppl who have a hard time with scripting.
I tried playing around with the scripting language, but can't get them both to work.
Is there something I can read about having more than 1 objective, and the commands that go with it? Something basic and easy to understand for ppl who have a hard time with scripting.
PSYCHO - Who you callin a PSYCHO?


here is my script. I got both objectives playing, but not properly. I am getting explosives off the start, I know why but don't know how to fix. Plus when 1 obj is complete, it doesn't show the 'x' in the box under objectives tab. Not really for this forum, but explosive2.tik isn't showing in the map when running around.
main:
exec global/ai.scr
exec gloal/friendly.scr
exec global/loadout.scr maps/test_operation_storm.scr
exec global/exploder.scr
exec global/items.scr
level waittill prespawn
exec global/ambient.scr test_operation_storm
level waittill spawn
level.script = "maps test_operation_storm.scr"
//////////////////////////////THREADS
thread truck
thread badguy2move
thread explosive <==========where does this go??
//////////////////////////////PLAYER ITEMS
$player item weapons/m1_garand.tik
$player item weapons/colt45.tik
$player item weapons/M2frag_grenade_sp.tik
$player item items/binoculars.tik
$player ammo rifle 50
$player ammo pistol 25
$player ammo grenade 2
$player useweaponclass rifle
waitthread global/objectives.scr::add_objectives 1 2 "Find some
explosives." $explosive.origin
waitthread global/objectives.scr::add_objectives 2 2 "Bomb the Officers
bike so he can't escape." $obj1.origin
waitthread global/objectives.scr::current_objectives 1
end
///////////////////////EXPLOSIVES
explosive:
$player playsound pickup_explosives
$explosives remove
iprintln "Explosives have been found."
waitthread global/items.scr::add_item "explosive"
waitthread global/objectives.scr::current_objectives 2
goto maingame
end
//////////////////////TRUCK MOVING
truck:
$trk drive $wap
end
///////////////////////BADGUY2 MOVING
badguy2move:
$badguy1 walkto $path1
wait 2
$badguy1 walkto $path2
wait 2
$badguy1 walkto $path3
wait 2
$badguy1 walkto $path4
wait 2
$badguy1 walkto $path5
wait 2
end
////////////////////////////OBJECTIVE SCRIPTING
maingame:
level.bombedbike = 0 //number of bombed bikes
level.bike_bombplanted = 0 //bikes with bombs planted
level.bombsleft = 3 //bombs left
thread bike_bombed
end
//////////////////////////////BOMB THE OFFICERS BIKE
bike_bombed:
$bike_trigger waittill trigger
$bomb model "animate/explosive.tik"
$bomb playsound explosive
level.bike_bombplanted = 1 // will be 1 bike with bomb planted
level.bombsleft--//bombs left after planting, which is original bombs
minus 1
thread explode
end
////////////////////////////////////EXPLODING THE OFFICERS BIKE
explode:
$player loopsound bombtick
$player stopwatch 10 //number of seconds
wait 10
$player stoploopsound bombtick //stop the tick tock sound
$bomb playsound explode_bike
$bomb remove
$bike thread global/vehicles_thinkers.scr::bike_killed
level.bomb_damage = 100 //damage caused
level.bomb_explosion_radius = 512 //radius of effect
thread levelend
end
levelend:
waitthread global/objectives.scr::add_objectives 2 2 "Bomb the
Officers bike so he can't escape." $obj1.origin
waitthread global/objectives.scr::current_objectives 0 //clears
objectives
exec global/missioncomplete.scr
wait 2
end
main:
exec global/ai.scr
exec gloal/friendly.scr
exec global/loadout.scr maps/test_operation_storm.scr
exec global/exploder.scr
exec global/items.scr
level waittill prespawn
exec global/ambient.scr test_operation_storm
level waittill spawn
level.script = "maps test_operation_storm.scr"
//////////////////////////////THREADS
thread truck
thread badguy2move
thread explosive <==========where does this go??
//////////////////////////////PLAYER ITEMS
$player item weapons/m1_garand.tik
$player item weapons/colt45.tik
$player item weapons/M2frag_grenade_sp.tik
$player item items/binoculars.tik
$player ammo rifle 50
$player ammo pistol 25
$player ammo grenade 2
$player useweaponclass rifle
waitthread global/objectives.scr::add_objectives 1 2 "Find some
explosives." $explosive.origin
waitthread global/objectives.scr::add_objectives 2 2 "Bomb the Officers
bike so he can't escape." $obj1.origin
waitthread global/objectives.scr::current_objectives 1
end
///////////////////////EXPLOSIVES
explosive:
$player playsound pickup_explosives
$explosives remove
iprintln "Explosives have been found."
waitthread global/items.scr::add_item "explosive"
waitthread global/objectives.scr::current_objectives 2
goto maingame
end
//////////////////////TRUCK MOVING
truck:
$trk drive $wap
end
///////////////////////BADGUY2 MOVING
badguy2move:
$badguy1 walkto $path1
wait 2
$badguy1 walkto $path2
wait 2
$badguy1 walkto $path3
wait 2
$badguy1 walkto $path4
wait 2
$badguy1 walkto $path5
wait 2
end
////////////////////////////OBJECTIVE SCRIPTING
maingame:
level.bombedbike = 0 //number of bombed bikes
level.bike_bombplanted = 0 //bikes with bombs planted
level.bombsleft = 3 //bombs left
thread bike_bombed
end
//////////////////////////////BOMB THE OFFICERS BIKE
bike_bombed:
$bike_trigger waittill trigger
$bomb model "animate/explosive.tik"
$bomb playsound explosive
level.bike_bombplanted = 1 // will be 1 bike with bomb planted
level.bombsleft--//bombs left after planting, which is original bombs
minus 1
thread explode
end
////////////////////////////////////EXPLODING THE OFFICERS BIKE
explode:
$player loopsound bombtick
$player stopwatch 10 //number of seconds
wait 10
$player stoploopsound bombtick //stop the tick tock sound
$bomb playsound explode_bike
$bomb remove
$bike thread global/vehicles_thinkers.scr::bike_killed
level.bomb_damage = 100 //damage caused
level.bomb_explosion_radius = 512 //radius of effect
thread levelend
end
levelend:
waitthread global/objectives.scr::add_objectives 2 2 "Bomb the
Officers bike so he can't escape." $obj1.origin
waitthread global/objectives.scr::current_objectives 0 //clears
objectives
exec global/missioncomplete.scr
wait 2
end
PSYCHO - Who you callin a PSYCHO?



