Does anyone have a mod that turn of Crosshair when running?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
MrOblongo
Lance Corporal
Posts: 15
Joined: Thu Aug 21, 2003 12:35 am

Does anyone have a mod that turn of Crosshair when running?

Post by MrOblongo »

Im working on an ultimate realism mod for mohaa, now my big problem is the aiming system, considering noone make ironsights and i think noone will, IS THERE A WAY TO TURN OFF CROSSHAIR WHEN RUNNING (Server side)??? :?:
User avatar
Clackinizer
Sergeant
Posts: 72
Joined: Sun Mar 16, 2003 1:49 am
Location: USA
Contact:

Post by Clackinizer »

i know it'd have something to do with binding the keys to when you move it kills the crosshair... but i have no talent at scripting.. sorry :?
........
User avatar
The Jackal
Sergeant Major
Posts: 101
Joined: Wed May 07, 2003 10:09 am
Contact:

Post by The Jackal »

Only thing I can think off is the STUFFTEXT command.

Kinda like run a thread to check to see when a player is moving and stuff the ui_crosshair command if true. :cry:
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

I know another way, but I think it'll be hard to implement.

Here is the syntaxis to turn off a player's crosshair:
$player[#] weaponcommand dual dmcrosshair 0

And to turn it on again:
$player[#] weaponcommand dual dmcrosshair 1

To find out whether a player is running:
if(($player[#] getmovement)[0] == r) // r-unning

I hope this will help you somehow.
Image
User avatar
The Jackal
Sergeant Major
Posts: 101
Joined: Wed May 07, 2003 10:09 am
Contact:

Post by The Jackal »

So this should do it?

Code: Select all

while(1)
{
wait .1
for(local.p = 1; local.p < $player.size+1;local.p++)
	{
	if($player != NULL && $player[local.p].dmteam != "spectator" && $player[local.p].health > 0 && ($player[local.p] getmovement)[0] == r)
		{
		 $player[local.p] weaponcommand dual dmcrosshair 0
		}
		else
		{
		 $player[local.p] weaponcommand dual dmcrosshair 1
		}

	}

wait (.5)
}
end
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Could try that :)
Image
MrOblongo
Lance Corporal
Posts: 15
Joined: Thu Aug 21, 2003 12:35 am

Post by MrOblongo »

Does it works?, i tested it (maybe i dont know where to put it), and it diditn worked :?:
User avatar
The Jackal
Sergeant Major
Posts: 101
Joined: Wed May 07, 2003 10:09 am
Contact:

Post by The Jackal »

lol It was supposed to work, but I tested it and it did not. The problem lies in the weaponcommand dual crosshair 1. It just does not work for me.

So I substituted it with the yucky stufftext and it worked.

This is what my script looked like:

Code: Select all

_running:

while(1)
{

for(local.p = 1; local.p < $player.size+1;local.p++)
	{
	if($player != NULL && $player[local.p].dmteam != "spectator" && $player[local.p].health > 0 && ($player[local.p] getmovement)[0] == r)
		{
			$player[local.p] stufftext ("ui_crosshair 0")
		}
		else
		{
			$player[local.p] stufftext ("ui_crosshair 1")
		}

	}

wait (.1)
}
end
While it works, I do not like the idea of stuffing text at this rate. So I hope we can sort out the right command.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Hmm I did some tests and the crosshair and dmcrosshair commands seem to be total nonsense. For example, the m2_frag_grenade_base.txt file specifies no crosshair for nades but still the game draws one.

Looks like the stufftext command is the only possible way, although I yet know a method to hack around this mod (and thus use a crosshair after all).
Image
User avatar
The Jackal
Sergeant Major
Posts: 101
Joined: Wed May 07, 2003 10:09 am
Contact:

Post by The Jackal »

HEHEH JV. I thought of that. But not alot of people know to do it. 8-)

And I do not think forums like these should discuss them either.
MrOblongo
Lance Corporal
Posts: 15
Joined: Thu Aug 21, 2003 12:35 am

Post by MrOblongo »

How u make that work :oops: ???
Hashmark13
Major
Posts: 299
Joined: Mon Nov 25, 2002 12:20 am
Location: USA

You probably dont remember me.. but im back :P

Post by Hashmark13 »

The only problem i am having is trying to figure out where exactly to implement this script.
" If the automobile had followed the same development cycle as the computer, a Rolls-Royce would today cost $100, get a million miles per gallon, and explode once a year, killing everyone inside."
User avatar
The Jackal
Sergeant Major
Posts: 101
Joined: Wed May 07, 2003 10:09 am
Contact:

Re: You probably dont remember me.. but im back :P

Post by The Jackal »

Hashmark13 wrote:The only problem i am having is trying to figure out where exactly to implement this script.
Then you got no problem :wink:

Make a script file (no_crosshair.scr) and put this inside:

Code: Select all

main:

level waittill spawn

_running:

while(1)
{

for(local.p = 1; local.p < $player.size+1;local.p++)
   {
   if($player != NULL && $player[local.p].dmteam != "spectator" && $player[local.p].health > 0 && ($player[local.p] getmovement)[0] == r)
      {
         $player[local.p] weaponcommand dual crosshair 0
      }
      else
      {
         $player[local.p] weaponcommand dual crosshair  1
      }

   }

wait (.1)
}
end
Then open the map script file and type this below "level waittill spawn":

Code: Select all

exec global/no_crosshair.scr::main
Pack those two files in a PK3 - using the right paths - and you are a go!

As you can see I got the weaponcommand to work. I figured it out because when I checked the server file, I found no instances of "dmcrosshair". Buy me a beer JV. I like Colt. :P
Last edited by The Jackal on Sat Sep 27, 2003 9:34 pm, edited 1 time in total.
User avatar
The Jackal
Sergeant Major
Posts: 101
Joined: Wed May 07, 2003 10:09 am
Contact:

Post by The Jackal »

MrOblongo wrote:How u make that work :oops: ???
It's pretty easy. All you gotta do is ....[(*^(*^%&)((*^*&^)(&]

Moderator: This post contained trade secrets. DELETED secret! :twisted:
MrOblongo
Lance Corporal
Posts: 15
Joined: Thu Aug 21, 2003 12:35 am

Post by MrOblongo »

THX THX THX, that works and now im happy :D
Post Reply