Duke4.net Forums: EDuke32 Scripting - Duke4.net Forums

Jump to content

  • 119 Pages +
  • « First
  • 60
  • 61
  • 62
  • 63
  • 64
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1831

It's different. The final value is within the limit of the .xrepeat, however it temporary sets to an invalid value during calculation.
0

User is offline   Kyanos 

#1832

Can i stop the 7 key from bringing up the expander when the player has the shrinker selected?

I tried this:
onevent <EVENT_WEAPKEY7>
{
  setvar RETURN 6
}
endevent


which I thought would do it, then experimented with curr_weapon checks and never got it to work at all.


EDIT:

nevermind I got it figured out.

This post has been edited by Drek: 29 January 2016 - 09:24 PM

0

#1833

Via CON scripting is it possible to pause background music and later restore it to it's previous state ?

TTFN,
Jon
0

User is online   Hendricks266 

  • Weaponized Autism

  #1834

Yes, in a roundabout way. First getmusicposition, then starttrack to a blank.ogg. When you're done starttrack back to your current level and setmusicposition.
1

#1835

 Hendricks266, on 01 February 2016 - 01:43 PM, said:

Yes, in a roundabout way. First getmusicposition, then starttrack to a blank.ogg. When you're done starttrack back to your current level and setmusicposition.


Excellent :dukeaffirmative: In order to avoid modifying DEFS.CON I saved my alternative sound track as "watrwld1.ogg" (==e1l4) and used "starttrack 3" and that worked a treat.

Is there a way of getting Eduke to always look for alternative tracks in the same folder as the map that is running ? I know in the startup screen there is a dropdown where you specify the appropriate folder and obviously that works but it is easilly overlooked.

TTFN,
Jon
0

User is offline   Zaxtor 

#1836

Having little trouble making a projectile that is thrown (upward-diagonally)
then falls, bounces few times and explodes.
When I tried other ways it doesn't bounce high.

I've tried OFFSET, Similar to a spit etc.
It partially works but not much.

I want the projectile to "aim" at the player but if I use RPG style (WORKSLIKE 2) it wont bounce but will explode on impact.

