
EDuke32 Scripting "CON coding help"
#1249 Posted 23 April 2013 - 08:41 PM
#1250 Posted 23 April 2013 - 10:28 PM
Mblackwell, on 23 April 2013 - 07:54 PM, said:
onevent EVENT_JUMP setplayer[THISACTOR].poszv -2048 // or some other value setvar RETURN -1 endevent
This destroys any ifp pjumping code however.
That does what I want, however it has side effects:
- As you have mentioned, ifp pjumping code is destroyed, though I think I can safely replace all instances of "ifp pjumping" with a check for the player's z velocity.
- The player can now bunnyhop like crazy if keeping the jump key depressed (no idea how to fix this).
- Jumping to get out of water messes up.
So, not worth it

This post has been edited by Diaz: 23 April 2013 - 10:37 PM
#1251 Posted 24 April 2013 - 03:38 AM
Mark., on 23 April 2013 - 07:59 PM, said:
onevent EVENT_GETLOADTILE
setvar RETURN 7119
endevent
onevent EVENT_GETMENUTILE
setvar RETURN 7119
endevent
I replaced the load and menu screens with my own but I can't figure out the name for the DREALMS tile 2492 so I can replace it. I tried a few variations of the word DREALMS between "GET" and "TILE" but no luck.
There is no such a thing as a event that control the 3DRealms screen. You need to replace the tile.
#1252 Posted 25 April 2013 - 09:11 AM
Diaz, on 23 April 2013 - 10:28 PM, said:
- As you have mentioned, ifp pjumping code is destroyed, though I think I can safely replace all instances of "ifp pjumping" with a check for the player's z velocity.
- The player can now bunnyhop like crazy if keeping the jump key depressed (no idea how to fix this).
- Jumping to get out of water messes up.
So, not worth it

gamevar P_JUMP 0 1 onevent EVENT_JUMP ifvare P_JUMP 0 setplayer[THISACTOR].poszv -2048 setvar RETURN -1 setvar P_JUMP 3 enda actor APLAYER ifvarg P_JUMP 0 subvar P_JUMP 1 ifvarn P_JUMP 0 action PJUMPING enda
For example.
If necessary you can add a condition for when you're in water.
#1253 Posted 26 April 2013 - 09:47 AM
#1254 Posted 26 April 2013 - 10:28 AM
#1256 Posted 26 April 2013 - 03:59 PM
include this line somewhere before your actor code...
gamevar TEMP 0 2
Where you see the command "fall" in your actor, replace with:
ifvare sector[THISACTOR].lotag 1 { iffloordistl 8 setactor[THISACTOR].zvel 0 getsector[THISACTOR].lotag TEMP setsector[THISACTOR].lotag 0 fall setsector[THISACTOR].lotag TEMP } else fall
#1257 Posted 26 April 2013 - 10:58 PM
#1258 Posted 27 April 2013 - 10:06 AM
Is a way to spot them and correct them ?
#1259 Posted 27 April 2013 - 10:08 AM
#1260 Posted 27 April 2013 - 10:10 AM
Hendricks266, on 27 April 2013 - 10:08 AM, said:
interesting, a link to download this palette ?
#1261 Posted 27 April 2013 - 11:58 AM
#1262 Posted 29 April 2013 - 11:53 AM
First I used the hitscan code that is on the wiki:
gamevar MY_X 0 1 gamevar MY_Y 0 1 gamevar MY_Z 0 1 gamevar MY_SECTOR 0 1 gamevar MY_ANGLE 0 1 gamevar MY_ZDIST 0 1 gamevar MY_COS 0 1 gamevar MY_SIN 0 1 gamevar HITSECTOR 0 1 gamevar HITWALL 0 1 gamevar HITSPRITE 0 1 gamevar HITX 0 1 gamevar HITY 0 1 gamevar HITZ 0 1 state checkhitscan getplayer[THISACTOR].posx MY_X getplayer[THISACTOR].posy MY_Y getplayer[THISACTOR].posz MY_Z getplayer[THISACTOR].cursectnum MY_SECTOR getplayer[THISACTOR].ang MY_ANGLE getplayer[THISACTOR].horiz MY_ZDIST subvar MY_ZDIST 100 mulvar MY_ZDIST -2048 cos MY_COS MY_ANGLE sin MY_SIN MY_ANGLE hitscan MY_X MY_Y MY_Z MY_SECTOR MY_COS MY_SIN MY_ZDIST HITSECTOR HITWALL HITSPRITE HITX HITY HITZ CLIPMASK1 ends
State checkhitscan is called constantly from within the APLAYER actor. Then I create an actor for the models:
spritenoshade 4577 eventloadactor 4577 getactor[THISACTOR].cstat TEMP5 ifvarand TEMP5 16 { getactor[THISACTOR].sectnum TEMP getsector[TEMP].floorpal TEMP7 setactor[THISACTOR].pal TEMP7 getactor[THISACTOR].shade ACTORFLOORSHADE getactor[THISACTOR].x TEMP2 getactor[THISACTOR].y TEMP3 getactor[THISACTOR].z TEMP4 } else { getactor[THISACTOR].sectnum TEMP getsector[TEMP].floorshade ACTORFLOORSHADE setactor[THISACTOR].shade ACTORFLOORSHADE getsector[TEMP].floorpal TEMP7 setactor[THISACTOR].pal TEMP7 getactor[THISACTOR].x TEMP2 getactor[THISACTOR].y TEMP3 getactor[THISACTOR].z TEMP4 } enda useractor notenemy 4577 // Stone column ldist TEMP6 THISACTOR player[THISACTOR].i ifvarl TEMP6 24000 { ifvarn HITSECTOR -1 ifvarn sector[HITSECTOR].lotag 2 changespritesect THISACTOR HITSECTOR setactor[THISACTOR].shade ACTORFLOORSHADE setactor[THISACTOR].pal TEMP7 setactor[THISACTOR].x TEMP2 setactor[THISACTOR].y TEMP3 setactor[THISACTOR].z TEMP4 } enda
So the sprite's sectnum is always the sector the player is looking at, and thus it won't disappear. I have to save and restore x,y,z, pal and shade or weird things will happen.
Let me know what you think - this hack may not be optimal but I've noticed no slowdowns or undesirable effects so far....
EDIT: There is indeed slowdown with a large number of actors running this code. So I have to limit the distance, and I think I will make the "fix" toggleable with some gamevar, so it can be turned off if flickering/disappearing models don't bother you.
This post has been edited by Diaz: 29 April 2013 - 02:27 PM
#1263 Posted 29 April 2013 - 12:05 PM
Besides you should never change the actor sectnum (risk of map corruption), use the tsprsectnum instead.
This post has been edited by Fox: 29 April 2013 - 12:06 PM
#1264 Posted 29 April 2013 - 12:27 PM
And using camerasect caused the actors to completely disappear from the map for some reason

