
EDuke32 Scripting "CON coding help"
#377 Posted 10 October 2009 - 03:37 AM
I mean I've coded in a computer system that reads saved gamevars and displays them onscreen as a status thing. When I press K to see my ally's stuff it just reads the gamevars in my config file rather than his; but of course from his point of view it's displaying his stuff and pressing K when I'm using the PC displays his again as well. When I try and read if the weapon is unlocked, since it's unlocked for me it works ok but since it's still locked on his system it comes out negative and so desyncs since the game doesn't understand that our configs would have different saved vars or something.
This post has been edited by James: 10 October 2009 - 03:38 AM
#378 Posted 10 October 2009 - 08:58 AM
James, on Oct 10 2009, 04:37 AM, said:
I mean I've coded in a computer system that reads saved gamevars and displays them onscreen as a status thing. When I press K to see my ally's stuff it just reads the gamevars in my config file rather than his; but of course from his point of view it's displaying his stuff and pressing K when I'm using the PC displays his again as well. When I try and read if the weapon is unlocked, since it's unlocked for me it works ok but since it's still locked on his system it comes out negative and so desyncs since the game doesn't understand that our configs would have different saved vars or something.
What if you did something like this:
gamevar initplayer NO 1 gamearray weapmods 8 // each element is a bitfield storing all weapon mods for a player gamevar myweapmods 0 1 // this is what is saved to the ini file gamevar temp 0 0 state initp setvar initplayer YES readgamevar myweapmods getactor[THISACTOR].yvel temp setarray weapmods[temp] myweapmods ends actor APLAYER MAXPLAYERHEALTH PSTAND 0 0 ifvare initp NO state initp
So what you do is read the array element corresponding to the player number, rather than reading the gamevar from the file. Then you can display each player's stuff separately. When you get a new weapon mod, you add that to myweapmods, save that gamevar, and then update the array accordingly.
EDIT: It would make things messy if players changed their IDs in mid-game, but the basic concept seems sound.
This post has been edited by DeeperThought: 10 October 2009 - 09:03 AM
#380 Posted 14 October 2009 - 08:13 AM
#381 Posted 14 October 2009 - 09:05 AM
For walls and sectors, there are several things to consider:
- The game code doesn't know which walls and sectors are getting rendered. Before implementing a way for the game code to tell CON, we would need to implement a way for the engine code to tell the game code. This would make the engine <-> game limit even more broken than it already is.
- Rendered doesn't necessarily mean visible, and possibly vice versa.
- These results would vary depending of the renderer that's being used, and would even vary with different performance settings in the same renderer. That means CON scripts could potentially make wrong assumptions and only work on the renderer they were developed against.
#382 Posted 14 October 2009 - 09:30 AM
Plagman, on Oct 14 2009, 10:05 AM, said:
For walls and sectors, there are several things to consider:
- The game code doesn't know which walls and sectors are getting rendered. Before implementing a way for the game code to tell CON, we would need to implement a way for the engine code to tell the game code. This would make the engine <-> game limit even more broken than it already is.
- Rendered doesn't necessarily mean visible, and possibly vice versa.
- These results would vary depending of the renderer that's being used, and would even vary with different performance settings in the same renderer. That means CON scripts could potentially make wrong assumptions and only work on the renderer they were developed against.
Thank you for the detailed reply.
About tsprite access:
I know that there's an event EVENT_ANIMATESPRITES which works sort of like EVENT_GAME, except for tsprites. But tsprites get processed in that event only if the corresponding game world sprite has had bit 4 (16) added to its mdflags member. I was confused and I also thought that sprites would be forced into the tsprite array by that flag whether they were rendered or not (which is why I thought it was impossible to determine whether they were actually being rendered). Fortunately the reality is more sensible than my assumption!
#383 Posted 15 October 2009 - 06:26 AM
Are they dire? are they things which can alter an actor's behaviour or sometihng else?
#384 Posted 15 October 2009 - 06:29 AM
#385 Posted 15 October 2009 - 08:28 AM
Here's a link to the fixed build.
Once again, Plagman, thanks!
#386 Posted 17 October 2009 - 06:21 AM
Quote
33317: 31337 {
33318: 1899 getactor 253 19 332 230 332 14
33325: 1901 divvarvar 332
33327: 4 guniqhudid 253 17
33330: 1902 cos 385
33332: 4 guniqhudid 253 15
33335: 1903 sin 386
33337: 4 guniqhudid 253 15
33340: 1904 hitscan
33341: 4 guniqhudid 253 0
33344: 4 guniqhudid 253 1
33347: 4 guniqhudid 253 2
33350: 4 guniqhudid 253 13 385 386 332current actor: 288 (2605)
g_errorLineNum: 0, g_tw: 386
This is the CON part that causes the error:
Quote
mulvar ATEMP 16384
divvarvar ATEMP sprite[THISACTOR].xvel
cos ANGX sprite[THISACTOR].ang
sin ANGY sprite[THISACTOR].ang
hitscan sprite[THISACTOR].x sprite[THISACTOR].y sprite[THISACTOR].z sprite[THISACTOR].sectnum ANGX ANGY ATEMP
RETURN RETURN ATARGET RETURN RETURN RETURN 4294901808
#387 Posted 18 October 2009 - 12:25 PM
#388 Posted 22 October 2009 - 06:54 PM

I'm developing a shield buff [like a status buff] for NR, which is supposed to in theory "block" and sometimes "reflect/deflect" mystic-based attacks [one example can be the Octabrain's/Cycloid's mindblasts. I got it to "block" okay, but I was curious if anyone had ever tried the "deflect" part in their own code runs before.
Basically what I'm hoping to pull off is that when a projectile that can be blocked/deflected hits the shield, the original Projectile copies certain properties to a new projectile of identical strength and stuff but with the player's owner id, and bounce it away from them. For the best effect in my opinion, I need to know if it's possible to make a projectile disappear mid-impact[as in it won't show it's impact/explosion animation and just vanishes instantly]. I'm not sure if it can be done with custom or hard-coded projectiles or not.
I'm going to eventually work at this, but I got other tweaks for earlier stuff to worry about before I do, and I figured on dropping this set of questions on you guys in the meantime.

This post has been edited by Lord Misfit: 22 October 2009 - 06:55 PM
#389 Posted 22 October 2009 - 07:04 PM
#390 Posted 22 October 2009 - 08:46 PM
Lord Misfit, on Oct 22 2009, 07:54 PM, said:
I've made a few player force fields that deflect projectiles. Just change the angle of the projectile, it's zvel and owner. You don't need to fire a new one. You can spawn an animation sprite at the point where it deflects and play a sound. Maybe the real problem is you don't know how to make the projectile deflect without it dying. You can have the projectile detect distance to the force field and hitscan for it, then turn it around before it actually hits anything. Another method is to allow it to hit, but use EVENT_KILLIT to cancel its death and then turn it around from there.
#391 Posted 24 October 2009 - 08:37 AM
I am trying to create a remote controlled missile. But it is unable to kill most monsters unless the player wakes them first.
It also seems that monsters behave differently when asleep. So is it possible to blow up Liz troopers when asleep.
But not possible to blow up Liz mans.
#392 Posted 24 October 2009 - 09:30 AM
DeeperThought, on Oct 23 2009, 12:46 AM, said:
I should let you guys know I have gotten most of this all working now with deflecting stuff. It's not the exact method above, but I do have EVENT_KILLIT involved with a lot of it, and I still let the original projectile die and spawn a new one[but I can destroy the originals instantly too]. The only minor snafu with it is that when it deflect's a COOLEXPLOSION1, I try to get it's count and actorcount just before it's deleted through htg_t 0 & 2, but they always come back as 0 so when the new projectile is spawned, it spawns at it's default animation frames instead of part-way into the animation already.
Because of this I've been considering remaking a "COOLEXPLOSION2" or something as a replacement so deflected mindblasts actually hurt non-players and such, but I'm trying to get an idea of the animation speed and fuse/lifetime of the original COOLEXPLOSION1 is in exact values. Does anyone know that information on this topic? It would be a big help for me.

#393 Posted 24 October 2009 - 09:52 AM
#394 Posted 24 October 2009 - 10:01 AM
Lord Misfit, on Oct 24 2009, 10:30 AM, said:
Because of this I've been considering remaking a "COOLEXPLOSION2" or something as a replacement so deflected mindblasts actually hurt non-players and such, but I'm trying to get an idea of the animation speed and fuse/lifetime of the original COOLEXPLOSION1 is in exact values. Does anyone know that information on this topic? It would be a big help for me.

Why shouldn't the animation reset, and why would anyone care ? I appreciate attention to detail, but this crosses the line into being a weird fetish. You are spending time and adding code to deal with "problems" that no one cares about (and I'm not saying that based only on this feature).
#395 Posted 24 October 2009 - 12:14 PM
case COOLEXPLOSION1__STATIC: t->shade = -127; t->cstat |= 8192; t->picnum += (s->shade>>1); break;
if (s->picnum == COOLEXPLOSION1) { s->shade++; if (s->shade >= 40) KILLIT(i); }
Does that help?
#396 Posted 24 October 2009 - 04:04 PM
#397 Posted 04 November 2009 - 08:15 AM
#398 Posted 04 November 2009 - 10:56 AM
#399 Posted 04 November 2009 - 11:21 AM
XThX2, on Nov 4 2009, 10:56 AM, said:
Hmmm.. I did try something earlier where I coded the arrow to spawn a SHOTSPARK1 on impact, then coded the SHOTSPARK1 to use htg_t if it was spawned by an arrow. This way it'd know whether or not it was hitting a wall, and if it did I had it change it's picnum to the arrow (a different set, like you suggested). It's gotten me a bit closer to what I wanted, but now for some reason the arrow ends up spinning around in place when it spawns (even though I know I gave it the correct frames). Strange stuff...
#400 Posted 04 November 2009 - 11:53 AM
findnearsprite IONPARTICLEBOOM 500 returnvar1 ifvarn returnvar1 -1 { getactor[returnvar1].htg_t 2 temp ifvare temp 0 killit }
Where IONPARTICLEBOOM is a bullet based projectile that spawns an explosion when it hits a wall. Try it this way and see if it works. Of course, you would get the necessary information from it before killing it.
This post has been edited by XThX2: 04 November 2009 - 11:55 AM
#401 Posted 05 November 2009 - 09:54 AM
XThX2, on Nov 4 2009, 11:53 AM, said:
findnearsprite IONPARTICLEBOOM 500 returnvar1 ifvarn returnvar1 -1 { getactor[returnvar1].htg_t 2 temp ifvare temp 0 killit }
Where IONPARTICLEBOOM is a bullet based projectile that spawns an explosion when it hits a wall. Try it this way and see if it works. Of course, you would get the necessary information from it before killing it.
Well, I changed the code from changing picnums to just having it spawn the stuck arrow actor and that got rid of the crazy rotating problem. Last hurdle is trying to figure out how to get it closer to the wall to actually create the illusion that it's really stuck in the wall (right now it spawns a few inches away so, it's just sort of hanging in mid-air). Just to see what would happen, I coded the arrow to move further inwards towards the wall once it spawns then stop after a few tics, but it vanishes if it goes too far, and just hangs in the middle of the wall if it's actually 'within' it. Is this something that only a model can fix?
#402 Posted 05 November 2009 - 10:37 AM

