Login x
User Name:
Social Links Facebook Twitter YouTube Steam RSS News Feeds
Watch MODSonair

Members Online

0 Active | 239 Guests


New BF2 Mod
BF2 General


CoD4 Mapping
Awful Rating
Poor Rating
Average Rating
Good Rating
Excellent Rating
How to use Flags
Versions: You must be logged in to view history.

sam_fisher3000 will tell you how to create flags. It is very simple. Anyone can do it.

Making flags is very simple. It just make certain scenes not continue on until another scene is completed. The first thing that you should know is that flag is a string, nothing more, nothing less.


The first thing you should do is to call or initate the string. Put it at the beginning of the script file, where the map_load::main() is. Just below it or other files you are calling.


To initiate,


flag_init("anything"); <--anything is your string.


Then in one thread that needs a flag do



In another thread that you want the thread with the flag to wait for, do



That's it! It is that simple.


here is an example. I am using my map as the example.

flag_init("blow_up"); //initiate


thread 1:

trig = getent("hum_spawn","targetname");

trig waittill("trigger");


level.vehicle = getent("hum1","targetname");

//driver = getent("driver","targetname");

//level.vehicle.health = 200;

//clip = getent( "vehicle_clip","targetname" );

//clip linkto( level.vehicle );

//clip linkto( level.vehicle, "tag_origin", (0,0,0), (0,0,0) );

trig = getent("get_in","targetname");
trig waittill("trigger");

keep = getent("keep","targetname");
keep activate_trigger();

level.seat = spawn("script_model", level.vehicle.origin);
level.seat setmodel("tag_origin");
level.seat linkto(level.vehicle,"tag_passenger",(-5,3,-30),(0,0,0));
level.player PlayerLinkToDelta( level.seat, "tag_origin", 0,360,360,360,360,360,"false" );

level.vehicle waittill ("reached_end_node");

level.vehicle notify ("unload");

level.player unlink();

teammates2 = getentarray( "teammates2", "script_noteworthy" );
            for ( i = 0; i < teammates2.size; i++ )
                teammates2[i] delete();

thread nodamage();

flag_wait("blow_up"); //all the codes above are completed until this flag. Whatever is beyond cannot occur until another thread has done its job.

//driver thread manual_linkto( level.vehicle, (0,0,0 ) );

level.vehicle doDamage( level.vehicle.health + 200, (0,0,0) );
level.vehicle notify ("death");



thread 2:


trig = getent("body_down","targetname");

trig waittill("trigger");

level.player enableweapons();

objective_state(8, "done");

trig delete();

flag_set("blow_up"); //until this thread is completed, then the other thread can continue on.



So use flags whenever you want to wait for another certain action to complete.

If it isn't clear enough for you, here is void_source's way of telling you.


Flags are use to notify the script of certain actions or scenes to proceed or come to a halt until an event has been completed or cleared. A flag will carry a string. All flags MUST be initiated before they are set or on wait. Most of the time they are init within the " Main() " function before anything in the game starts up. So the way things go is as follow:

flag_init( "string" ); ---> flag_wait( "string" ); ----> flag_set( "string" );

there is also a flag_clear( "string" ); which is kinda like clearing the flag....think of it as deleting the flag.

flag_wait and flag_set can be place on any thread in your scripts.

so if you have a flag_wait on "thread2();" anything in the script beyond the " flag_wait( "string" ); " will not proceed unless " flag_set( "string" ); " is called. Like mentioned before, it can be called from any other thread in your scripts. So heres an example of how it would work


.....script stuff before the _load.....

flag_init( "car_bomb" );//our string is "car_bomb" but it can be whatever you want it to be. remember that spaces must be replace with an under score ( " _ " )

.....script continues.....


.....script stuff......
flag_wait( "car_bomb" );//nothing beyond this will happen until we set the flag of the same string. or we use flag_clear( "car_bomb" ); anywhere else on the script.

....stuff to happen after the flag has be set....



.....script stuff.....

flag_set( "car_bomb" );// we finally set the flag and thus thread_1 can proceed beyond its flag_wait

....more script stuff.

I hope this has helped cleared up about flags.




Anyway, here is how it's done. It is very simple. Hopefully, you get what is going on. With flags, it can make things so much easier, so you wouldn't have to do a whole new thread. Credits goes to void_source for telling me what flags are for and how to use it. And credits to me for explaining it to you mappers out there. :D Smile

Latest Syndicated News

Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends