Page 1 of 1

new vehicle.scr not working

Posted: Fri Jan 21, 2005 11:38 pm
by Master-Of-Fungus-Foo-D
i made my own global vehicle scr, and im not very good at scripting, so you may know why ive got my problem... heres the script(s)one global one map script.. tell me what exactly im doing wrong(ps...theres no exiting system yet :oops: ).. the errors i get in console are

Code: Select all

Cannot set a read-only variable
parm.other = $player (global/dm_player_vehicles.scr, 4)
^
Cannot set a read-only variable
parm.other = $player (global/dm_player_vehicles.scr, 118)
^
^~^~^ Script file compile error:  Couldn't compile 'global/dm_player_vehicles.scr'
ScriptMaster::GetScript: Script 'global//dm_player_vehicles.scr' was not properly loaded
-------------------- Spawning Entities -----------------------
soundtrack switched to .
-------------------- Actual Spawning Entities -----------------------
-------------------- Actual Spawning Entities Done ------------------ 0 ms
0 teams with 0 entities
Adding script: 'test_dmvehicles.scr'
exec global/dm_player_vehicles.scr (maps/test_dmvehicles.scr, 2)
^
^~^~^ Script Error: Script 'global/dm_player_vehicles.scr' was not properly loaded
exec global/dm_player_vehicles.scr (maps/test_dmvehicles.scr, 3)
^
^~^~^ Script Error: Script 'global/dm_player_vehicles.scr' was not properly loaded
4 entities spawned
5 simple entities spawned
0 entities inhibited
here are my buggy scripts

Code: Select all

main:
exec global/dm_player_vehicles.scr
exec global/dm_player_vehicles.scr

//wasnt working---$jeeptrigger setthread global/dm_player_vehicles.scr
//same----$kingtrigger setthread global/dm_player_vehicles.scr
level waittill spawn

