
EDuke32 Scripting "CON coding help"
#977 Posted 14 October 2012 - 12:49 AM
Consider that i posted it for zazo and i think it's the "simplest" working version to understand, it's a modified version of which i really use, too.
@ zazo: I forgot to add a comment saying that you need to add "case GOBELIN" among all enemy types i wrote there (and you can remove them from there if you want).
This post has been edited by RichardStorm: 14 October 2012 - 12:51 AM
#978 Posted 14 October 2012 - 02:19 PM
I thought the canseespr was easier to use...
#979 Posted 14 October 2012 - 02:36 PM
zazo, on 14 October 2012 - 02:19 PM, said:
I thought the canseespr was easier to use...
also, I just discovered that there is ally AI in "duke plus"
#980 Posted 14 October 2012 - 06:32 PM
zazo, on 14 October 2012 - 02:36 PM, said:
Also, all of the enemies in DukePlus can become allies if they are flagged that way in a map or if hit with the shrinker in mindlbast mode.
#981 Posted 15 October 2012 - 04:10 AM
Trooper Dan, on 14 October 2012 - 06:32 PM, said:
another little problem: how to creat an animated projectile in 5 sides:
"
define flyingaxe 5500
defineprojectile ...... etc (settings for projectile)
action flyingaxeframe 0 4 5 1 10
useractor notenemy flyingaxe 0 flyingaxeframe enda
"
only the first frame appears but not the entire animation ?
#982 Posted 15 October 2012 - 04:31 AM
zazo, on 15 October 2012 - 04:10 AM, said:
"
define flyingaxe 5500
defineprojectile ...... etc (settings for projectile)
action flyingaxeframe 0 4 5 1 10
useractor notenemy flyingaxe 0 flyingaxeframe enda
"
only the first frame appears but not the entire animation ?
An action has to be declared for each frame of the animation
action flyingaxeframe1 0 1 5 1 10 action flyingaxeframe2 5 1 5 1 10 action flyingaxeframe3 10 1 5 1 10 action flyingaxeframe4 15 1 5 1 10 useractor notenemy flyingaxe 0 flyingaxeframe1 enda //initialized to the first action
Then you rig the animation with a peractor variable in EVENT_GAME
gamevar countvar 0 2 gamevar picnum 0 2 onevent EVENT_GAME getactor[THISACTOR].picnum picnum ifvare picnum flyingaxe { addvar countvar 1 ifvarg countvar 1 { setvar countvar 0 ifaction flyingaxeframe1 action flyingaxeframe2 else ifaction flyingaxeframe2 action flyingaxeframe3 else ifaction flyingaxeframe3 action flyingaxeframe4 else ifaction flyingaxeframe4 action flyingaxeframe1 } } endevent
#983 Posted 15 October 2012 - 05:14 AM
EmericaSkater, on 15 October 2012 - 04:31 AM, said:
action flyingaxeframe1 0 1 5 1 10 action flyingaxeframe2 5 1 5 1 10 action flyingaxeframe3 10 1 5 1 10 action flyingaxeframe4 15 1 5 1 10 useractor notenemy flyingaxe 0 flyingaxeframe1 enda //initialized to the first action
Then you rig the animation with a peractor variable in EVENT_GAME
gamevar countvar 0 2 gamevar picnum 0 2 onevent EVENT_GAME getactor[THISACTOR].picnum picnum ifvare picnum flyingaxe { addvar countvar 1 ifvarg countvar 1 { setvar countvar 0 ifaction flyingaxeframe1 action flyingaxeframe2 else ifaction flyingaxeframe2 action flyingaxeframe3 else ifaction flyingaxeframe3 action flyingaxeframe4 else ifaction flyingaxeframe4 action flyingaxeframe1 } } endevent
very subtle, but ils work !
I have never found myself! thanks
#984 Posted 15 October 2012 - 09:17 AM
EmericaSkater, on 15 October 2012 - 04:31 AM, said:
gamevar countvar 0 2 gamevar picnum 0 2 onevent EVENT_GAME getactor[THISACTOR].picnum picnum ifvare picnum flyingaxe { addvar countvar 1 ifvarg countvar 1 { setvar countvar 0 ifaction flyingaxeframe1 action flyingaxeframe2 else ifaction flyingaxeframe2 action flyingaxeframe3 else ifaction flyingaxeframe3 action flyingaxeframe4 else ifaction flyingaxeframe4 action flyingaxeframe1 } } endevent
I would prefer to just use ifactioncount instead of "countvar".
#985 Posted 17 October 2012 - 07:29 AM
#986 Posted 17 October 2012 - 11:05 AM
The problem is that when a map is loaded, by default all sprites with a cstat of 1 are set to 257 automatically. Meaning that you must force it to remain at 1 via CON.
#987 Posted 17 October 2012 - 01:24 PM
Fox, on 17 October 2012 - 11:05 AM, said:
The problem is that when a map is loaded, by default all sprites with a cstat of 1 are set to 257 automatically. Meaning that you must force it to remain at 1 via CON.
getplayer[THISACTOR]. .....
member structur to get the player health as a variable ?
#988 Posted 17 October 2012 - 01:33 PM
Why don't you get a look to this ? http://wiki.eduke32....ructure_members
// EDIT
Sorry i read wrong. If you need to use it inside the aplayer actor you could simply write getactor[THISACTOR].extra. In other cases use getactor[player[THISACTOR].i].extra.
This post has been edited by RichardStorm: 17 October 2012 - 01:42 PM
#989 Posted 18 October 2012 - 01:43 AM
RichardStorm, on 17 October 2012 - 01:33 PM, said:
Why don't you get a look to this ? http://wiki.eduke32....ructure_members
// EDIT
Sorry i read wrong. If you need to use it inside the aplayer actor you could simply write getactor[THISACTOR].extra. In other cases use getactor[player[THISACTOR].i].extra.
thanks, with the cstat values i search a property for actor to cross any other: this actor can not be stopped by actors "solid" in cstat 1.257 ...: it could be a single projectile (or actor) that pierce a line of ennemies and finally stops in the walls ...

