Multiple document objectives?

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Multiple document objectives?

Post by GrimReaper »

Alright,I already have one objective which is for allies to steal...and I was woundering if I can make it so they have to steal two different plan objectives to steal? Here is what I got for my script and woundering if someone could just copy and paste it and put what I need for this to work in it and RE it back and copy it:P...if not just explain where for me to put it.

Code: Select all

// Custom objective test map 
// ARCHITECTURE: GrimReaper 
// SCRIPTING: GrimReaper 
main: 

   setcvar "g_obj_alliedtext1" "Steal the documents." 
   setcvar "g_obj_alliedtext2" "- Go get them" 
   setcvar "g_obj_alliedtext3" "- U know U want to" 
   setcvar "g_obj_axistext1" "Prevent the allies" 
   setcvar "g_obj_axistext2" "from stealing the" 
   setcvar "g_obj_axistext3" "documents." 

   setcvar "g_scoreboardpic" "none" 

   level waittill prespawn 

   // There is no OBJprecache.scr 
   exec global/DMprecache.scr 

   level.script = maps/obj/objtest.scr 

   // m6l1a is a blowing wnind sound 
  exec global/ambient.scr obj_team2 

   level waittill spawn 

   // Set the parameters for round based match 
   level.dmrespawning = 0 // 1 or 0 (0=no respawn) 
   level.dmroundlimit = 5 // round time limit in minutes 
   level.clockside = axis // axis, allies, kills, or draw 

   // Comment out this line to be able to set the bomb 
   // when alone on the map ( just for testing ) 
//   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) { // forever 
      // Dont execute past this line 
      // until someone triggers the object 
      $documents_trigger waittill trigger 
      // parm.other is the triggerer 
      if(parm.other.dmteam == allies) { 
         // Make the document graphix disappear 
         $documents hide 
         // break out of the while loop 
         break 
      } 
      // protection against making this 
      // thread use too much CPU 
      waitframe 
   } 
   teamwin allies // Make allies win the match 
end // end allies victory test
User avatar
Axion
Major General
Posts: 683
Joined: Mon Sep 29, 2003 5:14 am
Location: Northern California
Contact:

Post by Axion »

You probably should have posted this in the scripting forum... :wink:
"The work of a thousand years is nothing but rubble."
- Dr. Carl Goerdeler (1943)
Visit my mapping site: http://www.freewebs.com/axion9
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

You are in luck, as I also made a follow up tutorial on my bomb and docs tutorials, called Multiple multiplayer objectives... it handles any number of documents.
Admin .MAP Forums
Image
Head above heels.
User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Post by GrimReaper »

K,I got all the little triggers and the panel already and everything but on the scripting...how would i put it all together using the script which is for the documents.The script for the documents is up some replies in this post,Honestly I think it would be better if someone else did it for me because it will just take longer if I did it as, Bjarne knows from my stealing objectives post:P
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Did you read this post above?
Bjarne BZR wrote:You are in luck, as I also made a follow up tutorial on my bomb and docs tutorials, called Multiple multiplayer objectives... it handles any number of documents.
That tutorial handles how multiple docs are scripted.
Admin .MAP Forums
Image
Head above heels.
User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Post by GrimReaper »

My bad guess I didnt make that post as good as I had thought for the intended effect.Well what I meant was that I have no idea where to put all those little scripts that are on the tut. page.I downloaded the .scr file and the other different things it came with. Woundering does that .scr work for the control panel blowing up and the ONE set of ducments that I made?...if so then I already know what to do.If not where would I put all those scripts that you made on tutorial page in my .scr file?
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Just so I know what experince you have: Do you know anything about how scripting works, or do you copy existing code and hope it works?
Admin .MAP Forums
Image
Head above heels.
User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Post by GrimReaper »

I dont know idsactly how it works but I dont just copy it unless I REALLY dont know what to do.Like now.
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

I won't do it for you but I will walk you through the process...'

OK, lets start from the top.

1) What do you have and what do you want it to do?

As I understand it, you have followd my bomb and script objective, and you have one bomb and 2 document objectives... right or wrong?
Admin .MAP Forums
Image
Head above heels.
User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Post by GrimReaper »

Alright,what I want to do is...make a document objective and the control panel objective for the allies both to steal and destroy...I have the scirpting done for the documents,thanks to you...I have the documents all done and they work.I have the control panel done execpt for the script...what I need to know is how to make this script

Code: Select all