end
and heres the global one(its a rip off of the sp vehicles_thinkers.scr's tank part edited to give you a DM tank and a DM jeep where you drive in the driver seat)

Code: Select all

//*******************************
players_tank:
$kingtrigger waittill trigger
parm.other = $player
$kingtrigger glue self
//	self vehiclespeed 300
	self rendereffects "-shadow"
	local.parent = spawn script_origin
	local.parent.origin = self.origin
	level.playertanktarget = spawn script_origin
	level.playertanktarget.origin = (self.origin + (0 0 80))
	level.playertanktarget bind local.parent
	local.parent glue self

		
	self removeondeath 0
	if (self.target)
	{
		self.collisionent = self.target
	//	self.collisionent hide
	}	
	local.gun = self QueryTurretSlotEntity 0
	local.gun2 = self QueryTurretSlotEntity 1
	if (local.gun)
		local.gun nodamage
		local.gun model "vehicles/kingcannon.tik"
	if (local.gun2)
		local.gun2 nodamage

	thread player_tank_health
end

player_tank_health:
	level waittill spawn
	
	

if !($player istouching $king1trig)
	{	$player notsolid
		$player nodamage
		self attachdriverslot 0 $player
		//$player perferredweapon "88mm Tank Gun"
	}


	self.health = 3000

//		if ( (int (getcvar developer)) )
//			thread playertank_health_hud
		thread playertank_pain



	self waittill death

		self LockMovement
		self playsound explode_tank
		level.missionfailed = 1
		iprintlnbold "The King Tiger Tank has been lost, you have failed."
		//wait 3
		missionfailed
	end

playertank_pain:
		local.original_health = self.health
		local.previoushealth = self.health
		local.paintime = level.time
	
		while(isAlive self)
		{
			wait .1
			if (self.health < local.previoushealth)
			{
				self playsound damage_tank
				exec global/earthquake.scr .2 4 0 0	
		
				if ( (self.health < (local.previoushealth - 150)) && (level.time > (local.paintime + 5) ) )
				{
					local.paintime = level.time
					local.health_fraction = (self.health / local.original_health)
					println "z:     local.health_fraction: " local.health_fraction
					
					if (local.health_fraction >= 0.7)
					{
						$player playsound tank_hurt1
					}
					else if (local.health_fraction >= 0.4)
					{
						$player playsound tank_hurt2
					}
					else
					{
						$player playsound tank_hurt3
					}
				}
				
				local.previoushealth = self.health
			}
		}
	end


playertank_health_hud:
		level.subtitleX = 100
		level.subtitleY = 70
		while ( 1)
		{
			locprint level.subtitleX level.subtitleY ("Health: " + self.health)
			wait 1
		}
	end

//*******************************
players_jeep:
$jeeptrigger glue $jeep
$jeep waittill trigger
$jeeptrigger nottriggerable
parm.other = $player
	self vehiclespeed 800
	self rendereffects "-shadow"
	local.parent = spawn script_origin
	local.parent.origin = self.origin
	level.playerjeeptarget = spawn script_origin
	level.playerjeeptarget.origin = (self.origin)
	level.playerjeeptarget bind local.parent
	local.parent glue self

		
	self removeondeath 0
	if (self.target)
	{
		self.collisionent = self.target
	//	self.collisionent hide
	}	
	//local.gun = self QueryTurretSlotEntity 0
	local.gun2 = self QueryDriverSlotEntity 1
	if (local.gun)
		local.gun nodamage
		local.gun model "fx/dummy.tik.tik"
	if (local.gun2)
		local.gun2 nodamage

	thread player_jeep_health
end

player_jeep_health:
	level waittill prespawn
	
	

if !($player istouching $jeeptrig)
	{	$player notsolid
		$player nodamage
		self attachdriverslot 0 $player
		//$player perferredweapon "88mm Tank Gun"
	}

	level waittill spawn

	self.health = 3000



//		if ( (int (getcvar developer)) )
//			thread playertank_health_hud
		thread playerjeep_pain



	self waittill death

		self LockMovement
		self playsound explode_tank
		kill $player
		iprintlnbold "The Jeep has been lost... you will respawn..."
		wait 20
self remove
	end

playerjeep_pain:
		local.original_health = self.health
		local.previoushealth = self.health
		local.paintime = level.time
	
		while(isAlive self)
		{
			wait .1
			if (self.health < local.previoushealth)
			{
				self playsound damage_tank
				exec global/earthquake.scr .2 4 0 0	
		
				if ( (self.health < (local.previoushealth - 150)) && (level.time > (local.paintime + 5) ) )
				{
					local.paintime = level.time
					local.health_fraction = (self.health / local.original_health)
					println "z:     local.health_fraction: " local.health_fraction
					
					if (local.health_fraction >= 0.7)
					{
						$player playsound tank_hurt1
					}
					else if (local.health_fraction >= 0.4)
					{
						$player playsound tank_hurt2
					}
					else
					{
						$player playsound tank_hurt3
					}
				}
				
				local.previoushealth = self.health
			}
		}
	end


//playertank_health_hud:
	//	level.subtitleX = 100
		//level.subtitleY = 70
		//while ( 1)
		//{
		//	locprint level.subtitleX level.subtitleY ("Health: " + self.health)
		//	wait 1
	//	}
	//end

jeep:
local.jeep = spawn vehicle_allied_jeep "targetname" "jeep"
$jeep.origin = ($jeepspawner.origin)
$jeep.angles = ( $jeepspawner.angles )
$jeep goto players_jeep
end

king:
local.king = spawn vehicle_german_kingtigertank "targetname" "kingtiger"
$kingtiger.origin = ($kingspawner.origin)
$kingtiger.angles = ( $kingspawner.angles )
$kingtiger goto players_tank
end

Posted: Sat Jan 22, 2005 12:21 am
by wacko
mmm
:roll:
mmm
:oops:
"parm.other = $player"
never seen this before, and it's even causing the trouble...
what is it good for? and couldn't it be "local.player=parm.other", which I atleast have read before :?

Posted: Sat Jan 22, 2005 2:42 am
by Master-Of-Fungus-Foo-D
eh ive been "forgetting" everything and putting in tiny mistakes.thx wack....been forgetting details because ive been thinking too fast..... ah wel as it is late ill fix it tomorrow (oh yeah... big snow day on sunday!)

Posted: Sat Jan 22, 2005 10:00 am
by bdbodger
Cannot set a read-only variable
parm.other = $player (global/dm_player_vehicles.scr, 4)
When a player triggers a trigger they become parm.other . That is done by the game you can not set parm.other yourself however

local.player = parm.other

that reads the value of parm.other that is ok .

Posted: Sun Jan 23, 2005 4:36 pm
by Master-Of-Fungus-Foo-D
now ive got a new question... how would i do something like this:

Code: Select all

$blah thread global/blah.scr
in my script it thinks i made a thread called

Code: Select all

global/blah.scr:
but i want ot be able to use self still.. wahhh help!

Posted: Sun Jan 23, 2005 8:33 pm
by lizardkid
ok well you have to specify the thread you're trying the thread the $thing through.

$thing thread global/blah.scr::bleh
in my script it thinks i made a thread called
Code:
global/blah.scr:
you named your script global/blah.scr? that isn't te path of the script? if it's the name just name it blah.scr and put it in global folder. :S

Posted: Sun Jan 23, 2005 8:44 pm
by Master-Of-Fungus-Foo-D
im showing an example by using blah..... why the heck would anyone make a global/blah.scr??? WHat do you take me for an idiot? oh wait.. dont answer that dizard did

Posted: Mon Jan 24, 2005 5:04 am
by lizardkid
it wasnt a question about the name of the script, i wanted to know if you actually named a script global/blah.scr as opposed to blah.scr . and how you called the thread. it may affect how it works.

Posted: Mon Jan 24, 2005 12:43 pm
by Master-Of-Fungus-Foo-D
i put the script in global.. dont you have to do that divider thing so the game knows the file is in global?

Posted: Mon Jan 24, 2005 3:52 pm
by lizardkid
yes but the way you said it to me sounded like you named the script global/blah.scr

and that would make two global directories so you'd have to make it global/global/blah.scr when you called it.

but you didnt so nevermind,

but this part is what's probably going wrong.
in my script it thinks i made a thread called
Code:
global/blah.scr:
this is what i was wondering about at first, but back to the original matter, to have an entity call a thread you need to specify the thread, like

Code: Select all

$thing thread global/blah.scr::bleh
so it has a thread to run.

Posted: Mon Jan 24, 2005 5:12 pm
by Master-Of-Fungus-Foo-D
so i just had to add the

Code: Select all

::bleh