Is it possible ?? also would try to force the coordinates with the x,y variables...
#990 Posted 18 October 2012 - 04:50 AM
zazo, on 18 October 2012 - 01:43 AM, said:

Is it possible ?? also would try to force the coordinates with the x,y variables...
possible to change the spritepal of the weapons in hands in first person view (tiles 2524) in game ?
in the player code, spritepal change only the color in third person view (F7).
#991 Posted 18 October 2012 - 07:01 AM
zazo, on 18 October 2012 - 04:50 AM, said:
in the player code, spritepal change only the color in third person view (F7).
You can change the spritepal of hud items, but it requires that they be drawn using CON scripting commands. By default all the hud stuff is hardcoded. EVENT_DISPLAYWEAPON can be used to override the hardcoded weapon display and make your own. Also, Hendricks266 wrote a mod that perfectly replicates all of the hud display using CON script, meaning you can use that mod and easily change the pal values as you desire.
#992 Posted 19 October 2012 - 10:11 AM
Trooper Dan, on 18 October 2012 - 07:01 AM, said:
another annoying problem: the shrinker weapon ( shoot SHRINKER ) not working when it is shot by a new enemy code ( useractor or actor)...
??
#994 Posted 20 October 2012 - 02:40 AM
#995 Posted 20 October 2012 - 08:45 AM
#996 Posted 20 October 2012 - 09:58 AM
Overall it would be very usefull to have some some sort of a gamevar with ranging ID, similar to ammo_amount #. Instead of the player scoring system, what if I wanted to have something like that for actors? It would require 16384 gamevars!
#997 Posted 20 October 2012 - 12:34 PM
the shrinkspark is shot with shoot SHRINKER
i changed the max player health. Is that the reason?
#998 Posted 20 October 2012 - 01:02 PM
zazo, on 20 October 2012 - 12:34 PM, said:
the shrinkspark is shot with shoot SHRINKER
i changed the max player health. Is that the reason?
all right, the error comes from my side: I moved and badly replaced some } in the code.
now ils work

