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

Jump to content

  • 120 Pages +
  • « First
  • 33
  • 34
  • 35
  • 36
  • 37
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Darkus 

#1021

View Postzazo, on 23 October 2012 - 01:22 PM, said:

a simple "actor" instead of "useractor enemy" is much smoothy for an enemy !

View PostHendricks266, on 23 October 2012 - 07:22 PM, said:

Don't do that. You might as well call it useractor notenemy. The actor command is not designed for actors other than the v1.3D hardcoded list.

I agree with Hendricks266, I prefer using the regular 'useractor enemy' than 'actor'. But for 'useractor notenemy', there are odd things with it, like passing thru them when it walknig toward you.

View PostDiaz, on 23 October 2012 - 11:59 PM, said:

Does the PigCop have hardcoded behaviour other than that? I've noticed one of my enemies (which replaces PigCop) shoots at the player even when he's not in the "ifcanshoottarget" range. The CON code seems correct...
If I remember, the 'ifcanshoottarget' don't work like the 'ifcansee';
For 'ifcansee', it's when there are a line of sight between you and the enemy, even when he's not looking you. It not triggers if there a wall between the player and the enemy.
But for 'ifcanshoottarget' it's... weird. It seem always triggering, whatever you do. I've thought it triggering when the player is in the field of vision of the monster (meaning it's not trigger when the enemy is not looking the player), but thats not the case :D

So the safer thing you can do for your custom monsters is to replace the 'ifcanshoottarget' by 'ifcansee'.
0

User is offline   TerminX 

  • el fundador

  #1022

The palette 21 check for the LIZTROOP hit points is actually in the CON in 1.4/1.5, but NOT in the CON for 1.3d. This is a problem because it essentially means that red LIZTROOP enemies have the same health as the green ones when 1.3D is loaded in any Duke3D port, not just EDuke32.

So, since the doubling of strength for non-pal 0 enemies needs to at least be brought back for running 1.3D CONs, I'm thinking I might add the doubling for other enemies as well...
0

User is offline   zazo 

#1023

what risk if you use "actor" instead of "useractor" ? Can the futur versions of eduke crash with it ?
0

User is offline   Jblade 

#1024

Holy shit, I just went ingame to take a look at the monster's movement and they really do move noticably smoother in Peice of Cake :D I had no idea this happened, that's pretty damn fascinating.
0

#1025

Figured I'd better get back to everyone on what happened with my code;

@Hendricks266; WAY_MD is global, this selects a mode (0-6) for five different paths (0-4) and two functions (5-6) - might seem like a bad idea but I only have one enemy in the map at any time so a lot of vars are global (useful for debugging as I have them drawn to the screen).

@Mblackwell; Never played with arrays before, I have now though and this does appear to be working for the most part, but any value higher than 2 doesn't work for some reason (I have a feeling I look dumb right now), never thought about using pals, in fact, I forgot there were even palettes in the engine, I might put those to use, might even be possible to use them in place of the array. As for facing the waypoints, there are several reasons I do not find this to be practical, there is code for it but it is only ever used when the level loads or the player has evaded the enemy. There are still a couple of issues but I can probably fix them myself

@Reaper_Man; I did look at your newer A* system and even tried it at one point, unfortunately it doesn't know about tror, it may be possible to teach it, I don't know, all I know is that it seemed to have real difficulty navigating my narrow walkways and sprite doors (otherwise, it was very impressive code) - I may have a look at the old one though, it may be useful, if not, I can probably learn something from it anyway.



@ nobody in particular, just ramblings; Keep in mind the path following is just part of a bigger whole, there is only one enemy so it has to do a lot of stuff (though the player is pretty much unarmed) - find the path, follow it, make a decision which one to take at forks (can do so based on the player) know when it isn't supposed to be able to see the player, be able to teleport to the room next to the player, it also must be linked to the inventory, cutscene system and even know what to do with locked doors (which are models and control a nearby waypoint) - not to mention a bunch of other stuff. I've been rather ambitious, but I'll get this thing working.
0

User is offline   Reaper_Man 

  • Once and Future King

#1026

That is correct, currently my A* doesn't know about TROR (or even simple overlapping sectors for that matter). Sprite bridges is probably something that wouldn't be possible to add, not very easily at least. The updates I've been working on allow the mapper to manually place nodes in a map to inform the AI about certain things (doorways for example) so I bet I could come up with a hint node for sprite bridges. I'm about as derpy as it gets with Mapster so I haven't had the opportunity to build myself some test maps with TROR to try and teach it. If you have something basic you can give me to test with that would be awesome and I can definitely use that to further the code.

However I just had an idea on how to handle TROR so maybe I can get that added here soon when I push some updates for graphs and custom nodes and A*. :D

If you're doing just basic navigation I think that my old version would be a great reference for you. It sounds like exactly what you're trying to build now, a waypoint based navigation tool. It's far from perfect, it was written before arrays were added to EDuke32 so it's dated. But the concepts are still there and I'm sure the states could be easily updated to include new/better functionality.

Good luck. Pathfinding an AI is my forte, I'll be happy to answer questions or bounce ideas for you. I'm also in IRC regularly if you want to drop by and bug me.

This post has been edited by Reaper_Man: 24 October 2012 - 12:12 PM

0

#1027

Hmm. I threw this together in case you find it useful; Attached File  hall.zip (4.69K)
Number of downloads: 674

That's made out of a scrap map I had, there is nothing in it but some tror. However, if you do find it useful I don't have a problem with altering it further (i.e, adding a few sprites, doors or a few extra rooms) as those are five minute jobs and I've often got the editor open anyway.

In the meantime, I shall return to my own code and poke it around, I learned of the writearraytofile command and used it to write the array to a file which I proceeded to open in a hex editor, it seems the array is storing the values properly, which really helps me narrow down the problems I am having - I've got a good feeling that the bug may be about to meet the tread of my boots, if I wasn't wearing shoes today that is.
0

User is offline   Mblackwell 

  • Evil Overlord

#1028

Without posting a long vague chunk of code (since you're new to arrays):

If you use my strategy you'd use two arrays, and you'd have to decide on a maximum number of WAYPOINTS for a given path. Let's call this MAXWAYPOINTS. The first would be the number of WAYPOINTS in a given block. At WAYPOINT actor load (for example) get the value of pal, use that as your array position, retrieve its current value and add 1 (we'll call the result NUMWAYPOINTS). You can then do fun things like build a loop. The second array is a list of WAYPOINT ids. The way to store this would be something like arrayposition[(HITAG * MAXWAYPOINTS) + PAL] = THISACTOR. You can use the same sort of formula to find the actor you want to look at later.

Then the actor only needs to count up waypoints and do a dist to find out if it should move on to the next one or not. If you hit NUMWAYPOINTS for that path you can start back at 0 or work backwards). You can also quickly traverse the list of waypoints if the actor gets lost and try to find the nearest one. In this case getting back to it may or may not be difficult depending on your code, level set up, paths, etc. I'm rather tired so I'll leave ways of dealing with that for another time... just trying to help you get set up working with arrays in that way.
0

