Obj document.

Post your scripting questions / solutions here

Moderator: Moderators

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

Obj document.

Post by agentmad007 »

Hi all ,

I cant make work this script below.

Some precisions before:

$sg_document is a script_object
$axis_view_map_trigger is a trigger_use wich setthread axis_view_map.
AxisHQ is a big trigger_multiple

i would like the player to momorise the map en run back to his spawn point to achieve the objective.Here is what i tried but nothing work .

Code: Select all

axis_view_map local.player:



	while (local.player.dmteam != axis)
	
	{      


	if ( (Isalive local.player) && (local.player.useheld == 1) && (local.player cansee $sg_document 60 80) )

	if ( local.player.seenmap == 1 )

			{
			iprintln "You have memorised the document" local.player.dmteam

			}
	end

	}

thread come_back_home

end

come_back_home:

	self.seenMap = 1


	while ( self != NULL )
	{
 		if ( ! (Isalive self) )
		{
			iprintln "You've been mupped!"
			self.seenMap = 0
			end
		}

		if ( self.dmteam != "axis" )
		{
			iprintln "objective failed"
			self.seenMap = 0
			end
		}

		for (local.i = 1; local.i <= $AxisHQ.size; local.i++) {
			if ( self isinside $AxisHQ[local.i] )
			{
				iprintln "Good job!!!!"
				
				thread stargate_document_in_possession				

				end
			}
		}

		wait 0.1
	}

end

stargate_document_in_possession:

level.axis_obj++

thread check_endmatch

end



check_endmatch: 

if (level.axis_obj == level.numobjectives) 
teamwin axis

end

thx for help
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

parm.other

Post by tltrude »

You need to put this line at the start of the first thread.

Local.player = parm.other

That line assigns the values of the player (the one that hit the trigger use) to the "local.player" variable in that thread.

You also need to assign the new parammeter/value to that player.

local.player.seenmap = 1

Hope that helps!
Tom Trude,

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

Post by agentmad007 »

Code: Select all


axis_view_map local.player:


local.player = parm.other



	while (local.player.dmteam != axis)
	
	{      


	if ( (Isalive local.player) && (local.player.useheld == 1) && (local.player cansee $sg_document 60 80) )

	if ( local.player.seenmap == 1 )

			{
			iprintln "You have memorised the document" local.player.dmteam

			}
	end

	}

thread come_back_home

end

come_back_home:

	local.player.seenMap = 1


	while ( self != NULL )
	{
 		if ( ! (Isalive self) )
		{
			iprintln "You've been mupped!"
			local.player.seenMap = 0
			end
		}

		if ( self.dmteam != "axis" )
		{
			iprintln "objective failed"
			local.player.seenMap = 0
			end
		}

		for (local.i = 1; local.i <= $AxisHQ.size; local.i++) {
			if ( self isinside $AxisHQ[local.i] )
			{
				iprintln "Good job!!!!"
				
				thread stargate_document_in_possession				

				end
			}
		}

		wait 0.1
	}

end

stargate_document_in_possession:

level.axis_obj++

thread check_endmatch

end



check_endmatch: 

if (level.axis_obj == level.numobjectives) 
teamwin axis

end

still doesn't want to work .
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

seenMap

Post by tltrude »

seenMap ???

should be

seenmap

Use some debug lines like these.

iprintln "the trigger has been used!"
iprintln "local.player.seenmap = " (local.player.seenmap)


By the way, "mupped" has no meaning in english, and "memorised" is spelled "memorized".
Tom Trude,

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

Post by agentmad007 »

I cant use the debug , coze the whole script doesn't work , as if i got a syntax error.But only this part of script is bugged.when I try my whole script with these lines below , nothing wotk anymore .....however when i take out these lines the rest of the objectives work.

Code: Select all

axis_view_map local.player: 


local.player = parm.other 



   while (local.player.dmteam != axis) 
    
   {      


   if ( (Isalive local.player) && (local.player.useheld == 1) && (local.player cansee $sg_document 60 80) ) 

   if ( local.player.seenmap == 1 ) 

         { 
         iprintln "You have memorised the document" local.player.dmteam 

         } 
   end 

   } 

thread come_back_home 

end 

come_back_home: 

   local.player.seenmap = 1 


   while ( self != NULL ) 
   { 
       if ( ! (Isalive self) ) 
      { 
         iprintln "You've been mupped!" 
         local.player.seenmap = 0 
         end 
      } 

      if ( self.dmteam != "axis" ) 
      { 
         iprintln "objective failed" 
         local.player.seenmap = 0 
         end 
      } 

      for (local.i = 1; local.i <= $AxisHQ.size; local.i++) { 
         if ( self isinside $AxisHQ[local.i] ) 
         { 
            iprintln "Good job!!!!" 
             
            thread stargate_document_in_possession             

            end 
         } 
}==> i deleted this array also just before waitframe

Code: Select all

      waitframe 
it was wait .01 before , i ve changed it

Code: Select all

   } 

end

User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

local

Post by tltrude »

Local.player will lose it's value when it sees "end"---, local only works in the "local" thread.


thread come_back_home

end

come_back_home:

local.player.seenmap = 1


----------------------------------

try this----

thread come_back_home local.player

end

come_back_home local.player:

local.player.seenmap = 1
Tom Trude,

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

Post by agentmad007 »

same :( none objectives work .....
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

also tried

Code: Select all

local.player thread come_back_home

end 

come_back_home:
..............
..........
.....
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

Now it work ;)

changed the structure.

Thx anyway Tom
Post Reply