defineprojectile 16270 PROJ_WORKSLIKE (???what to put to do like in the picture below???)
defineprojectile 16270 PROJ_TRAIL SMALLSMOKE
defineprojectile 16270 PROJ_CLIPDIST 19
defineprojectile 16270 PROJ_VEL 911
defineprojectile 16270 PROJ_VEL_MULT 4 (speed may change if too fast since throwing and RPG speed seems to be different)
defineprojectile 16270 PROJ_EXTRA 410
defineprojectile 16270 PROJ_OFFSET 224 (like a morter but doesn't work right probably due to wrong WORKSLIKE)
defineprojectile 16270 PROJ_DROP -131
defineprojectile 16270 PROJ_BOUNCES 4
defineprojectile 16270 PROJ_BSOUND HARDIMPACT
defineprojectile 16270 PROJ_HITRADIUS 3666
defineprojectile 16270 PROJ_XREPEAT 18
defineprojectile 16270 PROJ_YREPEAT 18
defineprojectile 16270 PROJ_ISOUND PIPEBOMB_EXPLODE
defineprojectile 16270 PROJ_FLASH_COLOR 2
defineprojectile 16270 PROJ_SPAWNS EXPLOSION2

Here is the pic in details.
Posted Image

This post has been edited by Zaxtor: 06 February 2016 - 10:45 AM

0

User is online   Danukem 

  • Duke Plus Developer

#1837

I'm not going to check your flags, but make sure that you have used the "loses velocity flag". Your starting speed seems way too high btw. To make it bounce high, you can aim it at the ground. If the projectile falls naturally, then of course it will only bounce based on how fast it was falling. If you want it to bounce higher, then you have to monitor the projectile in EVENT_GAME or EVENT_WORLD and subtract from its zvel at the appropriate time. I will not be providing a tutorial.
0

User is offline   Kyanos 

#1838

 Zaxtor, on 06 February 2016 - 10:44 AM, said:

I want the projectile to "aim" at the player but if I use RPG style (WORKSLIKE 2) it wont bounce but will explode on impact.


Here is a workslike flag I use for a projectile that bounces off floors and walls without exploding... till reaching numbouces
36870
=
32768 damage on impact for rpg-type (rather than damage only by hitradius)
+
4096 noaim...doesn't autoaim
+
4 bounces off walls

You will want to take out the 4096 for noaim, and add in the timer flag I'd imagine, plus that loses velocity one TD mentioned.

Spoiler

0

User is offline   Zaxtor 

#1839

I kinda found an alternative way to make it work shortly before Dan replied.
proj goes upward then fall (bounced few times and explode)
but semi-aims at you once it finishes going up and then slightly-heading toward you.

Spoiler



However I may use those for diff projectile.
3

#1840

Hello everybody. I need a guru. I need to be able to select objects on the screen with the mouse.
I need a function that takes parameters: camerax,cameray,cameraz,camerasect,camerahoriz,cameraang, screenx,screeny (xd,yd) and return x,y,z in build coordinates.
Posted Image
Can somebody help with programming such functions for non classic modes?
0

#1841

Well, I found a solution algorithm!
Now we need to translate it into the CON

input: x, y, Fov, pan, tilt, w, h
output: panRes, tiltRes

pan = tofloat( get("camera","pan") ); 
tilt = tofloat( get("camera","tilt") ); 
fov = tofloat( get("camera","fov") );

w = tofloat( get( "applet", "width" ) ); 
h = tofloat( get( "applet", "height" ) );

x = tofloat( x ); 
y = tofloat( y );


r = (sqrt(w*w + h*h) / 2.0) / tan( gradToRad(fov/2.0) );


vx = r; vy = w/2.0 - x; vz = h/2.0 - y; 
pan = gradToRad( pan ); tilt = gradToRad( -tilt ); 
cosp = cos( pan ); sinp = sin( pan ); 
cost = cos( tilt ); sint = sin( tilt );

/*My * Mz*/ 
vx2 = vx*cost*cosp - vy*sinp + vz*cosp*sint; 
vy2 = vx*cost*sinp + vy*cosp + vz*sint*sinp; 
vz2 = -vx*sint + vz*cost;


sinRes = vy2 / sqrt(vx2*vx2 + vy2*vy2);

panRes = radToGrad( asin(sinRes) ); 
if( vx2 <= 0 && vy2 > 0 ) 
panRes = 180 - panRes; 
else if( vx2 < 0 && vy2 <= 0 ) 
panRes = -180 - panRes;

sinRes = vz2 / sqrt(vx2*vx2 + vy2*vy2 + vz2*vz2); 
tiltRes = radToGrad( asin(sinRes) );


Where:
w, h - width and height of Java Applet (pixels);
Fov - current field of view angle (degrees);
pan, tilt - camera direction point (degrees).
panRes, tiltRes - model coordinates of clicked (x, y) point (degrees).
x, y - screen clicked point coordinates (pixels);
r - panorama model sphere radius;
vx, vy, vz - coordinates of vector from origin to picked point in projection plane;
vx2, vy2, vz2 - transformed vector of picked point.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1842

http://wiki.eduke32.com/wiki/Hitscan
0

#1843

View PostFox, on 01 March 2016 - 12:35 AM, said:


Thank you captain! Hitscan does not take into account the position of the cursor on the screen. I need the ability to select objects on the screen by mouse cursor

This post has been edited by Mr. Alias Nameless: 01 March 2016 - 05:06 AM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1844

You would have to code your own cursor.
0

#1845

View PostFox, on 01 March 2016 - 05:21 AM, said:

You would have to code your own cursor.

Yes, of course I have coded a cursor. But how to use the cursor position in the hitscan function?
0

User is offline   Mblackwell 

  • Evil Overlord

#1846

See, what you need to do is complicated. You likely need to translate the cursor coordinates from a 320x200 pixel grid, take into account the renderer used and the resulting fov, and then translate the x coordinate into an ang and the y coordinate into a zvel (with z at screen center).... or perhaps the other way around, you'd need to experiment I guess. You'll probably need to shift up to very large number and down again for precision reasons since there's no floats or even fixed point decimal. You'll get inaccuracies.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1847

View PostMr. Alias Nameless, on 01 March 2016 - 06:17 AM, said:

Yes, of course I have coded a cursor. But how to use the cursor position in the hitscan function?

Use getangle to determine the angle in relation to the screen cordinates (320px = 90º). Remember that when you are looking up or down the view differs drastically between classic and OpenGL modes.
0

User is online   Danukem 

  • Duke Plus Developer

#1848

Doesn't mapster already have code for this which could be translated into CON?
0

#1849

View PostFox, on 01 March 2016 - 07:47 AM, said:

Use getangle to determine the angle in relation to the screen cordinates (320px = 90º). Remember that when you are looking up or down the view differs drastically between classic and OpenGL modes.

thank you this is useful.

View PostTrooper Dan, on 01 March 2016 - 09:49 AM, said:

Doesn't mapster already have code for this which could be translated into CON?

It is very difficult, due to the fact that there is no floating-point numbers in CON. And there is always the risk of overflow.
0

User is online   Danukem 

  • Duke Plus Developer

#1850

I would like to replace the string "SELECT SKILL" with my own string. The string is not in USER.CON and apparently is hard-coded. My intent is to make the difficulty selection menu do something entirely different, such as allowing the player to pick an initial weapon loadout. I can do the rest but I can't get rid of that string. Please help!

Maybe I can draw a graphic on top of where the string appears? EDIT: Nope, it looks like it is only possible to detect whether the player is in a menu, but not which specific menu, unless I am missing something.

This post has been edited by Trooper Dan: 07 March 2016 - 02:05 PM

1

User is offline   Kyanos 

#1851

current_menu should do this
http://wiki.eduke32....ki/Current_menu
1

User is online   Hendricks266 

  • Weaponized Autism

  #1852

gamevar screenx 0 0
gamevar screeny 0 0

defstate menuwhatever
    getuserdef .m_origin_x screenx
    getuserdef .m_origin_y screeny

    ifvare current_menu 110 // MENU_SKILL
    {
        // use screentext with the <<16 bit set, and *add* the coordinates you want to draw to screenx/y so it animates with the menu
    }
ends

onevent EVENT_DISPLAYMENUREST
    state menuwhatever
endevent

onevent EVENT_DISPLAYINACTIVEMENUREST
    state menuwhatever
endevent

3

User is online   Danukem 

  • Duke Plus Developer

#1853

Thanks, I wasn't expecting it to be a gamevar, so I only looked into the structs.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1854

I believe it should check for RETURN instead of current_menu, otherwise the previous menu sliding away won't display properly.
0

User is online   Hendricks266 

  • Weaponized Autism

  #1855

D'oh! That's what I get for doing this from memory.

gamevar screenx 0 0
gamevar screeny 0 0

defstate menuwhatever
    getuserdef .m_origin_x screenx
    getuserdef .m_origin_y screeny

    ifvare RETURN 110 // MENU_SKILL
    {
        // use screentext with the <<16 bit set, and *add* the coordinates you want to draw to screenx/y so it animates with the menu
    }
ends

onevent EVENT_DISPLAYMENUREST
    state menuwhatever
endevent

onevent EVENT_DISPLAYINACTIVEMENUREST
    state menuwhatever
endevent

0

User is online   Danukem 

  • Duke Plus Developer

#1856

Is there a way to force a sprite to be rendered, even if it is behind a wall? I seem to remember someone saying so, but I don't recall how. Setting the sprite's sector to the same as the player's does not do it.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1857

You can just put it closer to the player view, then simulate the distance with the sprite scale, but it would lack precision.
0

User is offline   Jblade 

#1858

Would setting it's animatesprite x and y values work? You could have the sprite close to the player but change it's tsprite values so it's displayed where it should actually be in the level.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1859

Nope, animatesprites doesn't work with sprites that are not being rendered.
0

User is online   Danukem 

  • Duke Plus Developer

#1860

View PostFox, on 18 March 2016 - 03:43 PM, said:

You can just put it closer to the player view, then simulate the distance with the sprite scale, but it would lack precision.


Most of the sprites in question are pickable objects, such as ammo. Doing what you suggest would cause the player to pick them up in some cases. What I'm going for is a kind of X-ray vision that reveals objects in secret areas. But it's okay, I've decided I don't really need it, I can make do with something else.
0

Share this topic:


  • 119 Pages +
  • « First
  • 60
  • 61
  • 62
  • 63
  • 64
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options