// Custom objective test map 
// ARCHITECTURE: GrimReaper 
// SCRIPTING: GrimReaper 
main: 

   setcvar "g_obj_alliedtext1" "Steal the documents." 
   setcvar "g_obj_alliedtext2" "- Go get them" 
   setcvar "g_obj_alliedtext3" "- U know U want to" 
   setcvar "g_obj_axistext1" "Prevent the allies" 
   setcvar "g_obj_axistext2" "from stealing the" 
   setcvar "g_obj_axistext3" "documents." 

   setcvar "g_scoreboardpic" "none" 

   level waittill prespawn 

   // There is no OBJprecache.scr 
   exec global/DMprecache.scr 

   level.script = maps/obj/objtest.scr 

   // m6l1a is a blowing wnind sound 
  exec global/ambient.scr obj_team2 

   level waittill spawn 

   // Set the parameters for round based match 
   level.dmrespawning = 0 // 1 or 0 (0=no respawn) 
   level.dmroundlimit = 5 // round time limit in minutes 
   level.clockside = axis // axis, allies, kills, or draw 

   // Comment out this line to be able to set the bomb 
   // when alone on the map ( just for testing ) 
//   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) { // forever 
      // Dont execute past this line 
      // until someone triggers the object 
      $documents_trigger waittill trigger 
      // parm.other is the triggerer 
      if(parm.other.dmteam == allies) { 
         // Make the document graphix disappear 
         $documents hide 
         // break out of the while loop 
         break 
      } 
      // protection against making this 
      // thread use too much CPU 
      waitframe 
   } 
   teamwin allies // Make allies win the match 
end // end allies victory test
into a a script(.scr file) that works for the control panel and the douments...from what I know which isnt much is I probibly cant have 2 different .scr files?
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

No, there is no need for 2 scripts. The script you have should work for one document, but you want the allies to win only after blowing up one panel AND stealing one document, right?

And because you are talking about a panel, I take it that you have read and, at least mostly understood both my bomb and document tutorials?

Your problem is that you do not understand how to combine them, even after reading the tutorial on how to combine them?

If all this is true, we can start :)
Admin .MAP Forums
Image
Head above heels.
User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Post by GrimReaper »

All is true! :lol:.dont know how to combine there scripts
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Alrihgty then...

What your scritpt is missing is the code for the bomb:
So if you look at the bomb tutorial you vill see a lot of stuff... i take it that you have done all this stuff as instructed ( triggers, script_model's and stuff like that ), and you have trouble incorporating the stuff into your script...
So lets take a look at the scripting section of the tutorial:
Copy the red stuff in that main method and place it in the same places in your script ( same place in reference to the level waittill XXX commands ) the main method ends with the first red "end", don't copy that and nothing after it.

Now you have a working bomb ( if you followed the tutorials correctly ).

But you cant win by blowing it, right? No you cant.

Lets fix that while we are at it:
Copy the complete 'allies_win_bomb' method ( everything from allies_win_bomb to the next end ) and place it last in your file ( that is: after the last end in your file ).

Try that. If you have done the tutorials correctly, the allies should now be able to win by either blowing the bomb or stealing the documents. Does that work?

( I kow you want the allies to win after completing BOTH, but both objectives must work first, right ;) I'll help you with that when you have them both working )
Admin .MAP Forums
Image
Head above heels.
User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Post by GrimReaper »

Alright,sry took me so long to reply but I had to go somewhere.Question,where it sais

Code: Select all

$panel_bomb thread global/obj_dm.scr::bomb_thinker 
obj_dm do I put the name of my .scr there?Also when scripting does it matter how much space is between the lines? like from

Code: Select all

level waittill spawn


to......

Code: Select all

level.defusing_team = "axis" // Axis like the bombs unplanted
level.planting_team = "allies" // Allies will try to plant the bombs
level.targets_to_destroy = 1 // Number of targets in this map
level.bomb_damage = 200 // Default damage of the bomb
level.bomb_explosion_radius = 2048 // Default radius of bomb blast


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

Post by Bjarne BZR »

GrimReaper wrote:

Code: Select all

$panel_bomb thread global/obj_dm.scr::bomb_thinker 
obj_dm do I put the name of my .scr there?
No, that line goes in as it is. It means start a new thread and let it call the method "bomb_thinker" in the script named "obj_dm.scr" in the "global" directory, and make the object "$panel_bomb" accessible to that thread by accessind the "self" object. ( thats probably WAY more than you needed to know ;) )
GrimReaper wrote:Also when scripting does it matter how much space is between the lines? like from

Code: Select all

level waittill spawn


to......

Code: Select all

level.defusing_team = "axis" // Axis like the bombs unplanted
level.planting_team = "allies" // Allies will try to plant the bombs
level.targets_to_destroy = 1 // Number of targets in this map
level.bomb_damage = 200 // Default damage of the bomb
level.bomb_explosion_radius = 2048 // Default radius of bomb blast
that?
If you are talking about empty lines in the file: You can have as many as you like, MOH:AA does not care.
If you are NOT talking about empty lines in the file: I have no idea what you are talking about... ask again.
Admin .MAP Forums
Image
Head above heels.
Post Reply