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

Jump to content

  • 119 Pages +
  • « First
  • 46
  • 47
  • 48
  • 49
  • 50
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Jblade 

#1411

View PostHelixhorned, on 10 March 2014 - 01:30 PM, said:

It's hard-coded game functionality. Writing a test enemy which only seeks the player,
Spoiler

and setting a watchpoint on sprite[number_known_from_the_map].xvel shows that the culprit is in sector.c:A_DamageObject().
Spoiler

This function is one of the things that could use some form of scripting interfacing, so that its effects could be selectively disabled.

Thanks for clearing it up, maybe a new spriteflag could be added to disabe that or something?

This post has been edited by James: 10 March 2014 - 01:43 PM

0

User is offline   Kyanos 

#1412

setplayer[THISACTOR].over_shoulder_on 1

I'm using this as a little hack for a map effect in Link3D. Basically F7 is locked out and over the shoulder view is only accessible once the player has the map. My problem is that when I use the map in one level and switch back to another it doesn't work anymore. It's like it uses old coordinates from the previous level? maybe? Does anyone have any idea why this behaves like this? I've tried reading through some source code to no avail. I've run debug.exe it didn't provide anything useful either.
0

User is online   Danukem 

  • Duke Plus Developer

#1413

I'm having some trouble understanding your post. Are you saying the effect works fine in one map (you can turn it on and off with no problem) but when you try to use the effect again in another map, it shows the player from invalid coordinates?? There must a lot more going on here than the one line of code you are showing.
0

User is offline   Kyanos 

#1414

Yeah, it works fine. Then works fine in the next map too. Then is glitchy once I go back to the first map. I use the savemapstate command too. And event enterlevel plus more mess.
0

User is online   Danukem 

  • Duke Plus Developer

#1415

Are you basing your map caching code on the code I wrote for WGR2?

EDIT: Anyway, from what you have said, I would guess it has something to do with how you are using the loadmapstate command.

This post has been edited by Trooper Dan: 12 March 2014 - 07:07 PM

0

User is offline   Kyanos 

#1416

code...
Spoiler

To answer your question, yes it is based off WGR2 code, but without the pdestination stuff and se 67s, you come back to the map at the point that you exited. The 64 count timer stops going straight back to reload the original map.

edit: added spoiler

This post has been edited by Drek: 12 March 2014 - 08:01 PM

0

User is offline   Kyanos 

#1417

View PostTrooper Dan, on 12 March 2014 - 06:56 PM, said:

Are you basing your map caching code on the code I wrote for WGR2?

EDIT: Anyway, from what you have said, I would guess it has something to do with how you are using the loadmapstate command.

Exactly. What would the old mapstate have in it that I can manually edit to fix this?
0

User is online   Danukem 

  • Duke Plus Developer

#1418

View PostDrek, on 12 March 2014 - 07:12 PM, said:

To answer your question, yes it is based off WGR2 code, but without the pdestination stuff and se 67s, you come back to the map at the point that you exited. The 64 count timer stops going straight back to reload the original map.


That's what's puzzling me. The code you posted doesn't change the player's position at all, so I don't see how the coords could get messed up.

Does the problem occur the moment the player reenters a map? And what exactly is happening? Did you try DNDEBUG and look at the results (e.g. where the player is on the map).
0

User is offline   Kyanos 

#1419

The problem is triggerable by pressing alt fire while holding the map. Hence Bbutton 5 being forced while over the shoulder is on, so you can switch back. Yes it is like this any time after using the effect in one map, then trying to do it again in another.

The maps in question are just different variations of themselves. Each has overworld and dungeons in same location, with starting points being what makes them different. I can plainly see that the over the shoulder on starts where I did it last in the previous map, it (the f7 camera) will "float" or "travel" to where I am now and eventually with many on / off switches begin to work properly again... sometimes, or gets stuck in level geometry, player never dies. I will see what DNDEBUG says.
0

User is online   Danukem 

  • Duke Plus Developer

#1420

View PostDrek, on 12 March 2014 - 07:58 PM, said:

The problem is triggerable by pressing alt fire while holding the map. Hence Bbutton 5 being forced while over the shoulder is on, so you can switch back.


Well then it sounds like the crucial part of the code is probably the code associated with pressing alt fire, which you didn't post...
0

User is offline   Kyanos 

#1421

ok, there is this code too.
Spoiler

I made a quick video. The only way to describe it short of sharing the tc with you. Which I'm willing to do too. I can pack it up neat tomorrow.
https://www.mediafir...g4lf3j1sxxt5ljk here is my sample video, 4 mins 41 MB, shows off a few weapons and effects too.
0

User is online   Danukem 

  • Duke Plus Developer

#1422

Kickass TC you've got there :blink:

But please, please increase Link's walking speed!

As for the bug....looking at the video, it's pretty clearly a problem with the camera positioning, and I don't think you have posted the relevant code. I think you are messing with the camera vars (camerax, cameray, cameraz, cameresect, camderadist). Perhaps you have saved values from a different map, and when you switch to the external cam it is starting from those saved values and the code isn't able to get the camera to a sane position.

