SCRIPT wm_objective_status/wm_set_main_objective


(eRRoLfLyNN) #1

This is not urgent, I just want to understand what this part of the script actually means.

wm_objective_status - this means the state of the objective?

so i see a series of numbers like this:

wm_objective_status 1 0
does this mean the map has 1 objective which hasn’t been completed yet?

wm_objective_status 1 1
would this then mean the map has 1 objective which has been completed?

When there are 3 numbers after wm_objective_status, what is that about?

Take this for example:

	wm_objective_status 1 1 0
	wm_objective_status 1 0 0
	wm_objective_status 2 1 0
	wm_objective_status 2 0 0
	wm_objective_status 3 0 0
	wm_objective_status 3 1 0
	wm_objective_status 4 0 0
	wm_objective_status 4 1 0
	wm_objective_status 5 0 0
	wm_objective_status 5 1 0
	wm_objective_status 6 0 0
	wm_objective_status 6 1 0

	wm_set_main_objective		1	0
	wm_set_main_objective		1	1

Wtf does this mean?!! lol

I want to know because I am basically copying and pasting these parts of scripts, but I have no idea what their function is. Some of the tutorials I’ve been trying for collectibles aren’t working and I’m trying to figure out why. I’m wondering if I have set the objective’s state properly. Maybe I will post my own script when I get home. I am rambling now…

Just a general explanation of these terms is what I’m after:

wm_set_main_objective
wm_objective_status

They sound self-explanatory, but it’s the numbers after them that throw me. How do the numbers work? Apologies again for the nOOb questions…



(Loffy) #2

Hi!
Scripting rulez!

wm_objective_status 1 1 0
wm_objective_status 1 0 0

I think it is: objective number, team and status.
So, in this case it is:

wm_objective_status 1 1 0 : objective 1, team Allies, status 0 (they have not yet accomplished that task).
wm_objective_status 1 0 0 : The same, but for team Axis.

When the Allies have completed objective 1, the script will say:
wm_objective_status 1 1 1
wm_objective_status 1 0 0
“And what for?”, one might ask. Remember the little text field in the lower part of the limbomenu, where the objectives are described? These lines of script controls the red cross (objecctive not accomplished) and the green dash (objective completed).
The actual text itself (the text in that little field in the limbo) comes from the script file called “mapname.objdata”. It may have the following lines of text:

//-------------------------- Axis Objective Descriptions
wm_objective_axis_desc 1 “Primary Objective:*Steal the Documents!”
//-------------------------- Allied Objective Descriptions
wm_objective_allied_desc 1 “Primary Objective:*Defend the Documents!”

The .objdata file goes into the maps folder.

Are these descriptions necessary? Yes and no. The game is playable without them. However, I find them helpful when I play a new custom map. At the beginning of the match, I browse these descriptions to get a rough picture of what should be done. I also have a quick look at the command map to see what is where.

The wm_set_main_objective command I just use in my scripts. I have never fully understood it, so I leave that one to someone else to elaborate.
// Loffy


(eRRoLfLyNN) #3

lol, thanks for the quick response Loffy. :clap:

What you’ve said makes sense. Before, I was just kind of looking at random numbers. At least now I know what they relate to! Glad they aren’t really necessary too, so I can take them out of my script and concentrate on the bits that aren’t working. Then maybe put them in at the end.

re wm_set_main_objective
I take it this is the one that controls whether the game has been won or lost. So i need to play with that one.

{
Basically, I have a collectible objective which can be be picked up and taken to the receiving trigger. But when I get there, the green & white icon disappears, but nothing else happens. No “Allies have escaped with…” or ALLIES WIN screen, even though these lines are in the code.

I don’t know how to call the line:
trigger allies_win - that routine has the endgame lines in it.
I don’t know how to say - when obj gets here, run routine allies_win
Is it from the death of the receiving trigger? how do you refer to the trigger? - none of the tutorials say to give it a scriptname. Is there a generic name for this trigger?

I thought it might have been something to do with one of the entities not being set up correctly, so I mfde them again but still nothing. Anyway I am getting away from the point.
}

