
EDuke32 Scripting "CON coding help"
#620 Posted 10 March 2011 - 01:40 PM
There are actually 8 duplicates defined from how it was originally intended to be coded before I integrated it in one actor (the switch).
So yeah, switch can only be on or off. When I only had "action CBPRESS" in the code, it did the same thing and just flickered on and off.
#621 Posted 10 March 2011 - 02:00 PM
action CBPRESS 1 1 1 1 1
If not, then it's your fault and you need to change the art or whatever. With that in mind, here is some code that should work:
define NCBPBUTTON1 3590 useractor notenemy NCBPBUTTON1 0 ifaction CBPRESS break ifp pfacing // this is not perfect but it's good enough for now ifpdistl 800 ifhitspace ifcanseetarget { action CBPRESS sound SWITCH_ON quote 150 ifvare LEVEL 1 setvar NCBP1 1 else ifvare LEVEL 2 setvar NCBP2 1 else ifvare LEVEL 3 setvar NCBP3 1 else ifvare LEVEL 4 setvar NCBP4 1 else ifvare LEVEL 5 setvar NCBP5 1 else ifvare LEVEL 6 setvar NCBP6 1 else ifvare LEVEL 7 setvar NCBP7 1 else ifvare currlev 8 setvar NCBP8 1 } enda
Note that this code still looks kind of odd. Why do you have a different variable for each level? I'm sure you can get by with only one variable. Also, note that LEVEL equals 0 in the first level of an episode, and you have the switch doing nothing in the case. I'm not sure if that's what you intended.
This post has been edited by DeeperThought: 10 March 2011 - 03:25 PM
#622 Posted 10 March 2011 - 02:22 PM
The switch updates the HUD depending on what level you are on (there are 8 dots at the top, one to symbolise each level) and also causes a panel to dissapear in the hub map (LEVEL 0 - there is no switch in the hub map).
The code functions, but the switch does not change tile (the tile with the ON position) when I press it. It's probably my fault and I'm half inclined to leave it.
#623 Posted 10 March 2011 - 02:34 PM
High Treason, on Mar 10 2011, 02:22 PM, said:
Make tile 3590 the switch in one position and tile 3591 the switch in the other position (whatever order you want). That's all there is to it. Why would you leave it when it is so easy to fix?
You can easily get rid of those variables and just have one variable that is used as a bit field, but that's a story for another time.
#624 Posted 10 March 2011 - 03:04 PM

There are eight of those panels, one more dissapears in the hub map for every level you hit the switch in - this part works. Do I need to set up the "On" tile in the .con in some way? I'm willing to bet I've gone and overlooked something stupid. As for bitfields, yeah, that is for another time, I've never used them yet, to be honest, with the one-time-use of the switch, I could get it working using addvar, but then I would have to change code in other places for something that would likely be un-noticed in the game.
#625 Posted 10 March 2011 - 03:25 PM
action CBPRESS 1 1 1 1 1
I don't know how I managed to miss that.
#626 Posted 10 March 2011 - 04:07 PM
You have been added to the credits list for the project, if you want removing from it for some reason, let me know and I'll remove it.
#627 Posted 10 March 2011 - 04:38 PM
This post has been edited by DeeperThought: 10 March 2011 - 04:39 PM
#628 Posted 10 March 2011 - 04:57 PM

#629 Posted 17 March 2011 - 10:50 AM
onevent EVENT_DISPLAYWEAPON
{
getplayer[THISACTOR].curr_weapon temp
ifvare temp PISTOL_WEAPON
{
setvar RETURN -1
}
}
endevent
But... I get no change. I've tried using both PISTOL_WEAPON and 1 as the value for RETURN. And I've tried both displayweapon and drawweapon as the event.
#630 Posted 17 March 2011 - 11:12 AM
onevent EVENT_DISPLAYWEAPON ifvare currentweapon 1 setvar RETURN -1 endevent
#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