EDIT: Try putting the camera vars in your savegamevar/readgamevar routines. Especially your own camera vars, since the ones I mentioned get updated automatically.

This post has been edited by Trooper Dan: 12 March 2014 - 08:41 PM

1

User is offline   Kyanos 

#1423

Thanks.
I'm looking into the camera vars today, but you assumed wrong, I never once manually setup a camera. It is all seen from the perspective of Dukes first person view, with [THISACTOR].ang, and .horiz being forced within certain limits. It's as if the world and link exist down at his feet, very hackish IMO, yet simple and effective.

I'm sure that by playing with the camera vars you mention I'll be able get this world map effect working proper. Still it doesn't explain why my F7 view hack is not working atm, which is irrelevant really.

Thanks again. And yes, Link will be faster.

Added:
I simply added a few lines to log the camera vars when the map gets turned off and on, definitely found the issue with those camera vars. It's logging camerasect as -1 when it's glitchy for me.
Spoiler




Added more: I gave up using over_shoulder_on and just manually coded the same effect by moving the camera. It's actually better this way because it is customizable now.

This post has been edited by Drek: 13 March 2014 - 03:51 PM

0

User is offline   Mblackwell 

  • Evil Overlord

#1424

That's a known bug with over_shoulder_on. At least known to me... it's been that way since forever and basically locks out forcing over_shoulder_on to 1. Something internally must get toggled when pushing F7.
0

User is offline   Helixhorned 

  • EDuke32 Developer

#1425

View PostDrek, on 13 March 2014 - 06:15 AM, said:

CONLOGVAR: L=741 camerasect (Global) =-1 (this is where the cam is, switched map OFF)

When the third person view is in effect, 3072 is subtracted from the player's z position, after which a hitscan() is issued to determine the ultimate camera position. The initial subtraction may get the camera into void space in very cramped situations, like in the "appended" space ship in E2L1. With revision 4369, when this happens, we try to determine the camera position a second time without the subtraction. This may or may not be the cause for your trouble, but my experiments in said space ship have shown that under Polymer, the outside view tends to be drawn less frequently then (still remaining possible though).
0

User is offline   Helixhorned 

  • EDuke32 Developer

#1426

View PostJames, on 10 March 2014 - 01:42 PM, said:

Thanks for clearing it up, maybe a new spriteflag could be added to disabe that or something?

Added with r4371.

For actors that you define yourself, usage from CON would be with the spriteflags directive. If you want to modify existing actor's behavior, it gets a little tricky though. The spriteflags directive (i.e. translation-time command) is "destructive" in the sense that it overwrites the previous actor flags with the passed value. This is in contrast to other sprite* directives like spritenoshade, which bitwise-OR them in. So if you wanted to remove the damage-pushing behavior for the newbeast, you'd have to issue "spriteflags 4610 SFLAG_NODAMAGEPUSH" before its definition in GAME.CON. This rules out its usage with mutators, as these get translated after the regular CON files.

In Lunatic, we can have this:
-- Add NODAMAGEPUSH flag to NEWBEAST.
gameactor { D.NEWBEAST, AF.chain_end + AF.NODAMAGEPUSH, function() end }


Edit: corrected "spriteflags SFLAG_NODAMAGEPUSH" --> "spriteflags 4610 SFLAG_NODAMAGEPUSH"
1

User is offline   Hendricks266 

  • Weaponized Autism

  #1427

Why not

onevent EVENT_PREGAME
ifactor NEWBEAST
{
getactor[THISACTOR].htflags temp
orvar temp SFLAG_NODAMAGEPUSH
setactor[THISACTOR].htflags temp
}
endevent

0

User is offline   Kyanos 

#1428

Is it possible to load a savegame via con? I find it odd that save 9 works but load 9 is an error. I can't seem to figure out how Eduke prompts to load the last save when the player dies, I want the same effect. I've tried simply addphealth -999 to kill the player and prompt edukes load game system, it didn't work, also I've set dead_flag to a few non 0 values.

How can I script "load last save y/n?" for my TC like eduke32 does running Duke3D?
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1429

For htflags or mdflags, I prefer to set it once during LOADACTOR and EGS.

View PostDrek, on 15 March 2014 - 02:01 PM, said:

Is it possible to load a savegame via con? I find it odd that save 9 works but load 9 is an error. I can't seem to figure out how Eduke prompts to load the last save when the player dies, I want the same effect. I've tried simply addphealth -999 to kill the player and prompt edukes load game system, it didn't work, also I've set dead_flag to a few non 0 values.

How can I script "load last save y/n?" for my TC like eduke32 does running Duke3D?

I think you need to use resetplayer command. Keep in mind it works differently in multiplayer, and ti simply respawn the player...

This post has been edited by Fox: 15 March 2014 - 02:04 PM