Anyone explain wm_set_main_objective? :smiley:


(Loffy) #4

Fast replies? Yes, … Im at work. Bored. This is more fun.

Are you using a team_ctf_redflag? I mean, do you have one in the map? For allies to pick up.
If so, they should carry the object to a trigger zone. This is the “goal” for them.
This trigger zone is an entity, and you must make it. I think you just make a brush and make it a trigger_multiple. Not sure though. Anyhow, it must have a scriptname . Let’s say you give the trigger_multiple the scriptname “goal_zone”.
Then you must have the following in you script:

goal_zone // Trigger area. Where the allies will bring the stolen docs.
{
death
{
put stuff here
}
}

You see, the trigger zone (the trigger_multiple entity - Here called goal_zone) will call it’s “death” part, in your script, when the flag is carried into it.
The “put stuff here” text can be almost anything. You can activate a speaker, raise the water in a tunnel or end the game.
Ops! Was that my boss in the corridor? I must end this now. See you! Good luck!
// Loffy

PS. Open the Gold Rush map-file (goldrush.map, it came with ET)! There is a team_ctf_redflag (the gold in the bank) and a trigger zone there (the truck). Have a look at the Gold Rush script too!


(eRRoLfLyNN) #5

Hehe me too :slight_smile:

I have the team_ctf_redflag in the map ok. And the trigger zone. But when I take the objective to the nothing happens. I think it’s because the tutorials I followed didn’t give the trigger-zone a scriptname.

OK, say I call the trigger “home” and then put this code in my script:

home //do i need to put it like “trigger home”?
{
death
{
wm_announce “Allies have escaped with blah blah!”
trigger game_manager axis_win
}
}

then have the following rountine also in my script:

trigger axis_win
{
wm_setwinner 1
wait 1500
wm_endround
}

Would this, theoretically, end the game with an Allies win?


(MadMaximus) #6

from a previous question i asked last week about what does wm_set_main_objective do, bani had this to say

so it’s not needed in your script.


(eRRoLfLyNN) #7

So wm_set_main_objective & wm_objective_status aren’t “essential” parts of the code regarding the objectives. Waow. All my puzzling was for nothing :blah:

At least I know I can take all those lines out, strip everything down to the bare minimum and take it from there.

Thanks guys :clap: This is a great forum :smiley:


(Loffy) #8

hi slacker friend!
I think this will work:
//------------- Script starts here----------------
game_manager
{
spawn
{
// Put stuff here, like respawntimes, round timelimit etc.
}

trigger allies_win
{
wm_setwinner 1
wait 1500
wm_endround
}
}

home
{
death
{
wm_announce “Allies have escaped with blah blah!”
trigger game_manager allies_win
}
}

//------------- Script ends here----------------

do i need to put it like “trigger home”?

No. Just “Home” will be enuff.

trigger game_manager axis_win

I think you mean “allies_win”.

…then have the following rountine also in my script:

trigger axis_win
{
wm_setwinner 1
wait 1500
wm_endround
}

Yes, but you can change the “axis_win” to “allies_win”. The setwinner routine is correct (1 = allies).

If the map (or your finished alfa-pk3) is small (1-3 Mb), you can send it to me at “loffyswe @ yahoo.se” and I’ll have a look at it, if you want.

It’s soon 4 pm. Time to plan my homegoing…

// L.


(eRRoLfLyNN) #9

Cheers Loffy. I’ll give that a go when I get home. Maybe I should install Radiant at work :wink:

Do you know, is it part of the language that you must put 2 brackets at the end of a routine, like this?:

}
}


(SiliconSlick) #10

wm_objective_status are for updating the objectives
in the limbo menu (green checkmarks, red X’s or
nothing) and should be listed in the same order
as the objectives in your .objdata file.

You certainly can get away with not using them at all
but I personally think you haven’t done a proper job
of creating a map then… it really isn’t that hard to
add the appropriate code to your map.script so
that the player can know at any point in time what
needs to be done.

