Script doenst work at all please help

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Script doenst work at all please help

Post by Alcoholic »

My script that i made doesnt work at all. I dont get any weapons, the captain says nothing, everything just doenst work. Can somebody plzz look at my script and tell me whats wrong?


//Ruckgewinnung - German for Recovery
//Geometry - Alcoholic
//Scripting - Alcoholic
main:

level waittill prespawn

//Global Scripts
exec global/ai.scr
exec global/alarmer.scr
exec global/friendly.scr

//Definition of Friendlies
level.friendly1 = level.captain
level.friendly2 = level.sniper
level.friendly3 = level.heavy
level.friendly4 = level.private1
level.friendly5 = level.private2
level.friendly6 = level.medic

//Some Variables
level.script = maps/test_recovery.scr
level.captainlead = 0
level.regularsfollow = 1
level.newguysfollow = 0
level.youdoit = 0

level waittill spawn

//Death Threads
level.captain thread death_captain
level.sniper thread death_sniper
level.heavy thread death_heavy
level.private1 thread death_private1
level.private2 thread death_private2
level.medic thread death_medic

//Some initial things that need to be done
$trigger_captainitem glue level.captain.origin

//Initial Threads
thread intro_setup
thread regulars_follow
end

//********************
//Scripted things
//********************

intro_setup:

waitframe
level.captain gun "colt45"
level.sniper gun "colt45"
level.heavy gun "colt45"
level.private1 gun "colt45"
level.private2 gun "colt45"
waitframe

level.captain.friendtype = -1
level.sniper.friendtype = -1
level.heavy.friendtype = -1
level.private1.friendtype = -1
level.private2.friendtype = -1

level.captain say dfr_M1L1_add03 //Change of plans, Lets Go!
level.captain waittill saydone

waitframe

thread basic_ai_setup
waitthread global/objectives.scr::add_objectives 1 2 "Follow the Captain. He knows what to do." level.captain.origin
end


//********************
//AI Changes
//********************

basic_ai_setup:

level.captain.friendtype = 4
level.captain exec global/friendly.scr::friendlythink
level.captain.avoidplayer = 1

level.sniper.friendtype = -1
level.sniper exec global/friendly.scr::friendlythink
level.sniper.avoidplayer = 1

level.heavy.friendtype = -1
level.heavy exec global/friendly.scr::friendlythink
level.heavy.avoidplayer = 1

level.private1.friendtype = -1
level.private1 exec global/friendly.scr::friendlythink
level.private1.avoidplayer = 1

level.private2.friendtype = -1
level.private2 exec global/friendly.scr::friendlythink
level.private2.avoidplayer = 1

level.medic.friendtype = 5
level.medic exec global/friendly.scr::friendlythink
level.medic.avoidplayer = 1
end

regulars_follow:

