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, 12549309 views, last view: 11/05/2024 09: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

#10852: Re: Can't use the menu

by Red October on 07/06/2008 07:05, refers to #10851

Ah I see. I have VC++ 2005, but it's missing the windows.h header file and the paragraph for Codeblocks seems much shorter than the one for Visual in the wiki. :P

Thanks!

reply to this message

#10853: Re: Can't use the menu

by Red October on 07/06/2008 07:16, refers to #10851

Sorry, I just installed GCC 4.1.2 and tried to build again, the same thing happened.

reply to this message

#10854: New commands

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

OK, I managed to work around the problem by setting the GUI to 3D before building; I've always thought the 3Dgui looked cooler anyway.

I went ahead and created a snipe function in fps.cpp, that works differently for the rifle and chaingun:

***
void snipe(){
if (player1->gunselect==GUN_RIFLE)
{
if(getvar("fov") >= 90){
setvar("fov", 50);
return;
}
if(getvar("fov") <= 80){
setvar("fov", 90);
return;
}
}
***

It compiles fine, and now I want to be able to bind MOUSE2 to the snipe command (I don't know if you can bind keys in the source files), so how can I use cubescript/C++ to do that?

Thank you,
RO

reply to this message

#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

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

5 added to 6 =


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