SilconSlick


(eRRoLfLyNN) #11

I am only taking them out at this point as it’s really only a test map I’m making (first-timer :D), and It might make it easier for me to see where I am actually going wrong. If I ever was to release a map (very very looong time away if ever, lol) I would want to put these things in, as I agree they are helpful when you’re playing new maps.

The again I might keep them in, now that I actually know what they do!


(HairyPlums) #12

Count the opening brackets backwards, you’ll see there’s a closing } for every opening { :smiley:


(eRRoLfLyNN) #13

But that’s what I was wondering. Is the very last closing bracket closing game_manager? And if so, what is this one closing:?

trigger allies_win
{
wm_setwinner 1
wait 1500
wm_endround
}
}


(Loffy) #14

But that’s what I was wondering. Is the very last closing bracket closing game_manager?

No. See below. The end of game_manager is line 14.

And if so, what is this one closing:?

trigger allies_win
{
wm_setwinner 1
wait 1500
wm_endround
}
}

That is the end of the part for the entity “home”. See line 23 below.
It’s not a mis-copy.
:rocker:

//------------- Script starts here----------------
01 game_manager
02 { // Start of the part called “game_manager”
03 spawn
04 {
05 // Put stuff here, like respawntimes, round timelimit etc.
06 }
07
08 trigger allies_win
09 {
10 wm_setwinner 1
11 wait 1500
12 wm_endround
13 }
14 } // End of game manager
15
16 home
17 { // Start of the part for the entity “home”
18 death
19 {
20 wm_announce “Allies have escaped with blah blah!”
21 trigger game_manager allies_win
22 }
23 } // End of the part for the entity “home”
//------------- The whole script ends here----------------


(HairyPlums) #15

it’s probably game_manager - I suspect it was just a mis-copy on the part of whomever copy/pasted the script…


(eRRoLfLyNN) #16

Jahahahaaa!!! It worked! :clap:

Thanks Loffy my slacker friend :D, and the others who offered help. I actually understand why it works too, which is even better.

Now i just need to figure out how to end the game when 2 objectives have been completed. My test map is just:

Allies steal the docs
Allies blow a radio so Axis can’t call for reinforcements

Need to figure out how the game will only end with an Allied win when both of these objectives have been completed…

I lovesa the mapping! :smiley:


(Loffy) #17

There are many ways to do that. I offer one simple solution:

In game manager, write globalaccum 1 set 0. It means "The globalaccum with id number 1 is initially set to zero. (What is an globalaccum? I just see it as a counter.)
Then, when each of the objectives is completed, trigger game_manager allies_win.
And, finally, rewrite that part, so it becomes:

trigger allies_win
{
globalaccum 1 inc 1 // This will increase the global with 1 unit
globalaccum 1 abort_if_not_equal 2 // This will halt the script, if globalaccum isn’t 2
wm_setwinner 1
wait 1500
wm_endround
}

But other mappers/scriptwriters would use different routines and functions. Experiment, and see if it works.

Maybe you have wondered “Where are the tutorials for all this?!”. I did ask myself that in the beginning. I found that there are none. (Well, a few - but not that many.) Learning scripting is dissecting other scripts, browsing the net forums and just hard labour. Eventually it pays off.
// Loffy


(eRRoLfLyNN) #18

Yes, that’s what I’ve been doing. It’s hard to find any scripting tutorials. There is nothing really that explains how this script works, syntax, expressions, nothing! So I’ve been looking at game scripts, both official and custom, but there is so much in them that it’s easy to get confused about what belongs where. But I suppose eventually it will all make sense. Or am I being too optimistic?! :smiley:


(Irrelevant) #19

Eventually it will all click. I just got it, and its really satisfying when it happens. I’ve gone a bit crazy with the mapping. Just boxmaps, but anyway… :rocker:

However, getting into scripting is harder than most programming languages. It lacks so many things considered pretty basic for a programming language. Named variables, proper if and loop structures…