User is offline   Diaz 

#1029

 Darkus, on 24 October 2012 - 07:09 AM, said:


If I remember, the 'ifcanshoottarget' don't work like the 'ifcansee';
For 'ifcansee', it's when there are a line of sight between you and the enemy, even when he's not looking you. It not triggers if there a wall between the player and the enemy.
But for 'ifcanshoottarget' it's... weird. It seem always triggering, whatever you do. I've thought it triggering when the player is in the field of vision of the monster (meaning it's not trigger when the enemy is not looking the player), but thats not the case :D

So the safer thing you can do for your custom monsters is to replace the 'ifcanshoottarget' by 'ifcansee'.


My code looked like this:

      ifactioncount 2
        {
            ifcansee ifcanshoottarget 
            {
                resetactioncount
                sound PISTOL_FIRE
                ifvarg GAMESKILL 1 
                {
                    ifvare GAMESKILL 5
                    {
                        shoot SHOTSPARK1
                        shoot SHOTSPARK1
                        shoot SHOTGUN
                        shoot ENEMYFIRE
                    }
                    else
                    {
                        shoot SHOTSPARK1
                        shoot SHOTSPARK1
                        shoot ENEMYFIRE
                    }
                } 
                else
                {
                    shoot SHOTSPARK1
                    shoot ENEMYFIRE
                }
            }
            else
            {
                resetactioncount
                ai AIPIGSEEKENEMY
                break
            }
        }


EDIT: I tested it and for some reason it's not doing the same thing it was doing before (shooting even when there was a wall between the monster and the player). Maybe I added the ifcansee later and didn't even notice that fixed it :D

This post has been edited by Diaz: 25 October 2012 - 12:35 AM

0

User is offline   zazo 

#1030

In mapster, is it possible to copy and paste a sector (an "island" sector that walls are not white but red) within a sector ?? for exemple to make a copy of a sector with red walls (2d mode) in a sector ? tricky to explain :D
0

User is offline   Jblade 

#1031

I haven't touched coding in a while - if I want to scan all the walls of a map at the start of the map and spawn a sprite infront of them, is it still best to do it via eventloadactor APLAYER or is there a newer better method of doing sprite stuff map startup?
0

User is offline   Jblade 

#1032

Hey another question (might as well ask) what's the quickest way to get the x and y co-ordinates of a sector's centre? I'm working on some code that goes through at level start up and places ambient sounds on appropriate textures; doing it for walls is pretty easy but I'm a bit stumped for sectors that won't need a billion lines of code.
0

User is offline   Cage 

#1033

Any way to resize player sprites without affecting the FOV etc.? I'd like to use some higher res sprites, .DEF command would be the best way to do it, but I'm looking for an 8-bit solution

Same thing for defining high (double in this case) resolution menu font, etc.?
0

User is offline   CruX 

#1034

I don't know about menu fonts, but the player sprite can be resized easily enough by setting mdflags to 16 underneath the APLAYER line, then resizing the APLAYER actor's tsprite using settspr in the ANIMATESPRITES event. To the best of my knowledge, it doesn't mess up FOV. Hasn't with me, anyway.
0

User is offline   zazo 

#1035

 Cage, on 29 October 2012 - 05:17 AM, said:

Any way to resize player sprites without affecting the FOV etc.? I'd like to use some higher res sprites, .DEF command would be the best way to do it, but I'm looking for an 8-bit solution

Same thing for defining high (double in this case) resolution menu font, etc.?


to resize a sprite you can use the event_game like this:

gamevar INIT 0 2
onevent EVENT_GAME
ifactor APLAYER ifvare INIT 0
{ setvar INIT 1
setactor[THISACTOR].xrepeat ---
setactor[THISACTOR].yrepeat --- }
endevent

replace --- with a value that resize your sprite to the good aspect you want in the game.
with this method you can replace the frames of an actor, with higher 8 bit resolution, in editart.
I'm not the only one to love 8 bit rendering sprites :D (because using a lot of 8bit ripped art !!)
0

User is offline   Mblackwell 

  • Evil Overlord

#1036

 James, on 29 October 2012 - 01:15 AM, said:

Hey another question (might as well ask) what's the quickest way to get the x and y co-ordinates of a sector's centre? I'm working on some code that goes through at level start up and places ambient sounds on appropriate textures; doing it for walls is pretty easy but I'm a bit stumped for sectors that won't need a billion lines of code.



state scanwalls
   getsector[NUMSECTORS1].wallptr FIRSTWALL // get the firstwall of the sector
   getsector[NUMSECTORS1].wallnum NUMWALLS1 // get the number of walls in the sector

   setvar MX 0
   setvar MY 0
   setvarvar WALLPOINT FIRSTWALL 

   setvar COUNTWALLS 0

    whilevarvarn COUNTWALLS NUMWALLS1
    {
       getwall[WALLPOINT].x WALLX1
       getwall[WALLPOINT].y WALLY1
       divvarvar WALLX1 NUMWALLS1  // divide it first because the numbers might overflow 
       divvarvar WALLY1 NUMWALLS1
       addvarvar MX WALLX1  // add it all up
       addvarvar MY WALLY1
       getwall[WALLPOINT].point2 WALLPOINT // next wall

       addvar COUNTWALLS 1
           // this will kill EVENT_GAME until code execution is finished
       break
     }



ends


This is a hack I released as part of the "materials" code (which scanned sectors/walls and allowed you to mess with certain textures or spawn things). Except for odd shaped sectors that should be pretty close.
1

User is offline   Marcos 

#1037

Let me ask something... Is it possible to cancel the "F6" key, The "Quick save"?
0

User is offline   Darkus 

#1038

I have a little problem: I wanted to create a flashlight effect (a moving spotlight in polymer), if the actor that is supposed to cast light is moving, but the light that is displayed don't move (or the light does not appear)...
I tried to search on this forum and found some things, but they don't seem to work.
I don't know if that's me who doing something wrong, or it's a bug...
0

User is offline   Jblade 

#1039

 Mblackwell, on 29 October 2012 - 06:39 AM, said:

*snip*
This is a hack I released as part of the "materials" code (which scanned sectors/walls and allowed you to mess with certain textures or spawn things). Except for odd shaped sectors that should be pretty close.

Much appreciated, I'll give this a try tommorow morning!
0

User is offline   Cage 

#1040

EmericaSkater & zazo: Thank you both! I understand zazo's method better, but both seem to work on a similar principle.

Is there a way to disable "visibility-flashing" effect in sectors with specified palette? I might be using 8-bit fog effects, and the fog withdraws/lessen when you shoot or when explosions go off, and it looks ridiculous!

I could just disable the flashing bit in all weapons, and do a manual check of current weapons kickback_pic and what palette is the player's current sector(And, when conditions are met, just use the FLASH command), but the explosions (actor EXPLOSION2) have hardcoded flashing behavior - I'd rather save the fuss of replacing it with a new actor (especially since it's spawned by some hardcoded ones like SEENINE/C9 etc.)

Also - how to make a Mapster32 script which would change the shade and palette of ALL sectors, walls and sprites to specific values? I'd like to have a global fog in the map and that sure would ease/speed things up. One that globally edits parallax ceilings and floors (tile #, shade and pal) would be very handy too. Mapster scripts are a totally new feature to me and I don't know where to start :D
0

User is offline   Diaz 

#1041

Cage, for the palette thing, you have the ' + P key combo. Select the whole map in 2D, then press those keys in 3D. It would be great to have a keyboard shortcut to do the same for shade, specially for setting a global ambient shade for maps that use Polymer lights only :D

You could also select the whole map, then press - or + until everything has min/max shade; then use + or - again to have everything shaded equally from there. I haven't tested this, though.

This post has been edited by Diaz: 30 October 2012 - 03:00 AM

0

User is offline   Mark 

#1042

There is a command for setting all sectors to one shade. I don't recall what it is.
0

User is offline   Micky C 

  • Honored Donor

#1043

Just highlight the sectors then go ' + s in 3D mode to change the shade of all the walls, ceilings, floors and sprites.
0

User is offline   Diaz 

#1044

^ I've tried that and it just changes the shade of the object under the mouse cursor.
0

User is offline   Micky C 

  • Honored Donor

#1045

Hmm you're right...

There is a global shade divide function in the special functions menu but I don't know how useful that is. If there isn't a key combination for this, there really should be one made. IMO the ' + s should be made to work on all highlighted sectors since I'll bet it does the same thing regardless of whether or not anything is highlighted.
0

User is offline   Diaz 

#1046

Perhaps. Anyways, what I said above works. Just highlight everything, press - several times until everything is pitch black, then adjust from there.
0

User is offline   zazo 

#1047

I would like to create a projectile that works like a rpg and hitting the enemy as a arrow, not a hitradius style: what is the PROJ_WORKSLIKE value ??
0

User is offline   Cage 

#1048

Set the projectile's hitradius to zero and the workslike value should contain RPG flag ( 2 ) and RPG_IMPACT flag (32768), others to taste :D

Some help:
http://wiki.eduke32....efineprojectile
http://wiki.eduke32....FLAG_RPG_IMPACT
0

User is offline   zazo 

#1049

View PostCage, on 30 October 2012 - 10:22 AM, said:

Set the projectile's hitradius to zero and the workslike value should contain RPG flag ( 2 ) and RPG_IMPACT flag (32768), others to taste :D

Some help:
http://wiki.eduke32....efineprojectile
http://wiki.eduke32....FLAG_RPG_IMPACT


PROJ_WORKSLIKE 32770
0

User is offline   blizzart 

#1050

Hi,
I´ve just tried to use this example of code from EDuke Wiki in my mod: http://wiki.eduke32....reen_Background

But everytime I try to run the game I get several errors depending on that code. I´ve attached the log file, the GAME.CON (the new code is at the bottom of the file) and the EDUKE.CON (using Darkus` Flashlight code and the Hub map code by Trooper Dan, which I commented out for testing).

Attached File  eduke32.log (928bytes)
Number of downloads: 729
Attached File  EDUKE.CON (7.25K)
Number of downloads: 760
Attached File  GAME.CON (147.71K)
Number of downloads: 824
0

Share this topic:


  • 120 Pages +
  • « First
  • 33
  • 34
  • 35
  • 36
  • 37
  • 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