EDuke32 Scripting "CON coding help"
#632 Posted 31 March 2011 - 12:14 AM
if I'm near the floor then
{
be a floor-aligned sprite
}
else
{
be a normal aligned sprite
if I'm near a wall then be a wall aligned sprite and set my angle to the wall's angle
}
Getting the floor aligned part to work is easy. But I don't see a way to make an actor check for walls in this way. I was sort of hoping that perhaps the projectile passes information on what it hit to the sprite that it spawns on impact, but maybe this is just wishful thinking. And since the explosion is meant to remain stationary, I can't use htmovflag to test for walls.
This post has been edited by wayskobfssae: 31 March 2011 - 12:19 AM
#633 Posted 31 March 2011 - 08:27 AM
#634 Posted 31 March 2011 - 08:37 PM
DeeperThought, on 31 March 2011 - 08:27 AM, said:
Excellent, TY. Yes, I already had the idea for how to calculate the wall angle, I just couldn't think of a way to get the wall's ID number from the projectile.
Good info too, so now I also know how to make bullets spawn blood when they hit a monster.
#635 Posted 31 March 2011 - 08:55 PM
wayskobfssae, on 31 March 2011 - 08:37 PM, said:
Good info too, so now I also know how to make bullets spawn blood when they hit a monster.
If the bullet is hitscan, then you should spawn the blood from the SHOTSPARK1 actor when the bullet hits, since there is no real projectile. For an example of this, you can check the code in DukePlus or in several other released mods. The key to making it work is getting data from the htg_t array in the SHOTSPARK1 actor: http://wiki.eduke32.com/wiki/Htg_t Specifically, you want htg_t 8
#636 Posted 11 April 2011 - 01:06 PM
// Kuribo define KURIBO1 8231 define KURIBO2 8232 action KURIBOANIM 8231 2 1 1 8 move KURIBOMOVE 0 32 useractor enemy KURIBO1 1 KURIBOANIM KURIBOMOVE cstat 257 ifhitweapon { // spawn something better when I have implemented it... spawn BLOOD killit } enda
In short, it is supposed to make the enemy walk in one direction once the player can see it, but all that happens is the actor is invisible in the game, some of the code executes, but it does not appear to move and is, as I said, invisible. This is happening with every actor I put in (with several other anomalies, but I can work around those).
Anybody got any ideas as to what is going on? I know I probably forgot something stupid.
#637 Posted 11 April 2011 - 01:52 PM
useractor enemy KURIBO1 1 ifmove 0 { move KURIBOMOVE geth sizeat 40 40 action KURIBOANIM cstat 257 } ifhitweapon { // spawn something better when I have implemented it... spawn BLOOD killit } enda
#638 Posted 11 April 2011 - 04:32 PM
#639 Posted 11 April 2011 - 04:44 PM
#640 Posted 11 April 2011 - 04:50 PM
High Treason, on 11 April 2011 - 04:44 PM, said:
Quote
define KURIBO2 8232
action KURIBOANIM 8231 2 1 1 8
This is telling it to start the action on frame 16462. The first number in the action frame (in this case) should be 0.
This post has been edited by Wolf: 11 April 2011 - 04:51 PM
#641 Posted 11 April 2011 - 04:51 PM
High Treason, on 11 April 2011 - 04:44 PM, said:
Heh, I see what you did. I didn't even look at your action definition before, but it's obviously wrong. It should look like this:
action KURIBOANIM 0 2 1 1 8
Remember, the first parameter of the action command is relative to the actor's defined tile number. Look at all the examples in the original CONs and look at the wiki if you don't understand.
#642 Posted 11 April 2011 - 05:00 PM
#643 Posted 12 April 2011 - 03:19 PM
#644 Posted 16 April 2011 - 07:40 PM
I wanted to do some basic con editing - VERY basic con editing. Back in the days of running Duke 3D through MS DOS, editing the user.con for weapon damages, ammo capacities etc was relatively straightforward.
However, with the HRP and eDuke I've been having some difficulty making the requisite changes.
Basically, I edited the CON files for the following characterstics:
Ammo Capacity for specific weapons
Weapon Damage
Enemy HP
Ammo pick up amount
Of this, only the first change has been successful. I've tried changing the other variables but to no avail.
So then I tried replacing the USER.CON file in DUKE3D.GRP with Loom's GRP viewer, but when I try to run the eDuke executable, it says something about "failed to load art". I know the USER.CON file has been succesfully replaced, because it's size within the viewer had changed.
The weird thing is how that first change works, but the others don't - I'd have expected all the variables to display the same consistency, but the CON file seemed to be able to override the GRP without trouble - except only for that variable set.
#645 Posted 16 April 2011 - 08:22 PM
SleeperService, on 16 April 2011 - 07:40 PM, said:
Don't do that. Leave the edited USER.CON loose in your folder, and it will override the one inside DUKE3D.GRP
If you change those things you mentioned, it should work just like back in '96.
Without more information, I can't tell why only one of your edits is working. It's possible that you edited the wrong values. Attach a copy of your eduke32.log if you can't get it to work, and it should tell us if there's anything weird in your setup.
#646 Posted 16 April 2011 - 08:37 PM
This post has been edited by SleeperService: 16 April 2011 - 08:37 PM
#647 Posted 30 April 2011 - 08:51 AM
#648 Posted 05 May 2011 - 08:37 AM
I have a little question about health changing in my custom actor code.
How to set the health to a value given (like 100 to 1)?
I don't mean to add/remove health, but just set the health.
Any ideas...?
#649 Posted 05 May 2011 - 09:07 AM
Superthijs, on 05 May 2011 - 08:37 AM, said:
I have a little question about health changing in my custom actor code.
How to set the health to a value given (like 100 to 1)?
I don't mean to add/remove health, but just set the health.
Any ideas...?
http://wiki.eduke32.com/wiki/Strength
#650 Posted 06 May 2011 - 10:03 AM
1) Is there any con-access to the value that's being added/subtracted to the cameraz variable when the player moves?
and if not, then
2) can I get any advice on how to start manipulating that variable in tandem with the player's movement? I've altered the cameraz variable easily enough when I was setting it to a fixed number, but trying to make it move up and down in a fluid pattern as the player moves is probably going to be way more challenging.
This post has been edited by EmericaSkater: 06 May 2011 - 10:03 AM
#651 Posted 06 May 2011 - 10:29 AM
EmericaSkater, on 06 May 2011 - 10:03 AM, said:
1) Is there any con-access to the value that's being added/subtracted to the cameraz variable when the player moves?
and if not, then
2) can I get any advice on how to start manipulating that variable in tandem with the player's movement? I've altered the cameraz variable easily enough when I was setting it to a fixed number, but trying to make it move up and down in a fluid pattern as the player moves is probably going to be way more challenging.
Interesting problem. Here's what I would do (and I might do it myself if I have time later today). First, in one of the display events (you could use EVENT_DISPLAYROOMS), set the cameraz to the player head height (getplayer[screenpeek].posz cameraz). This will set the height to a neutral position before you manipulate it, thereby negating whatever hardcoded z movement is going on. Next, use a sin function to make the camera move up and down when the player is on the ground and walking/running. Use the player's velocity (determined by posxv and posyv in the player struct) to determine the length of the wave (higher velocity means shorter waves). You also need to factor the passage of time in there somewhere, comparing player_par from the start of movement to the current time (I know that's vague, but it would be easier if I were looking at actual code). Shift the result some bits to the right or left as appropriate (probably to the right, since the result of the sin function will give you a big number) and add the result to cameraz. If your mod uses footstep sounds, make them occur when cameraz is at the lowest point.
#652 Posted 07 May 2011 - 04:53 AM
- Not quite sure how to get the player's velocity from the posx/v struct members. I hope you'll bare with me, I've never altered them before. Course, trying to use just one for the sin calculation didn't do anything, nor did add/subtracting them.
- I'm not even totally sure where I 'should' be using the sin function. I know I'm trying to produce a number to add to the cameraz variable, but you can only alter that variable in the displayrooms event (IIRC), which brings round another point...
- After I fixed the cameraz variable, I started trying alter it by adding onto it when the player was walking. The value would get added once, then remain unchanged.
#653 Posted 07 May 2011 - 05:51 PM
Quote
- Cosine Theorem ? (posxv^2 + posyv^2 - 2posxv*posyvcos(anglefromposxandposy) = velocity^2)
About length of wave... I hope you don't mean the arc length, because that needs integration
Note : As to why I'm interested in this myself, I both want to code this also and get back into modding for Duke.
#654 Posted 07 May 2011 - 08:19 PM
first, variable declarations:
gamevar camshake 0 1
gamevar temp 0 0
In the player actor, add the following:
ifp ponground { ifp pwalking addvar camshake 128 ifp prunning addvar camshake 256 ifp pducking setvar camshake 0 ifp pjetpack setvar camshake 0 ifp pstanding setvar camshake 0 } else setvar camshake 0
Then you will need some event code:
onevent EVENT_DISPLAYROOMS ifvare player[screenpeek].over_shoulder_on NO ifvarg camshake 0 { getplayer[screenpeek].posz cameraz sin temp camshake shiftvarr temp 4 subvarvar cameraz temp } endevent
If you like it, feel free to use it, change it, or whatever. One flaw is that the camera keeps bobbing for a moment after the player stops running. This is because the player's sprite animation does not stop immediately. I'll edit this again later if I think of a simple way to fix that.
#655 Posted 07 May 2011 - 09:32 PM
#656 Posted 08 May 2011 - 09:04 AM
DeeperThought, on 07 May 2011 - 08:19 PM, said:
Wow, thanks! It took a little bit of finagling with the numbers to make it look the way I wanted, but it's working well. The drawback you mentioned is negligible, though it seems to me less like the screen's continuing to bounce, and more like it's returning to the position it started in. Course, you wrote the code (in addition to trumping me in pretty much every imaginable way when it comes to this stuff) so you'd know about it better than I would.
#657 Posted 01 June 2011 - 06:02 AM
state correctcansee setvar sightvar 0 getactor[THISACTOR].z mz getplayer[THISACTOR].i ID getactor[ID].z posz subvar posz 8192 setactor[ID].z posz getactorvar[THISACTOR].height htemp ifvare htemp 0 setvar htemp 6144 subvarvar mz htemp setactor[THISACTOR].z mz canseespr THISACTOR ID sightvar addvarvar mz htemp addvar posz 8192 setactor[ID].z posz setactor[THISACTOR].z mz ends
The way I use this state can also be the problem so, I just use an ifrnd check and then this state and check if sightvar == 1 then move on to firing AI.
#658 Posted 01 June 2011 - 09:22 AM
XThX2, on 01 June 2011 - 06:02 AM, said:
state correctcansee setvar sightvar 0 getactor[THISACTOR].z mz getplayer[THISACTOR].i ID getactor[ID].z posz subvar posz 8192 setactor[ID].z posz getactorvar[THISACTOR].height htemp ifvare htemp 0 setvar htemp 6144 subvarvar mz htemp setactor[THISACTOR].z mz canseespr THISACTOR ID sightvar addvarvar mz htemp addvar posz 8192 setactor[ID].z posz setactor[THISACTOR].z mz ends
The way I use this state can also be the problem so, I just use an ifrnd check and then this state and check if sightvar == 1 then move on to firing AI.
What you are doing there is kind of strange. It's impossible to know what is in the variable named "height" prior to the state execution, which makes it difficult to evaluate. The most likely problem is that you are not actually moving the monster up before the sight check.
state correctcansee getactor[THISACTOR].z mz subvar mz 8192 setactor[THISACTOR].z mz ifcansee setvar sightvar YES else setvar sightvar NO addvar mz 8192 setactor[THISACTOR].z mz ends
How does this state work for you? Notice I moved the monster up, but not the player, then I did the regular "ifcansee" height check.
#659 Posted 01 June 2011 - 10:03 AM
And for your code, as always you've saved me from that big trouble ! I can't thank you enough for that ! I get what you did, but I have no idea why my method messed the monsters up. They all work as intended
#660 Posted 01 June 2011 - 10:13 AM
XThX2, on 01 June 2011 - 10:03 AM, said:
And for your code, as always you've saved me from that big trouble ! I can't thank you enough for that ! I get what you did, but I have no idea why my method messed the monsters up. They all work as intended
Now that you've explained it, it does seem that your code should have been working, assuming that each monster's height var stored the distance between its feet and eyeballs. You might want to check to make sure that variable has the correct values.