while (level.regularsfollow == 1)
{
if (isalive level.sniper)
{
if (isalive level.captain)
{
if (vector_within level.sniper.origin level.captain.origin 256 == 0)
{
level.sniper runto level.captain
wait 1
}
else
{
level.sniper runto NULL
}
}
else
{
level.sniper runto NULL
break
}
waitframe
}

if (isalive level.heavy)
{
if (isalive level.captain)
{
if (vector_within level.heavy.origin level.captain.origin 256 == 0)
{
level.heavy runto level.captain
wait 1
}
else
{
level.heavy runto NULL
}
}
else
{
level.heavy runto NULL
break
}
waitframe
}

if (isalive level.private1)
{
if (isalive level.captain)
{
if (vector_within level.private1.origin level.private1.origin 256 == 0)
{
level.private1 runto level.captain
wait 1
}
else
{
level.private1 runto NULL
}
}
else
{
level.private1 runto NULL
break
}
waitframe
}

if (isalive level.private2)
{
if (isalive level.captain)
{
if (vector_within level.private2.origin level.private2.origin 256 == 0)
{
level.private2 runto level.captain
wait 1
}
else
{
level.private2 runto NULL
}
}
else
{
level.private2 runto NULL
break
}
waitframe
}
end

new_leader_setup:

level.regularsfollow = 0

level.sniper.friendtype = 1
level.heavy.friendtype = 1
level.private1.friendtype = 1
level.private2.friendtype = 1

waitthread global/objectives.scr::add_objectives 1 3 "Follow the Captain. He knows what to do. - Failed."
thread objective1_check
end

//********************
//Death Threads
//********************

death_captain:

self waittill death
iprintlnbold_noloc "Captain Hank has been killed in action. Pick up his mission plans and carry on."
thread new_leader_setup
thread deathitem_captain
end

death_sniper:

self waittill death
iprintlnbold_noloc "Sniper Jackson has been killed in action. Pick up his binoculars and carry on."
thread deathitem_sniper
end

death_heavy:

self waittill death
iprintlnbold_noloc "Lietenant Josh has been killed in action. Pick up his bazooka and carry on."
thread deathitem_heavy
end

death_private1:

self waittill death
iprintlnbold_noloc "Private Harris has been killed in action. Sadly, he has nothing of value to pick up."
end

death_private2:

self waittill death
iprintlnbold_noloc "Private Zack has been killed in action. Sadly, he has nothing of value to pick up."
end

death_medic:

self waittill death
iprintlnbold_noloc "Medic Tom has been killed in action. Pick up his spare health pack and carry on."
thread deathitem_medic
end

//********************
//Dead Teammate Item Spawn
//********************

deathitem_captain:

local.item_captain = spawn script_model "targetname" "inventory_captain"
$inventory_captain model "miscobj/clipboard.tik"
$inventory_captain.origin = level.captain.origin
end

deathitem_sniper:

local.item_sniper = spawn item_binoculars "targetname" "inventory_sniper"
$inventory_sniper model "items/binoculars.tik"
$inventory_sniper.origin = level.sniper.origin
end

deathitem_heavy:

local.item_heavy = spawn playerweapon_allied_bazooka "targetname" "inventory_heavy"
$inventory_heavy model "weapons/bazooka.tik"
$inventory_heavy.origin = level.heavy.origin
end

deathitem_medic:

local.item_medic = spawn item_health_100 "targetname" "inventory_medic"
$inventory_medic model "items/item_100_healthbox.tik"
$inventory_medic.origin = level.medic.origin
end

pickup_captainitem:
//Note: The trigger can be fired infinite times, thats why I put the delete there.
self waittill trigger
if !(isalive level.captain)
{
waitframe
$inventory_captain hide
iprintlnbold_noloc "You have the captain's mission plans. As the Lietenant, you are now in charge of completing the mission."
level.youdoit = 1
self delete
}
end
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

i think it messed up here it is in code format:

Code: Select all

//Ruckgewinnung - German for Recovery
//Geometry - Alcoholic
//Scripting - Alcoholic
main:

level waittill prespawn

	//Global Scripts
	exec global/ai.scr
	exec global/alarmer.scr
	exec global/friendly.scr
	
	//Definition of Friendlies
	level.friendly1 = level.captain
	level.friendly2 = level.sniper
	level.friendly3 = level.heavy
	level.friendly4 = level.private1
	level.friendly5 = level.private2
	level.friendly6 = level.medic
	
	//Some Variables
	level.script = maps/test_recovery.scr
	level.captainlead = 0
	level.regularsfollow = 1
	level.newguysfollow = 0
	level.youdoit = 0
	
level waittill spawn

	//Death Threads
	level.captain thread death_captain
	level.sniper thread death_sniper
	level.heavy thread death_heavy
	level.private1 thread death_private1
	level.private2 thread death_private2
	level.medic thread death_medic
	
	//Some initial things that need to be done
	$trigger_captainitem glue level.captain.origin

	//Initial Threads
	thread intro_setup
	thread regulars_follow
	end

//********************
//Scripted things
//********************	

intro_setup:

	waitframe
	level.captain gun "colt45"
	level.sniper gun "colt45"
	level.heavy gun "colt45"
	level.private1 gun "colt45"
	level.private2 gun "colt45"
	waitframe
	
	level.captain.friendtype = -1
	level.sniper.friendtype = -1
	level.heavy.friendtype = -1
	level.private1.friendtype = -1
	level.private2.friendtype = -1
	
	level.captain say dfr_M1L1_add03 //Change of plans, Lets Go!
	level.captain waittill saydone
	
	waitframe
	
	thread basic_ai_setup
	waitthread global/objectives.scr::add_objectives 1 2 "Follow the Captain. He knows what to do." level.captain.origin
	end


//********************
//AI Changes
//********************	

basic_ai_setup:

	level.captain.friendtype = 4
	level.captain exec global/friendly.scr::friendlythink
	level.captain.avoidplayer = 1
	
	level.sniper.friendtype = -1
	level.sniper exec global/friendly.scr::friendlythink
	level.sniper.avoidplayer = 1
	
	level.heavy.friendtype = -1
	level.heavy exec global/friendly.scr::friendlythink
	level.heavy.avoidplayer = 1
	
	level.private1.friendtype = -1
	level.private1 exec global/friendly.scr::friendlythink
	level.private1.avoidplayer = 1
	
	level.private2.friendtype = -1
	level.private2 exec global/friendly.scr::friendlythink
	level.private2.avoidplayer = 1
	
	level.medic.friendtype = 5
	level.medic exec global/friendly.scr::friendlythink
	level.medic.avoidplayer = 1
	end
	
regulars_follow:

	while (level.regularsfollow == 1)
	{
		if (isalive level.sniper)
		{
			if (isalive level.captain)
			{
				if (vector_within level.sniper.origin level.captain.origin 256 == 0)
				{
					level.sniper runto level.captain
					wait 1
				}
				else
				{	
					level.sniper runto NULL
				}
			}
			else
			{
				level.sniper runto NULL
				break
			}
			waitframe
		}
	
		if (isalive level.heavy)
		{
			if (isalive level.captain)
			{
				if (vector_within level.heavy.origin level.captain.origin 256 == 0)
				{
					level.heavy runto level.captain
					wait 1
				}
				else
				{	
					level.heavy runto NULL
				}
			}
			else
			{
				level.heavy runto NULL
				break
			}
			waitframe
		}
	
		if (isalive level.private1)
		{
			if (isalive level.captain)
			{
				if (vector_within level.private1.origin level.private1.origin 256 == 0)
				{
					level.private1 runto level.captain
					wait 1
				}
				else
				{	
					level.private1 runto NULL
				}
			}
			else
			{
				level.private1 runto NULL
				break
			}
			waitframe
		}
		
		if (isalive level.private2)
		{
			if (isalive level.captain)
			{
				if (vector_within level.private2.origin level.private2.origin 256 == 0)
				{
					level.private2 runto level.captain
					wait 1
				}
				else
				{	
					level.private2 runto NULL
				}
			}
			else
			{
				level.private2 runto NULL
				break
			}
			waitframe
		}
		end
		
new_leader_setup:

	level.regularsfollow = 0
	
	level.sniper.friendtype = 1
	level.heavy.friendtype = 1
	level.private1.friendtype = 1
	level.private2.friendtype = 1
	
	waitthread global/objectives.scr::add_objectives 1 3 "Follow the Captain. He knows what to do. - Failed."
	thread objective1_check
	end
		
//********************
//Death Threads
//********************

death_captain:

	self waittill death
	iprintlnbold_noloc "Captain Hank has been killed in action. Pick up his mission plans and carry on."
	thread new_leader_setup
	thread deathitem_captain
	end
	
death_sniper:

	self waittill death
	iprintlnbold_noloc "Sniper Jackson has been killed in action. Pick up his binoculars and carry on."
	thread deathitem_sniper
	end
	
death_heavy:

	self waittill death
	iprintlnbold_noloc "Lietenant Josh has been killed in action. Pick up his bazooka and carry on."
	thread deathitem_heavy
	end
	
death_private1:

	self waittill death
	iprintlnbold_noloc "Private Harris has been killed in action. Sadly, he has nothing of value to pick up."
	end
	
death_private2:

	self waittill death
	iprintlnbold_noloc "Private Zack has been killed in action. Sadly, he has nothing of value to pick up."
	end
	
death_medic:

	self waittill death
	iprintlnbold_noloc "Medic Tom has been killed in action. Pick up his spare health pack and carry on."
	thread deathitem_medic
	end
	
//********************
//Dead Teammate Item Spawn
//********************

deathitem_captain:

	local.item_captain = spawn script_model "targetname" "inventory_captain"
	$inventory_captain model "miscobj/clipboard.tik"
	$inventory_captain.origin = level.captain.origin
	end
	
deathitem_sniper:

	local.item_sniper = spawn item_binoculars "targetname" "inventory_sniper"
	$inventory_sniper model "items/binoculars.tik"
	$inventory_sniper.origin = level.sniper.origin
	end
	
deathitem_heavy:

	local.item_heavy = spawn playerweapon_allied_bazooka "targetname" "inventory_heavy"
	$inventory_heavy model "weapons/bazooka.tik"
	$inventory_heavy.origin = level.heavy.origin
	end
	
deathitem_medic:

	local.item_medic = spawn item_health_100 "targetname" "inventory_medic"
	$inventory_medic model "items/item_100_healthbox.tik"
	$inventory_medic.origin = level.medic.origin
	end
	
pickup_captainitem:
//Note: The trigger can be fired infinite times, thats why I put the delete there.
	self waittill trigger
	if !(isalive level.captain)
	{
		waitframe
		$inventory_captain hide
		iprintlnbold_noloc "You have the captain's mission plans. As the Lietenant, you are now in charge of completing the mission."
		level.youdoit = 1
		self delete
	}
	end
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

//Definition of Friendlies
level.friendly1 = level.captain
level.friendly2 = level.sniper
level.friendly3 = level.heavy
level.friendly4 = level.private1
level.friendly5 = level.private2
level.friendly6 = level.medic

should be

level.captain = level.friendly1
level.sniper = level.friendly2
level.heavy = level.friendly3
level.private1 = level.friendly4
level.private2 = level.friendly5
level.medic = level.friendly6

level.script = maps/test_recovery.scr

Not needed scripts that use level.script check for stock level maps

level.captain.friendtype = -1
level.sniper.friendtype = -1
level.heavy.friendtype = -1
level.private1.friendtype = -1
level.private2.friendtype = -1

no affect until after friendlythink

if (isalive level.sniper)
{
if (isalive level.captain)
{
if (vector_within level.sniper.origin level.captain.origin 256 == 0)
{
level.sniper runto level.captain
wait 1

I think you can use level.sniper.destination = level.captain

$trigger_captainitem glue level.captain.origin

You can't glue a trigger to a origin

pickup_captainitem:
//Note: The trigger can be fired infinite times, thats why I put the delete there.
self waittill trigger
if !(isalive level.captain)
{
waitframe
$inventory_captain hide
iprintlnbold_noloc "You have the captain's mission plans. As the Lietenant, you are now in charge of completing the mission."
level.youdoit = 1
self delete
}
end

maybe try

death_captain:

self waittill death
$trigger_captainitem.origin = level.captain.origin // hide trigger under map untill needed
iprintlnbold_noloc "Captain Hank has been killed in action. Pick up his mission plans and carry on."
thread new_leader_setup
thread deathitem_captain
end


pickup_catainitem:
self waittill trigger
$trigger_captainitem remove
$inventory_captain remove
waitthread global/items.scr::add_item "clipboard"
iprintlnbold_noloc "You have the captain's mission plans. As the Lietenant, you are now in charge of completing the mission."
level.youdoit = 1
end

// possible items 6 max : camera ,binoculars,bangalores,battery,clipboard,radar_blueprints,radar_notes,uboat_blueprints,uboat_notes
,explosive,explosives,radio_explosives,gasmask,papers_level1,papers_level2,wirecutters,wirecutter,cutters,cutter,radio,uniform
,stg44_blueprints,tigerii_manual,battleplans
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

hmm ok thanks ill try that out.
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

bdbodger wrote://Definition of Friendlies
level.friendly1 = level.captain
level.friendly2 = level.sniper
level.friendly3 = level.heavy
level.friendly4 = level.private1
level.friendly5 = level.private2
level.friendly6 = level.medic

should be

level.captain = level.friendly1
level.sniper = level.friendly2
level.heavy = level.friendly3
level.private1 = level.friendly4
level.private2 = level.friendly5
level.medic = level.friendly6

level.script = maps/test_recovery.scr

Not needed scripts that use level.script check for stock level maps

level.captain.friendtype = -1
level.sniper.friendtype = -1
level.heavy.friendtype = -1
level.private1.friendtype = -1
level.private2.friendtype = -1

no affect until after friendlythink

if (isalive level.sniper)
{
if (isalive level.captain)
{
if (vector_within level.sniper.origin level.captain.origin 256 == 0)
{
level.sniper runto level.captain
wait 1

I think you can use level.sniper.destination = level.captain


$trigger_captainitem glue level.captain.origin

You can't glue a trigger to a origin

pickup_captainitem:
//Note: The trigger can be fired infinite times, thats why I put the delete there.
self waittill trigger
if !(isalive level.captain)
{
waitframe
$inventory_captain hide
iprintlnbold_noloc "You have the captain's mission plans. As the Lietenant, you are now in charge of completing the mission."
level.youdoit = 1
self delete
}
end

maybe try

death_captain:

self waittill death
$trigger_captainitem.origin = level.captain.origin // hide trigger under map untill needed
iprintlnbold_noloc "Captain Hank has been killed in action. Pick up his mission plans and carry on."
thread new_leader_setup
thread deathitem_captain
end


pickup_catainitem:
self waittill trigger
$trigger_captainitem remove
$inventory_captain remove
waitthread global/items.scr::add_item "clipboard"
iprintlnbold_noloc "You have the captain's mission plans. As the Lietenant, you are now in charge of completing the mission."
level.youdoit = 1
end

// possible items 6 max : camera ,binoculars,bangalores,battery,clipboard,radar_blueprints,radar_notes,uboat_blueprints,uboat_notes
,explosive,explosives,radio_explosives,gasmask,papers_level1,papers_level2,wirecutters,wirecutter,cutters,cutter,radio,uniform
,stg44_blueprints,tigerii_manual,battleplans

if i use destination, they run to teh captain, and then merge into him. do a forum search, i got this idea from jv_map. this way, he will run to him if hes too far, and he'll stop before he gets close enough to merge.
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

nope, doesnt work...

heres the updated script...

Code: Select all

//Ruckgewinnung - German for Recovery
//Geometry - Alcoholic
//Scripting - Alcoholic
main:

level waittill prespawn

	//Global Scripts
	exec global/ai.scr
	exec global/alarmer.scr
	exec global/friendly.scr
	
	//Definition of Friendlies
	level.captain = level.friendly1
	level.sniper = level.friendly2
	level.heavy = level.friendly3
	level.private1 = level.friendly4
	level.private2 = level.friendly5
	level.medic = level.friendly6
	
	//Some Variables
	level.captainlead = 0
	level.regularsfollow = 1
	level.newguysfollow = 0
	level.youdoit = 0
	
level waittill spawn

	//Death Threads
	level.captain thread death_captain
	level.sniper thread death_sniper
	level.heavy thread death_heavy
	level.private1 thread death_private1
	level.private2 thread death_private2
	level.medic thread death_medic
	
	//Some initial things that need to be done
	//None at the moment

	//Initial Threads
	thread intro_setup
	thread regulars_follow
	end

//********************
//Scripted things
//********************	

intro_setup:

	waitframe
	level.captain gun "colt45"
	level.sniper gun "colt45"
	level.heavy gun "colt45"
	level.private1 gun "colt45"
	level.private2 gun "colt45"
	
	level.captain say dfr_M1L1_add03 //Change of plans, Lets Go!
	level.captain waittill saydone
	
	thread basic_ai_setup
	waitthread global/objectives.scr::add_objectives 1 2 "Follow the Captain. He knows what to do." level.captain.origin
	end


//********************
//AI Changes
//********************	

basic_ai_setup:

	level.captain.friendtype = 4
	level.captain exec global/friendly.scr::friendlythink
	level.captain.avoidplayer = 1
	
	level.sniper.friendtype = -1
	level.sniper exec global/friendly.scr::friendlythink
	level.sniper.avoidplayer = 1
	
	level.heavy.friendtype = -1
	level.heavy exec global/friendly.scr::friendlythink
	level.heavy.avoidplayer = 1
	
	level.private1.friendtype = -1
	level.private1 exec global/friendly.scr::friendlythink
	level.private1.avoidplayer = 1
	
	level.private2.friendtype = -1
	level.private2 exec global/friendly.scr::friendlythink
	level.private2.avoidplayer = 1
	
	level.medic.friendtype = 5
	level.medic exec global/friendly.scr::friendlythink
	level.medic.avoidplayer = 1
	end
	
regulars_follow:

	while (level.regularsfollow == 1)
	{
		if (isalive level.sniper)
		{
			if (isalive level.captain)
			{
				if (vector_within level.sniper.origin level.captain.origin 256 == 0)
				{
					level.sniper runto level.captain
					wait 1
				}
				else
				{	
					level.sniper runto NULL
				}
			}
			else
			{
				level.sniper runto NULL
				break
			}
			waitframe
		}
	
		if (isalive level.heavy)
		{
			if (isalive level.captain)
			{
				if (vector_within level.heavy.origin level.captain.origin 256 == 0)
				{
					level.heavy runto level.captain
					wait 1
				}
				else
				{	
					level.heavy runto NULL
				}
			}
			else
			{
				level.heavy runto NULL
				break
			}
			waitframe
		}
	
		if (isalive level.private1)
		{
			if (isalive level.captain)
			{
				if (vector_within level.private1.origin level.private1.origin 256 == 0)
				{
					level.private1 runto level.captain
					wait 1
				}
				else
				{	
					level.private1 runto NULL
				}
			}
			else
			{
				level.private1 runto NULL
				break
			}
			waitframe
		}
		
		if (isalive level.private2)
		{
			if (isalive level.captain)
			{
				if (vector_within level.private2.origin level.private2.origin 256 == 0)
				{
					level.private2 runto level.captain
					wait 1
				}
				else
				{	
					level.private2 runto NULL
				}
			}
			else
			{
				level.private2 runto NULL
				break
			}
			waitframe
		}
		end
		
new_leader_setup:

	level.regularsfollow = 0
	
	level.sniper.friendtype = 1
	level.heavy.friendtype = 1
	level.private1.friendtype = 1
	level.private2.friendtype = 1
	
	waitthread global/objectives.scr::add_objectives 1 3 "Follow the Captain. He knows what to do. - Failed."
//	thread objective1_check
	end
		
//********************
//Death Threads
//********************

death_captain:

	self waittill death
	iprintlnbold_noloc "Captain Hank has been killed in action. Pick up his mission plans and carry on."
	$trigger_captainitem.origin = level.captain.origin
	thread new_leader_setup
	thread deathitem_captain
	end
	
death_sniper:

	self waittill death
	iprintlnbold_noloc "Sniper Jackson has been killed in action. Pick up his binoculars and carry on."
	thread deathitem_sniper
	end
	
death_heavy:

	self waittill death
	iprintlnbold_noloc "Lietenant Josh has been killed in action. Pick up his bazooka and carry on."
	thread deathitem_heavy
	end
	
death_private1:

	self waittill death
	iprintlnbold_noloc "Private Harris has been killed in action. Sadly, he has nothing of value to pick up."
	end
	
death_private2:

	self waittill death
	iprintlnbold_noloc "Private Zack has been killed in action. Sadly, he has nothing of value to pick up."
	end
	
death_medic:

	self waittill death
	iprintlnbold_noloc "Medic Tom has been killed in action. Pick up his spare health pack and carry on."
	thread deathitem_medic
	end
	
//********************
//Dead Teammate Item Spawn
//********************

deathitem_captain:

	local.item_captain = spawn script_model "targetname" "inventory_captain"
	$inventory_captain model "miscobj/clipboard.tik"
	$inventory_captain.origin = level.captain.origin
	end
	
deathitem_sniper:

	local.item_sniper = spawn item_binoculars "targetname" "inventory_sniper"
	$inventory_sniper model "items/binoculars.tik"
	$inventory_sniper.origin = level.sniper.origin
	end
	
deathitem_heavy:

	local.item_heavy = spawn playerweapon_allied_bazooka "targetname" "inventory_heavy"
	$inventory_heavy model "weapons/bazooka.tik"
	$inventory_heavy.origin = level.heavy.origin
	end
	
deathitem_medic:

	local.item_medic = spawn item_health_100 "targetname" "inventory_medic"
	$inventory_medic model "items/item_100_healthbox.tik"
	$inventory_medic.origin = level.medic.origin
	end
	
pickup_captainitem:
//Note: The trigger can be fired infinite times, thats why I put the remove there.
	self waittill trigger
	$inventory_captain remove
	waitthread global/items.scr::add_item "clipboard" "1"
	iprintlnbold_noloc "You have the captain's mission plans. As the Lietenant, you are now in charge of completing the mission."
	level.youdoit = 1
	self remove
	end
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

To determine where a friendly will follow in relation to the player, set his .mins and .maxs. For example to make a
friendly lead the player, like in m1l1, set his .mins to 20 and .maxs to 40. To make a friendly follow the player, like
m5l1a and m5l1b, set the mins to -40 and maxs to -20. Don't set the mins higher than the maxs.

You can further tweak the friendly with .distance and .waittime (they determine how close he has to get to nodes before
he goes for his next node and how long he waits at each node before following the player).
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

Code: Select all

//	4	Leader Behavior.
//
//		Leader Behavior is very special case and was created exclusively for m1l2a (the SAS Agent). Basically he uses the same
//		friendlynode/#set system as Offset Behavior friendlies, but he stays slightly ahead of the player and fills in the nodes
//		one by one as he moves through the map (filling them in sequentially). Therefore nodes can not have the same #set and
//		there is no .mins or .maxs.
//
//		Friendlynodes for Leader Behavior can have a #flag value as well, like #flag 0. When the friendly gets to that node, he
//		will enable friendly avoid and then execute a thread called "flagthread0" in the current level.script.
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

something is wrong with the script like a broken thread, etc. nothing is wrong with his behaviour. ive used the same format for behavior, and following, so its something else.
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

check ur console for errors. u could have typed a wrong command, that stops the whole script from running.
Live to map, not map to live.
-mohaa_rox, .map
moderator
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

well i guess the problem was that huge regulars follow thread. i figured out how to make it alot smaller, and now it all workz!

Code: Select all

regulars_follow:

	while (isalive self && isalive level.captain && level.regularsfollow == 1)
	{
		if !(vector_within self.origin level.captain 256)
		{
			self runto level.captain
		}
		else
		{
			self runto NULL
		}
		wait 1
	}
	end
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Yes but if you are going to use that arn't you in conflict with the global/friendly.scr . I mean if you use friendlythink the script is trying to position the men and you are useing script to do the same at the same time . If you are going to do that why use the global/friendly.scr at all just do your scipting without it , but if you do you can't use level.friendly1 etc because that comes from the global/friendly.scr . You whould have to do the checking for fnum your self or if you use the global/friendly.scr but don't use friendlythink then it might work but why do you need to script it your self ? I have used friendlies with no problems no bunching up etc I don't see the point .
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

ok, YOU try making ai soldiers that FOLLOW a leader. in maps like m1l1, everybody is on friendtype 0, and they all just run to the next points. i want the captain to run to the points a.k.a. oss man, but i want the soldiers to follow. usually, if they are all running like m1l1, if private is in front of his buddies, and they all kill the badguys, they all keep running, and the private is in the front. with teh way im doing it, the captain does all the leading, the soldiers follow. its sort of like barney behaviour, only they follow another ai rather than you.
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

if the captain happens to die, i turn off the variable "level.regularsfollow" to 0, so the ai doesnt TRY to run to teh captain, since hes dead. they then get barney behaviour, and they follow you.
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

it's very very complicated to do so. u need to do something to each pathnode. check the script from the oss man.
Live to map, not map to live.
-mohaa_rox, .map
moderator
Post Reply