#999 Posted 22 October 2012 - 03:54 AM
I experimenting stuff with monsters and I have a little problem;
- I noticed that the enemies move differently with the chosen Difficulty: For example, in easy mode, their movements seem more 'smooth', but in normal mode or above, they move seems more 'realistic' (when they walking).
The problem is when I create an enemy that moves very fast. In easy mode it's okay, but in higher difficulties modes, he seems to "skip" or "teleport" in his movements.
So I asking if it's possible make him move 'smoothly', like in easy mode on other difficulties.
#1001 Posted 22 October 2012 - 08:42 AM
Even if you are not using a custom CON file, you can still notice this behavior with the Newbeast.
#1002 Posted 22 October 2012 - 03:44 PM
Anyway, main reason I am in here, second time in 24 hours I've been stumped, first ran into a problem with this and scrapped the code (a good thing, it was inefficient anyway).
Basically, I have a waypoint for some AI, I use eventloadactor to get it's lotag into a peractor variable, say, "WAY_LT" but I need this info in another actor, as it is used to tell that actor special things about that point of the path (and running more findnearactor code is likely not good for CPU usage). Anyway, the actor that uses the waypoints does several things, one of them is that once following a path, it will use findnearactor to get the ID of a waypoint in range to a var "WAY_ID" - as soon as WAY_ID is not -1 it stops looking and asks a bit more about the waypoint, a lot like this;
ifvarn WAY_ID -1 { getactorvar[WAY_ID].WAY_LT WAY_MD // The WAY_MD var is global, WAY_LT is peractor getactor[WAY_ID].ang STALKER_TANG // This seems to work every time // Some other stuff is in here, which all seems to do what it is supposed to... }
The actor successfully gets the angle of the waypoint, which is useful as this is what it tries to change it's own angle to by default, but WAY_LT is always 0. It doesn't stop there, in my previous effort, I set one waypoints xvel (I was using that in place of the lotag at the time, that was already in use) and from then on, it always ended up setting to that one waypoint's xvel, even at other waypoints (dndebug revealed that each waypoint's xvel was 0, as set in eventloadactor, it would only happen with that particular one.
This is all being tested in a new map so I don't think it can be my map being broken, this is the latest EDuke, but I was using one from June when I first ran into the bug (hence updating).
It is more than likely I have misunderstood the purpose of the getactorvar command? I still don't pretend to be any good at CON coding, I can usually get things to work now though without asking for help, so I've let myself down. I can post more code if required.
#1003 Posted 22 October 2012 - 07:16 PM
The only other thing I can think of is that findnearactor will always return the same actor within its range if the same range is used from the same coordinates, but I don't remember if that actor is necessarily the closest one.
#1004 Posted 22 October 2012 - 07:18 PM
#1005 Posted 23 October 2012 - 12:30 AM
High Treason, on 22 October 2012 - 03:44 PM, said:
You may also want to look at the older version of my A* pathfinding code here. The associated ART tiles are missing but the code for waypoint building, path finding, and a basic AI for an actor that moves along a path of waypoints from A to B is all there. And it sounds like it did exactly what you're trying to do, at least in terms of creating a global array of waypoints as Mblackwell suggested and building a navigation path from one to the next. Feel free to use the code in part or in whole if it's what you need.
Though depending on what you're trying to do exactly, I may suggest my newer A* since it's better in every conceivable way.
This post has been edited by Reaper_Man: 23 October 2012 - 12:31 AM
#1006 Posted 23 October 2012 - 07:16 AM
Darkus, on 22 October 2012 - 03:54 AM, said:
I experimenting stuff with monsters and I have a little problem;
- I noticed that the enemies move differently with the chosen Difficulty: For example, in easy mode, their movements seem more 'smooth', but in normal mode or above, they move seems more 'realistic' (when they walking).
The problem is when I create an enemy that moves very fast. In easy mode it's okay, but in higher difficulties modes, he seems to "skip" or "teleport" in his movements.
So I asking if it's possible make him move 'smoothly', like in easy mode on other difficulties.
This is actually a very good post. Your request will be granted, though since it effectively directly changes per-tic movement rates for enemies and how often these movements occur, it will have to be tested pretty thoroughly to make sure the overall rate of speed still more or less matches the original game.
I am also taking the opportunity to add a new sprite flag that enables smooth movement. It turns out that in the original code, skills 0 and 1 allow the enemy to move once every other game tic whereas skills 2 and 3 allow movement at twice the normal speed for 3 tics in a row with every 4th tic having the movement cancelled. I don't think this is optimal at all, so I'm changing it so that all skills allow movement once every other tic. I had tested it with movement being allowed every tic, but it was TOO smooth and looked really, really strange, which is where the new sprite flag comes in... since some people have requested it in the past, the new flag will allow movement every tic without anything involving the skill coming into play.