Obj tutorial

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Obj tutorial

Post by agentmad007 »

Hi all ,

Does anyone has a Tutorial , that show how make serveral objectives in a map ( 4 ) and also a tuts for custom objectives (not bomb diffusing or document stealing) .

I have no idea how to set an objectives achieved if the allies team has actived the switch for example .

Also what should be the level.gametype for such a map ?

thanks a lot .
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Well, I have the Combining different objectives tutotial, but as it has documents and bombs in it... maby you arent interested ;)

But if you want switches: you could take a look at the AA Liberation tutoial, its objectives are controlled by switches.

And the level.gametype would probably be 4 (objective).
Admin .MAP Forums
Image
Head above heels.
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

Thx bjarne i ll take a look .

I will probably try to combine documents and switches ....
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

While loops

Post by tltrude »

The easiest way is to use while loops like this.

allies_win_checker:

while (level.objective_1 != 1)
wait .1
while (level.objective_2 != 1)
wait .1
while (level.objective_3 != 1)
wait .1
while (level.objective_4 != 1)
wait .1

teamwin allies
end

"!=" is the same as "does not equal". So when the variables are all equal to "1", the allies will win.
Tom Trude,

Image
Grassy
First Lieutenant
Posts: 221
Joined: Sun Aug 22, 2004 11:36 am

Post by Grassy »

But that would be sequential wouldn't it Trude?

Wouldn't it be better to do something like this, so is not sequential.

level.numobjectives = 4
level.allies_obj = 0

At each obj trigger in script if bomb or task is complete
level.allies_obj++
thread check_endmatch

check_endmatch:
if (level.allies_obj == level.numobjectives)
teamwin allies
end
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Yes, that looks good. Toms version could be used for a progression style objective where the objectives should be completed in order.
Admin .MAP Forums
Image
Head above heels.
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Well no toms way just means when the first one is done it looks at the second one and that one may already be done . Same for the rest the point being the allies win when all are done even if the first one on the list is done last . What ever way you do it the main thing is teamwin allies or teamwin axis . When the script executes either one of those the round is over any scripting method you use to get to that point will do . Most of the time you see people changeing the obj_dm.scr instead of comeing up with thier own scripts which is fine but even that script just sets a couple of bombs as haveing gone off and or setting level.objects_destroyed one number higher . It does take care of some other things like executeing the exploder.scr etc but there is no reason you can't make you own scripts and set the conditions to make the teamwins execute with a little thought and carefull scripting .
Image
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

level.numobjectives = 4
level.allies_obj = 0

does that mean to win you have to achieve 4 ojectives and the allies have 0 objectives ?

i am new to obj script , and i was not that good before with easy script though .....

thx for your answers :D
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

agentmad007 wrote:Does that mean to win you have to achieve 4 ojectives and the allies have 0 objectives ?
Well, if you create the script, it can mean anything you want it to. But if I write it like this, the functionality Grassy ment will be a bit more aparent:

Code: Select all

level.numTotalAlliedObjectives = 4
level.numCompletedAlliedObjectivesSoFar = 0
Admin .MAP Forums
Image
Head above heels.
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

ok i see , again a question is that level.num can a game variable that have to stay as it is ...or can i write:

Code: Select all

 level.objectivestoachieve
instead of

Code: Select all

level.numObjectivestoachieve
when i am checking obj script there is some weird variable level.?? and i wonder where they get that .

Is it their self creation ?
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

agentmad007 wrote:...or can i write...
You can write:

Code: Select all

level.Ihave5mONkeYsINmYPanTs = 0
...if you want to, for variables you create yourself that is.

But for variables defined by the game, you must spell them right ( like "param.other" and "level.targets_to_destroy" ).
agentmad007 wrote:when i am checking obj script there is some weird variable level.?? and i wonder where they get that .

Is it their self creation ?
level is an object that keeps its state over the level ( until the match is complete ). local is an object that keeps its state untill the method reaches its end.
Admin .MAP Forums
Image
Head above heels.
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

okay thx lol and sorry for the syntax above , i writed my sentence to quick .

What the hell with your monkeys on the pants Lmao .....but i understood .

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

Post by Bjarne BZR »

I have NO monkeys in my pants!

Code: Select all

level.Ihave5mONkeYsINmYPanTs = 0
...see, ZERO monkeys!

:D
Admin .MAP Forums
Image
Head above heels.
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

Bjarne, how old r u? :lol:

(is spamming he knows)
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

I'm 33 monkey-years old.
Admin .MAP Forums
Image
Head above heels.
Post Reply