home home

downloads files

forum forum

docs docs

wiki wiki

faq faq

Cube & Cube 2 FORUM


General Thread

by Aardappel on 01/05/2002 01:55, 15527 messages, last message: 03/01/2024 13:02, 12519391 views, last view: 11/01/2024 15:40

for questions, announcements etc.

Go to first 20 messagesGo to previous 20 messages    Board Index    Go to next 20 messagesGo to last 20 messages

#10855: Re: New commands

by Hirato Kirata on 07/06/2008 10:16, refers to #10854

fps.cpp isn't the best place to put that...

add the following macro just below it.

COMMAND(snipe, "");

snipe should now be a valid ingame command that'll modify the FoV based on the rest of the code after it compiles

reply to this message

#10856: Re: Can't use the menu

by MovingTarget on 07/06/2008 15:04, refers to #10852

The paragraph for VC++ mentions that you have to have the Platform SDK installed (hint: it contains windows.h)...

reply to this message

#10857: Re: New commands

by Red October on 07/06/2008 15:05

Then what would be the best place? I chose fps.cpp because when I looked through the source for Blood Frontier, trying to find out how they did it, the snipe function was in there.

I added that after the last brace (the one that closes the function) and it gave me a ton of errors. I fixed it by placing it back within the brace, and now it gives me one error (which I don't understand):

error: argument of type `void (fpsclient::)()' does not match `void (*)()'

As far as I can tell it's a problem with how to arrange what's between the ()'s

Thanks for the help!
RO

reply to this message

#10858: Re: New commands

by SanHolo on 07/07/2008 00:10, refers to #10854

Your code breaks the "fov" setting some player might use since it resets the fov to a hardcoded 90 after sniping. You should save the old fov, alter the fov to either your hardcoded 50 or better "snipingfov" variable and vice versa.

Also, for a fov of > 80 and < 90 nothing will happen.

reply to this message

#10859: Dhoo!

by Osbios on 07/07/2008 01:30

Just use a script for zoom + sniper.

Change SPACE by you favourite zoom key!


bind "SPACE" [cw = (getweapon);
cf = $fov;
cs = $sensitivity;
setweapon 4;
fov 30;
sensitivity 2;
onrelease [setweapon $cw;
fov $cf;
sensitivity $cs;
]
]

If you don't want to zoom at all without sniper available:

bind "SPACE" [cw = (getweapon);
cf = $fov;
cs = $sensitivity;
setweapon 4;
if (= (getweapon) 4) [ fov 30;
sensitivity 2;
onrelease [setweapon $cw;
fov $cf;
sensitivity $cs;
]
]
]

reply to this message

#10860: RE: New Commands

by Red October on 07/07/2008 04:38

SanHolo: Well I originally intended the default FOV to be 90 (that's how it is in most games), but you're right - any changes to that by the user and it'll screw up.

Osbios: I tried pasting your script into snipe.cfg and adding
alias snipe [ ]; snipe = [
in front with an end brace in the back, then linking to it from autoexec.cfg. However, whenever I click MOUSE2, the weapon switches to the rifle and then zooms in. I think I'm content with fixing up the code in fps.cpp, as long as someone can tell me how to fix the COMMAND error.

Thanks for the help!

reply to this message

#10861: Setting up dedicated Windows server

by Yoda_Glenn on 07/07/2008 05:49

I want to setup a dedicated windows server, but after I turn off my Windows Fire Wall, I get this error message:

"master server reply:

you server did not respond to ping - check your firewall settings."

By the way, I am using a LinkSys WRT 150N router. Could the firewall settings that the program is referring to pertain to the router? Thanks.

reply to this message

#10862: re zoom

by Osbios on 07/07/2008 14:55

@Red October:
What do you want? The script is supposed to change the weapon to the sniper and zoom in!
If you try to say that it won't zoom out and change the weapon back try this:

alias "snip_and_zoom" [ cw = getweapon);
cf = $fov;
cs = $sensitivity;
setweapon 4;
fov 30;
sensitivity 2;
onrelease [ setweapon $cw;
fov $cf;
sensitivity $cs;
]
]

bind "SPACE" snip_and_zoom;

reply to this message

#10863: missing (

by Osbios on 07/07/2008 15:06

One ( was missing by getweapon:


alias "snip_and_zoom" [ cw = (getweapon);
cf = $fov;
cs = $sensitivity;
setweapon 4;
fov 30;
sensitivity 2;
onrelease [ setweapon $cw;
fov $cf;
sensitivity $cs;
]
]

bind "SPACE" snip_and_zoom;

reply to this message

#10864: Re: missing (

by SanHolo on 07/07/2008 19:12, refers to #10863

I have something similiar, works since ever (just added the setweapon-thing, nice idea)


bind MOUSE2 [
oldfov = $fov;
oldsize = $crosshairsize;
oldsens = $sensitivity;
oldweapon = (getweapon);
hudgun 0; fov 25; crosshairsize 40; sensitivity 1;
onrelease [
setweapon $oldweapon; hudgun 1; fov $oldfov; crosshairsize $oldsize; sensitivity $oldsens;
]
]

reply to this message

#10865: ..

by Osbios on 07/07/2008 19:40

Well you just forgot to use the setweapon in the first place. :P

reply to this message

#10866: edit

by nick12345 on 07/08/2008 03:06

how do you edit stuff

reply to this message

#10867: Re: missing (

by Red October on 07/08/2008 06:04, refers to #10864

Those scripts work pretty well; however, what I originally intended for the zoom was that you have to be holding the sniper in order to be able to zoom in, and for other weapons there are varying levels of zoom.

Inside the C++ snipe function, I have another couple sections for the chaingun and rocket launcher, each with different zoomed-in FoVs. Is it possible to check the identity of the weapon being held using CubeScript? If so, I wouldn't need to use the C++.

One more thing; how can I add a mask over the zoomed-in view, so that it looks like a scope with a large crosshair over it? They have that effect in AssaultCube, and I wonder if it'll work for Sauerbraten too.

Thank you!

reply to this message

#10868: ..

by Osbios on 07/08/2008 09:07

Did you even read the scripts? :(
What do you think (getweapon) does?

Expect the mask you can do to all the things with scripts.

reply to this message

#10869: Re: ..

by Red October on 07/08/2008 13:11, refers to #10868

Yeah, I did... but I missed \"setweapon.\" XD. Thanks. So I guess the way to do this is check if the weapon is the sniper, and if it is, then to change the FOV. But how do I compare the value of cw? Do I do:
if ($cw = \"rifle\") [ ]
?

Thanks.

reply to this message

#10870: Re: ..

by Red October on 07/08/2008 13:13, refers to #10869

Or
if ($cw = 4) [ ]
?

reply to this message

#10871: ..

by Osbios on 07/08/2008 14:20

T_T

Exactly that was written in my first script example...

if (= (getweapon) 4) [ ...

]


This could work, too (not tested) :

if (= $cw 4) [ ...

]


You just have to get along with the syntax:

if (= X Y) [ ... ]

reply to this message

#10872: Re: ..

by Red October on 07/08/2008 15:48, refers to #10871

Well I tried adding that in, but now it zooms no matter what weapon you're holding.

This is what I have in zoom.cfg:

alias "zoom"
bind MOUSE2 [ cw = (getweapon);
cf = $fov;
cs = $sensitivity;
if (= (getweapon) 4)
fov 30;
sensitivity 1;
hudgun 0;
onrelease [ setweapon $cw;
fov $cf;
sensitivity $cs;
hudgun 1;
]
]
]

As far as I can see it should work; I don't know why it doesn't.

reply to this message

#10873: re

by Osbios on 07/08/2008 16:36

At first don't use the word zoom because the native command for zoom is called the same!


Alias don't work like that.
Use it like this:

alias my_alias [ DO SOMETHING ]

and then us it with bindings

bind MOUSE2 my_alias


There is a "[" missing after the "if" statement.

And you overwrite the hudgun value. Why not save it, too?

Would look like this in the end:


alias my_zoom [ cw = (getweapon);
cf = $fov;
cs = $sensitivity;
ch = $hudgun
if (= (getweapon) 4) [ fov 30;
sensitivity 1;
hudgun 0;
onrelease [ setweapon $cw;
fov $cf;
sensitivity $cs;
hudgun $ch;
]
]
]

bind "MOUSE2" my_zoom;

reply to this message

#10874: ..

by Osbios on 07/08/2008 16:40

Grrr... I formatted the script with spaces but the forum ate all of them. D:

Some [script][/script] would be nice to prevent this bad looking code!

reply to this message

Go to first 20 messagesGo to previous 20 messages    Board Index    Go to next 20 messagesGo to last 20 messages


Post a Message

Username

Email

Subject

Body

2 plus 8 is?


content by Aardappel & eihrul © 2001-2024
website by SleepwalkR © 2001-2024
58264107 visitors requested 76215776 pages
page created in 0.193 seconds using 10 queries
hosted by Boost Digital