1

User is offline   Kyanos 

#1430

Thanks Fox... I had that at one point, it was just restarting the level though, I must have done something wrong. Works like a charm now.

This post has been edited by Drek: 15 March 2014 - 05:30 PM

0

User is offline   Helixhorned 

  • EDuke32 Developer

#1431

View PostHendricks266, on 15 March 2014 - 01:56 PM, said:

Why not

onevent EVENT_PREGAME
ifactor NEWBEAST
{
getactor[THISACTOR].htflags temp
orvar temp SFLAG_NODAMAGEPUSH
setactor[THISACTOR].htflags temp
}
endevent


For reasons of minimality. Having it set "statically" once is preferrable to running the check every game tic * every sprite. Personally, I'm not a big fan of EVENT_{PRE}GAME. First, they tend to spread code belonging together across one more location. For example, your snippet would really belong into the NEWBEAST actor [*]; alas, there's no way to chain actor code in CON. Second, their names suggest that they're run every game tic (which seems more logical as well), whereas it's that times every sprite! This misunderstanding has lead to performance issues in the past, such as with Darkus' flashlight mod, and has also bitten me once.

[*] OK, this argument really applies to code that you wrote yourself in the first place. For NEWBEAST, if you prefer to stay away from modifying the original GAME.CON, there's no difference.

View PostFox, on 15 March 2014 - 02:02 PM, said:

For htflags or mdflags, I prefer to set it once during LOADACTOR and EGS.

EVENT_SPAWN should run for both sprites present in the initial map state as well as those spawned during the game. Again, if a particular actor-tile is supposed to have some htflags bit set at any time, it's cleaner to specify that via the spriteflags directive.
0

User is offline   Kyanos 

#1432

Is it possible to set the ambient light level via con, or to a default value in the .cfg's? I couldn't find any documentation on it, but it's late here.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1433

Change in USER.CON:
define DEFAULTVISIBILITY        512

0

User is offline   Kyanos 

#1434

Thanks, but I was referring to the slider Options -> Video -> Renderer Setup -> Ambient Light Level...
I already set the visibility low using .const_visibility, I want to combine the two to get this fade to black effect for Link3D. It only works nice when the ambient light is set low, 0.25.

pic in spoiler
Spoiler

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1435

You really shouldn't work with the menu option. Been there, done that.

Instead you could try adjusting the map shade to a negative number, and see if you get a nice fog effect...

But Eduke32 fog code may also be updated.

This post has been edited by Fox: 24 March 2014 - 05:54 AM

0

#1436

I've got a little question about the players view hight in first person. Is there a way to lower the view/camera through con so that the player feels smaller in gameplay? I got back working on a small project and need some minor coding.
Thanks in advance guys.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1437

You can try changing the x-yrepeat like the Shrinker does, or change the value of cameraz in EVENT_DISPLAYROOMS.
0

User is offline   Helixhorned 

  • EDuke32 Developer

#1438

View PostDrek, on 24 March 2014 - 05:28 AM, said:

(...) I was referring to the slider Options -> Video -> Renderer Setup -> Ambient Light Level...

There's the r_ambientlight cvar.
1

#1439

View PostFox, on 24 March 2014 - 11:12 AM, said:

You can try changing the x-yrepeat like the Shrinker does, or change the value of cameraz in EVENT_DISPLAYROOMS.


Oh man, I can't even figure out how I'm supposed to do this. I don't even know how to work with gamevars and where to put what. I played along with the DISPLAYROOMS event but the thing is that the projectiles from your weapons are supposed to be lowered as well if I lower the players view. I'm such a noob at coding.
0

User is online   Danukem 

  • Duke Plus Developer

#1440

View PostSimon_Croes, on 24 March 2014 - 01:57 PM, said:

Oh man, I can't even figure out how I'm supposed to do this. I don't even know how to work with gamevars and where to put what. I played along with the DISPLAYROOMS event but the thing is that the projectiles from your weapons are supposed to be lowered as well if I lower the players view. I'm such a noob at coding.


It may be simpler to do this in lua, but here's how to do it in CON. First, declare a gamevar to use for temp storage. You could put this line at the top of GAME.CON, for example:

gamevar TEMP 0 0


Next, the event code.

onevent EVENT_DISPLAYROOMS
addvar cameraz 4096 // constantly moves the camera down by 4096 z units, to simulate Duke's eyeballs being where his other balls are
endevent

onevent EVENT_EGS
ifspawnedby APLAYER
{
getactor[THISACTOR].z TEMP
addvar TEMP 4096
setactor[THISACTOR].z TEMP
}
endevent


The EGS code should move everything spawned by a player down 4096 z units, including projectiles such as rockets. Moving stuff down without checking for valid sectors, etc. will be buggy in some cases. Also, I don't think that any of this code will help with bullets (hitscan).
1

Share this topic:


  • 119 Pages +
  • « First
  • 46
  • 47
  • 48
  • 49
  • 50
  • 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