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

Members Online

»
0 Active | 107 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 General
General game questions, comments, and chat.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Previous Page
subscribe
Author Topic: Is it possible to terminate/kill a thread()
StrYdeR
General Member
Since: May 11, 2004
Posts: 11672
Last: Apr 20, 2024
[view latest posts]
Level 10
Admin
Forum Moderator
Im a HOST of MODSonair
Category: CoD2 General
Posted: Thursday, Jan. 28, 2016 02:35 pm
Just read a quick breeze through of this thread and I think you may be overcomplicating this.

Scripting acts in an "in order" basis unless it is told to do something else.
To skip around you can open multiple threads.

For a simpler solution to this problem - why not open only 1 thread that has you complete OBJ1 (walk to the trigger without being seen or killing enemy or whatever...THEN in that same thread (after you reach your goal) open the thread for OBJ2 - or complete it in the same thread?

I believe that you could just move the operator "thread obj2();" to before the operator "obj1 delete();" so it starts the next thread before killing the current thread. Maybe add "wait 0.5;" after executing the obj2 thread to allow the code to execute

I haven't played with coding for a LOOOONG time so this is probably pretty rusty but i believe it should work

[angryalien]

edited on Jan. 28, 2016 07:35 am by StrYdeR
Share |
Ni3ls
General Member
Since: Nov 7, 2008
Posts: 256
Last: Sep 9, 2017
[view latest posts]
Level 5
Category: CoD2 General
Posted: Thursday, Jan. 28, 2016 04:31 pm
You would still have the problem that you can kill the other guys
Share |
Ni3ls
General Member
Since: Nov 7, 2008
Posts: 256
Last: Sep 9, 2017
[view latest posts]
Level 5
Category: CoD2 General
Posted: Thursday, Jan. 28, 2016 04:52 pm
Ow wow , im really stupid.
Code:
#include maps\_utility;

#include maps\_anim;

#using_animtree("generic_human");

main()
{
	maps\_load::main();
	setExpFog(0.0001, 0.55, 0.6, 0.55, 0);

	ambientPlay("ambient_france");

	game["allies"] = "american";
	game["axis"] = "german";
	game["attackers"] = "allies";
	game["defenders"] = "axis";
	game["american_soldiertype"] = "normandy";
	game["german_soldiertype"] = "normandy";

	setCvar("r_glowbloomintensity0", ".25");
	setCvar("r_glowbloomintensity1", ".25");
	setcvar("r_glowskybleedintensity0", ".3");

	level.allies_accuracy = 10;
	level.axis_accuracy = 100;
	thread setupplayer();
	thread enemy();
	thread obj1();
}

setupplayer()
{
	level.player takeallweapons();
	level.player giveWeapon("mp40");
	level.player giveWeapon("luger");
	level.player switchToWeapon("mp40");
	level.player setViewmodel("xmodel/viewmodel_hands_german");
}

enemy()
{
	guys = getentarray("guy", "targetname");
	for (i = 0; i < guys.size; i++)
		guys[i] thread mission_failure();
}

obj1()
{
	obj1 = getent("obj1", "targetname");
	objective_add(1, "active", &"TESTING_OBJECTIVE_1", getent("obj1marker", "targetname").origin);
	objective_current(1);

	obj1 waittill("trigger");

	objective_state(1, "done");
	obj1 delete();

	thread obj2();
}


obj2()
{
	level.ending = 1;

	obj2 = getent("obj2", "targetname");
	objective_add(2, "active", &"TESTING_OBJECTIVE_2", getent("obj2", "targetname").origin);
	objective_current(2);

	obj2 waittill("death");
	objective_state(2, "done");
}

mission_failure()
{
	self waittill("death");
	if (!isdefined(level.ending))
	{
		setCvar("ui_deadquote", &"TESTING_MISSION_FAILURE_ALERTED_ENEMY");
		maps\_utility::missionFailedWrapper();
	}
}


Your first part was almost correct, but it should be this
Code:
		guys[i] thread mission_failure();

and the level.ending is now in the correct place
Share |
s6robi
General Member
Since: Jun 12, 2006
Posts: 85
Last: Feb 18, 2021
[view latest posts]
Level 3
Category: CoD2 General
Posted: Thursday, Feb. 4, 2016 08:20 pm
Ni3ls!!!! You're amazing!! Thank you so much for all of your help!! Seriously! It works perfectly! Now with this final touch my SP map will be finished! I'll post shortly with the final product of my map. Thanks again!! And thank you Stryder for your input too!
Share |
Restricted Access Topic is Locked
Page
Previous Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 General

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

»