#403 Posted 05 November 2009 - 11:22 AM
XThX2, on Nov 5 2009, 11:37 AM, said:

At this point I should really know what vertically flat means, but if it's aligned with the floor, then no it's not. Also I found another way to do it that's pretty simple (so simple, i can't believe I didn't think of it beforehand ). I just made a bullet-type projectile that had no graphic or extra value, and spawned a custom decal. I then coded the arrow to spawn another invisible custom actor on impact that would shoot said projectile that would leave behind this decal and that decal, once being spawned, would spawn the arrow in the wall. Sort of has a jerry-rigged feel to it, but it works pretty nicely.
#404 Posted 06 November 2009 - 06:10 AM
This post has been edited by Ilovefoxes: 06 November 2009 - 06:11 AM
#405 Posted 06 November 2009 - 06:38 AM
EmericaSkater, on Nov 5 2009, 12:22 PM, said:
Vertically flat means well, open mapster32, put a sprite and press R, the first time you do it; what you see is vertically flat. (Aligned with wall)
Can they be picked up, by the way ?
#406 Posted 06 November 2009 - 07:19 AM
XThX2, on Nov 6 2009, 07:38 AM, said:
Can they be picked up, by the way ?
Picked up AND climbed on. You'll get to see when I nail down a few more changes and post some more videos. (I got the full version of FRAPS just for you
