Im back again with a message question :)

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Im back again with a message question :)

Post by G3mInI »

I have this script that fires a flak88. Got it from bdbodger I think. Well I have modified a bit and I am trying to get some instruction message to appear on the persons screen when that person and that person only is standing in the trigger.

What I have now just prints over and over while person is there.. I need a way to make this message only appear one time when the person is in the trigger, if person leaves, then I want it to appear again when they are in the trigger.

Code: Select all

//**************************************************************
get_ready_to_fire:

	
	for(local.playr=1;local.playr<= $player.size;local.playr++)
		{
		while($player[local.playr] istouching self)
			{
			local.instruction = $player[local.playr] waitthread instruct_use
			local.instructed = 1
			if($player[local.playr].useheld == 1)
				{
				local.shot_org = $player[local.playr] thread find_spot
    		self.target waitthread fire_cannon local.shot_org
				local.shot_org immediateremove
				wait 5
    		}
			waitframe
			}
		waitframe
		}
end

instruct_use:
	if(local.instructed == NIL)
	{
	local.key = getboundkey1 "+use"
	iprintlnbold_noloc (loc_convert_string "To fire the flak88 (press ") local.key (loc_convert_string " ).")
	wait 1
	iprintlnbold_noloc "Flak will fire wherever you are aimed at."
	}
end
//**************************************************************
This just keeps on printing over and over, quite annoying. Help anyone ?

G3mInI
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

You need to place it below an if like if(local.instructed != 1) and then do your message. Mind you that getboundkey is never gonna work properly for a mp game :(
Image
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Post by G3mInI »

Thanks figured it out.... At first I couldnt figure out how to pass the variable to the other thread... but I got it now :)

G3mInI
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

so you can easily make new binds by ahving the user type in console for instance

Code: Select all

bind x mykey
and use

level.key = getboundkey1 "+mykey"

and have it in use for the whole map?
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

is this the flakfire script that I posted just a while ago ? I see you changed the fireheld to useheld and for some reason you are going through every player instead of just the player who trigger the trigger . The thread you posted if it is that script is called from above .

while(1)
{
local.trigger waittill trigger

local.trigger waitthread get_ready_to_fire
}

so put your message thread there instead and maybe just tell the player to use the use key .

while(1)
{
local.trigger waittill trigger
local.instruction = parm.other waitthread instruct_use // this or go through every player in the instuction thread
local.trigger waitthread get_ready_to_fire
}
Image
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Post by G3mInI »

Thanks bdbodger that is exactly what I was looking for...just didnt know where to put it. And I changed it all back to the way it was...no more scanning everyone!

Thanks,
G3mInI
Post Reply