The HITSECTOR value seems to be very reliable, and I was already using the hitscan state for other things anyways. The clipmask is set to blockable sprites though, might want to change that to sectors only for this case.
This post has been edited by Diaz: 29 April 2013 - 12:38 PM
#1265 Posted 29 April 2013 - 02:23 PM
Also camerasect is the current view point's sector. So from first person it's the player's current sector generally... so not what you want.
#1266 Posted 29 April 2013 - 02:38 PM

It's useful for big models that don't need collision.
This post has been edited by Diaz: 29 April 2013 - 02:39 PM
#1267 Posted 29 April 2013 - 02:52 PM
This post has been edited by Mark.: 29 April 2013 - 02:55 PM
#1268 Posted 29 April 2013 - 02:57 PM
This post has been edited by Diaz: 29 April 2013 - 02:57 PM
#1269 Posted 29 April 2013 - 03:25 PM
Diaz, on 29 April 2013 - 02:38 PM, said:

So you are actually changing the sectors and not setting it back? That's some massive fuckery since many functions depends on the sectnum.
This post has been edited by Fox: 29 April 2013 - 03:25 PM
#1270 Posted 29 April 2013 - 03:28 PM
But it would make no sense to reset the sectnum right after changing it - that would cause the code to have no effect at all.
#1271 Posted 29 April 2013 - 06:29 PM
This post has been edited by Fox: 29 April 2013 - 06:30 PM
#1273 Posted 30 April 2013 - 01:28 AM
I think I'm reverting to changing sectnums in actor code - after all, these are just static decoration models with no collision. I doubt changing their sectnum will do any harm.
#1274 Posted 30 April 2013 - 05:29 AM
Diaz, on 30 April 2013 - 01:28 AM, said:
I think I'm reverting to changing sectnums in actor code - after all, these are just static decoration models with no collision. I doubt changing their sectnum will do any harm.
You should give them a unique statnum and do it in a loop that runs every few frames from the player code. Not turning those sprites into actors will save you fps.
#1275 Posted 30 April 2013 - 07:04 AM
Diaz, on 30 April 2013 - 01:28 AM, said:
I think I'm reverting to changing sectnums in actor code - after all, these are just static decoration models with no collision. I doubt changing their sectnum will do any harm.
You may be making the hitscan check for each sprite?
#1276 Posted 30 April 2013 - 08:40 AM
Still, any loop is not really the most fps-effective solution - any reason I really shouldn't use the actor's code to change sectnums? It only happens within a range of 16000 units (original sectnum is restored outside that range), the actors are just static models with no collision or any other form of code, and the mod is Polymer only. I've noticed no side effects whatsoever, even after running the game for a long time, saving, reloading games, etc.
This post has been edited by Diaz: 30 April 2013 - 08:54 AM
#1277 Posted 30 April 2013 - 03:07 PM
#1278 Posted 01 May 2013 - 07:45 AM
So I guess it's working in an optimal way now. Thanks guys!