Forum Archive

Go Back   3D Realms Forums > 3D Realms Topics > Duke Nukem > Duke Nukem 3D Modifications
Blogs FAQ Community Calendar

Notices

 
 
Thread Tools
Old 09-02-2006, 06:10 AM   #1
Lord Misfit

Lord Misfit's Avatar
Duke Nukem Using vars with quotes and displaying vars on screen in text form...
Okay, I've done some checking on the EDuke32Wiki before coming here, and from what I've seen, there's nothing mentioned about this, so I will ask:

Basically, I'm trying to make a 'money' system for kicks, it's actually an improved remake of an older system I lost a while back. Basically Duke finds money ranging from Pennies to Trillion-Dollar bills[>.>] and when he picks them up(by ducking and pressing the use button while looking at them), it is set to alter two different vars so Duke is actually grabbing money as he travels. One immediate thing this could be for is tipping the women in the game, as if Duke doesn't have the money to tip, I can code it that he won't actually do it. But this is just a small and basic example.

The money system I have uses two primary vars, DOLLARS and CENTS. Basically what I really wanna do is get it that you can display the exact amount of DOLLARS and CENTS on the screen somehow(perhaps without the text fading off the screen too), whether it be through the quotes or perhaps through a different form of visual display that doesn't require having to write a quote fracture for every possible number from 1 to 1 trillion(in otherwords, it'd have to use the vars).

I wanna know if it's possible as of this verstion(140 beta 2) to actually use vars in general in quotes or other graphical displays on the screen for easier use? If not, would it be asking too much to try to add future support for it? It'd probably have more uses than some of you would think. Even if it's not for quotes, but for at least a status-like display like the Kills/Secrets/Time Ratio used.

Just wondering, because as I can tell, I see nothing on the Wiki mentioning of the use. Although off hand, redefinequote makes it a lot more flexible when picking up the money actors.

Okay, I'm done with the post for now.
Lord Misfit is offline  
Old 09-02-2006, 10:51 AM   #2
Hendricks266
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Use digitalnumber.
Hendricks266 is offline  
Old 09-02-2006, 11:48 AM   #3
TerminX

TerminX's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form
There's an undocumented way to display the values of gamevars in the text of a quote, but I've just changed how it works as of this writing. However, the change isn't really huge, so I guess I can explain it anyways. The command you need to use is called 'dynquote' and it takes up to 5 parameters. The first is the quote number, and the other 4 are gamevars. All you have to do is place %ld in the quote text in the places where you want the gamevars to be plugged in.

The difference between dynquote in 1.4.0 beta 2 and dynquote in all future versions is that the command previously wrote the resulting text to a temporary quote and then automatically displayed it, whereas now the result is written back to the source quote instead so that the programmer can use it with any of the other functions which use quotes.
TerminX is offline  
Old 09-02-2006, 12:49 PM   #4
DeeperThought

DeeperThought's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form
Nice. I'll keep that in mind for the next time I work on menus.
__________________
DUKE PLUS
New map effects and various optional extras for Duke 3D.

DUKE NUKEM: ATTRITION
XP based weapon upgrades, progressive difficulty, and more.
DeeperThought is offline  
Old 09-02-2006, 07:01 PM   #5
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Between your replies, I got things down as I needed to.

However, as noob as this sounds, I have a different problem. It has to do with the actual tiping, or as it might become in the future, any kind of action requiring use of deducting from money.

The thing is, when I go to tip one of the women, if I hold down space even a bit too long, I end up eating away more money than I should. It's been a long while since I actively CON-coded(at least a couple years), and I forget how, but there's supposed to be a way to code it that it forces the player to wait a while before they can do something again, such as a tip in order to prevent uncontrollable money munching.

Here's my current code as below. If anyone can just add in what is necessary to stop the constant munching of money, it'd be appriciated.
Code:
state tipme
  ifp pfacing
    ifpdistl 1280
      ifhitspace
  {
    ifvarg TRUEDOLLARS 99
     {
     tip
     subvar DOLLARS 100
     ifrnd 128
       soundonce DUKE_TIP1 break
     else
       soundonce DUKE_TIP2 break
     ifactor FEM1
       action FEMDANCE1 break
     }
     else 
     { 
        redefinequote 130 NOT ENOUGH MONEY, MAN! 
        quote 130
     }
  }
Sorry about the novice question, but again, I haven't coded in forever, and I forget. I tried actioncount and count-related stuff, but it didn't help any that I could tell.
Lord Misfit is offline  
Old 09-02-2006, 09:23 PM   #6
DeeperThought

DeeperThought's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form
This is the method I use for things like this. It's better than making the player wait for a certain amount of time, because it allows you to spend the money as fast as you want by rapidly pressing space, but if you hold down space it will only spend it once, no matter how long it is held.

Code:
gamevar TEMP 0 2
gamevar spacepresstime 0 1
// these vars can and probably should be declared somewhere else
 
state tipme
  ifp pfacing
    ifpdistl 1280
      ifhitspace
  {
   getplayer[THISACTOR].player_par TEMP
  addvar spacepresstime 1
  ifvarvare TEMP spacepresstime nullop else
   
   {
    ifvarg TRUEDOLLARS 99
     {
     tip
     subvar DOLLARS 100
     ifrnd 128
       soundonce DUKE_TIP1 break
     else
       soundonce DUKE_TIP2 break
     ifactor FEM1
       action FEMDANCE1 break
     }
     else 
     { 
        redefinequote 130 NOT ENOUGH MONEY, MAN! 
        quote 130
     }
  }
  setvarvar spacepresstime TEMP
 }
ends // at least I assume the state ends here
__________________
DUKE PLUS
New map effects and various optional extras for Duke 3D.

DUKE NUKEM: ATTRITION
XP based weapon upgrades, progressive difficulty, and more.
DeeperThought is offline  
Old 09-02-2006, 10:00 PM   #7
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Sorry, but when I tried that, it had no effect for me at all. In fact, I think at one point it stopped me from being able to pick up any money at all on my test map. I'll try and mess with it, but... for now, I'm still open for suggestions.

And BTW, I am looking over DNWMD for help too, but some of it is stuff I had never believed could've been done so well. Good job on it so far.
Lord Misfit is offline  
Old 09-02-2006, 10:35 PM   #8
DeeperThought

DeeperThought's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form
Hmmm, I'm not sure. The technique I gave you works fine in my own code, but I use it in keypress events. There might be something about putting it in that state that screws it up. Well, since I've gone this far....if you want to send me your cons I can fix it.
__________________
DUKE PLUS
New map effects and various optional extras for Duke 3D.

DUKE NUKEM: ATTRITION
XP based weapon upgrades, progressive difficulty, and more.
DeeperThought is offline  
Old 09-09-2006, 10:30 AM   #9
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Alright, although this is not as connected to the old subject, I need a new question addressed:

Another thing I am sorta messing around with is an EXP/Level system. So far I got up to 25 or so levels define with their EXP ranges. That's not where the problem persists persay, but one of the things I was doing along with it was giving Duke an "Attack" stat, that is supposed to have an effect on his physical damage with his Mighty Boot. It's meant to be equal to ( (Attack * 2) + a random 1-5 damage )

The problem is that I cannot seem to figure out how to actually make this change the damage of the kick directly. I now that Deeperthought got it in DNWMD to have a variable that increases/changes the damage of all attacks, but I'm stumped to how he did it. Appearantly trying to change KNEE_WEAPON_STRENGTH with the variables I'm using isn't working.

Here's the code:

Code:
gamevar DUKEPHYSICALATTACK 5 1 // for the Mighty Boot Attack to determine damage. Increases with level.
gamevar KNEEDAMAGE 0 1
gamevar DAMAGERANDOMIZER 0 1

onevent EVENT_FIRE
{
setvarvar KNEEDAMAGE DUKEPHYSICALATTACK
mulvar KNEEDAMAGE 2
randvar DAMAGERANDOMIZER 5
addvarvar KNEEDAMAGE DAMAGERANDOMIZER
setvarvar KNEE_WEAPON_STRENGTH KNEEDAMAGE
}
endevent
The part I bolded is where the problem comes up. Appearantly you can't change weapon strengths through variables, so now to the question, how can I correct this to make it work and use variables to directly change weapon damage? >.>
Lord Misfit is offline  
Old 09-09-2006, 11:25 AM   #10
DeeperThought

DeeperThought's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form
KNEE_WEAPON_STRENGTH isn't a var, it is a defined value. I'm surprised that code isn't giving you errors.

There are different ways of doing it.

The way I do the player damage upgrade involves using the ht members of the sprite struct (specifically, htowner, htextra and htpicnum). Luckily for you, these all have wiki entries now.
__________________
DUKE PLUS
New map effects and various optional extras for Duke 3D.

DUKE NUKEM: ATTRITION
XP based weapon upgrades, progressive difficulty, and more.
Last edited by DeeperThought; 09-09-2006 at 11:30 AM.
DeeperThought is offline  
Old 09-09-2006, 12:12 PM   #11
Hendricks266
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
One of the many tweaks of H266MOD is having the mighty foot's damage increase slightly depending on the xvel of the player. I am planning to do another thing similar to that where if you fall on top of something your zvel and the distance you fell is calculated to do damage to what ever you fell on. So if you fall from the top of a building onto a LIZTROOP, both you and the LIZTROOP would be jibbed.

Here is what you would put in place of that:

Code:
setthisprojectile[THISACTOR].extra KNEEDAMAGE
I think you may have to replace THISACTOR with something else if it doesn't work.
Hendricks266 is offline  
Old 09-09-2006, 02:08 PM   #12
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Deeper: It was giving an error. I commented out the line but I bolded it just so you know where I knew the problem was.

Both: Sadly to say, none of that helped me all too much. Part of it is that I don't have much experience with get/setactor/player and all that stuff yet, so as much as I try it, it's going over my head right now.

Also, it doesn't help that setthisprojectile isn't mentioned at the Wiki at all. It doesn't error, but it's not affecting the attack at all either. I got not clue what I should set it too that's not THISACTOR.


This would probably blow over quick if I had a means to contact you on an IM client or something. >.>
Lord Misfit is offline  
Old 09-09-2006, 03:31 PM   #13
Hendricks266
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
I think the problem with my strategy is that hard-coded projectiles aren't compatible with set(this)projectile, but if it were it would be so much easier.
Hendricks266 is offline  
Old 09-09-2006, 03:41 PM   #14
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Hendricks: Yeah, it sounds like it'd be much easier. I noticed you have requests out for more redefine commands on the Wiki. I'm sure if those made it in, it'd also make this easier.

Both: Although I still have not had any luck linking the damage to the kick, I do know I got a temporary var on the screen to show what damage WOULD'VE been done by the kick. I'm still struggling to find a way to link it, but my lack of knowledge of the get/setplayer/actor is limiting my use of the ht commands, so they've not been any bit helpful yet. >.>
Lord Misfit is offline  
Old 09-09-2006, 05:56 PM   #15
Hendricks266
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Quick breakdown:

<g\s>et<see list>[<sprite id>].<member> <gamevar>

Get and set are pretty self-explanatory.

Here is the list of things for <see list>:
  • actor
  • player
  • wall
  • sector
  • userdef // This is a list of misc. settings.
  • projectile // This is used to alter all instances of a projectile. Instead of <sprite id>, put the <tilenum> in the square brackets.
  • thisprojectile // This is used to alter one instance of a projectile.

Each of them has their own list of members on the wiki, except (this)projectile. Both projectile and thisprojectile use the same set of members, which are the custom projectile members like workslike and spawns.
Hendricks266 is offline  
Old 09-09-2006, 06:26 PM   #16
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
well, since you mentioned of using a custom projectile with the thisprojectile functions, I went and made a "STATUSKNEE" attack that I was hoping would help me fix the problem. I set the weapon definition for WEAPON0 to shoot the STATUSKNEE attack. The attack itself works, but I still cannot for the life of me get the actual damage to change as I want it[it's by default just set to do a normal kick of damage]

Code:
define STATUSKNEE 2519

defineprojectile STATUSKNEE PROJ_WORKSLIKE 16
defineprojectile STATUSKNEE PROJ_ISOUND KICK_HIT
defineprojectile STATUSKNEE PROJ_EXTRA KNEE_WEAPON_STRENGTH
defineprojectile STATUSKNEE PROJ_CLIPDIST 10
defineprojectile STATUSKNEE PROJ_RANGE 896

onevent EVENT_FIRE

setvarvar KNEEDAMAGE DUKEPHYSICALATTACK
mulvar KNEEDAMAGE 2
randvarvar DAMAGERANDOMIZER DUKEPHYSICALATTACK
divvar DAMAGERANDOMIZER 2
ifrnd 128 { addvarvar KNEEDAMAGE DAMAGERANDOMIZER } else { subvarvar KNEEDAMAGE DAMAGERANDOMIZER } 
// setvarvar KNEE_WEAPON_STRENGTH KNEEDAMAGE

ifwasweapon STATUSKNEE
 {
setthisprojectile[THISACTOR].extra KNEEDAMAGE
 }

endevent
Is there anything someone can do to fix that up into a working code? Or do you need more info? :P
Lord Misfit is offline  
Old 09-09-2006, 06:39 PM   #17
Hendricks266
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Code:
define STATUSKNEE 2519

gamevar EGSFLAG 0 2
gamevar WEAPON0_SHOOTS STATUSKNEE GAMEVAR_FLAG_PERPLAYER

defineprojectile STATUSKNEE PROJ_WORKSLIKE 16
defineprojectile STATUSKNEE PROJ_SOUND KICK_HIT
defineprojectile STATUSKNEE PROJ_ISOUND KICK_HIT
defineprojectile STATUSKNEE PROJ_EXTRA KNEE_WEAPON_STRENGTH
defineprojectile STATUSKNEE PROJ_CLIPDIST 10
defineprojectile STATUSKNEE PROJ_RANGE 896

onevent EVENT_EGS // EVENT_EGS executes the code within only on the first tic of the actor's "life".
getactor[THISACTOR].picnum EGSFLAG
switch EGSFLAG

case STATUSKNEE:
setvarvar KNEEDAMAGE DUKEPHYSICALATTACK
mulvar KNEEDAMAGE 2
randvarvar DAMAGERANDOMIZER DUKEPHYSICALATTACK
divvar DAMAGERANDOMIZER 2
ifrnd 128 { addvarvar KNEEDAMAGE DAMAGERANDOMIZER } else { subvarvar KNEEDAMAGE DAMAGERANDOMIZER } 
ifspawnedby APLAYER { setthisprojectile[THISACTOR].extra KNEEDAMAGE }
break

endswitch
endevent
You do not need EVENT_FIRE code, just this. The gamevar "WEAPON0_SHOOTS" says what projectile is shot when the mighty foot is used. The animations will still play. I'm not sure whether or not this would apply to quickkicks, though. There is a way to test that. It would involve printing a quote just after the damage is set, but before the "break".

Happy Testing!
Hendricks266 is offline  
Old 09-09-2006, 07:25 PM   #18
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Well, although I have no errors with the code you provided, the attack still seems to want to inflict the usual Kick damage even when the KNEEDAMAGE is well beyond it.

A while back when I first started making this, I made it that the variable for the overall damage the STATUSKNEE inflicted would be displayed on screen. I notice with your code the number will only change when the kick connects with something solid. However, it still only does the usual 10 damage, even if the damage range should be 400-600. :\

The code is still the same as you posted, nothing changed. \

Code:
// displays the actual STATUSKNEE damage var

setvar digx 21
setvar digy 88
setvar tilenum 3087 
setvar shade 0
setvar pal 21
setvar orientation 27

digitalnumber tilenum digx digy KNEEDAMAGE shade pal orientation ZERO ZERO xdim ydim
If you want to test for damage areas, use the console to edit the DUKEPHYSICALATTACK var, as that is the backbone of the damage formula.

Very sorry for the annoyances this is causing.
Lord Misfit is offline  
Old 09-10-2006, 08:35 AM   #19
Hendricks266
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
OK, this is what you have to do. First, delete\backup\comment out that EVENT_EGS code. Next, go through all the actors' code and add a state called "state status_knee_damage_control" at the very beginning of it, right after to the actor definition (i.e. "actor LIZTROOP TROOPSTRENGTH ATROOPSTAND"). Last, put this state above all actors, right up there with "action ANULLACTION 0", but after your gamevars and projectiles are defined.

Code:
gamevar picnum 0 2

state status_knee_damage_control
getactor[THISACTOR].htpicnum picnum
ifvare picnum STATUSKNEE {
getactor[THISACTOR].htextra KNEEDAMAGE
addvarvar KNEEDAMAGE DUKEPHYSICALATTACK
mulvar KNEEDAMAGE 2
randvarvar DAMAGERANDOMIZER DUKEPHYSICALATTACK
divvar DAMAGERANDOMIZER 2
ifrnd 128 { addvarvar KNEEDAMAGE DAMAGERANDOMIZER } else { subvarvar KNEEDAMAGE DAMAGERANDOMIZER } 
setactor[THISACTOR].htextra KNEEDAMAGE }
ends
DO NOT, by any means, put this code inside the "if hitweapon\ifwasweapon" statements. DeeperThought has learned that the hard way. It won't work at all. The "ht*" members are reset there. It is very complicated to understand. Just take my word for it.

Oh, and I enjoy helping people out. I'm not annoyed.
Hendricks266 is offline  
Old 09-10-2006, 11:09 AM   #20
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Okay, I put the code in (including under actors like STAYPUTS and all), and they're finally registering the altered damage, but now I seem to have a new problem:

Once I actually hit them with the kick, they continously take damage from it until they die(unless they take damage from something else beforehand), and I want the kick to hit each enemy only once. Is there anything I can add to that state of yours to make it hit just one time on each monster?

An interesting note is that this damage continously occurs to the monster even if I'm no where near them. I do know the damage variable on KNEEDAMAGE is working, because I got special boss monsters with heightened hitpoints to test it on, but even they die in seconds on a minimum strength kick because of this[if powered up, they die much faster]. :P
Lord Misfit is offline  
Old 09-10-2006, 11:34 AM   #21
DeeperThought

DeeperThought's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form
htpicnum remains set on the last weapon that the monster was hit by. It does not get cleared by the ifhitweapon function. The state keeps checking htpicnum, and seeing that it is the kick weapon, goes ahead and sets the damage again every tick. You'll notice that if you hit one of your bosses with a different weapon, the damage will immediately stop.

That's why in my code, I check to see that htextra is greater than zero before I modify the damage.
__________________
DUKE PLUS
New map effects and various optional extras for Duke 3D.

DUKE NUKEM: ATTRITION
XP based weapon upgrades, progressive difficulty, and more.
DeeperThought is offline  
Old 09-10-2006, 12:18 PM   #22
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Yeah, I checked through your code for DNWMD and saw what you were talking about. I added it to that state, and appearantly that did the trick.

I did find one oddity though at first[var related and something I had to mess around with]: the damage of the kick was double of the usual range. I set the mulvar KNEEDAMAGE to 1 instead of 2, and it did the normal damage again. I'm guessing "getactor[THISACTOR].htextra KNEEDAMAGE" is responsible for the extra damage. >.>


Okay, this does bring me to the next question: appearantly the QuickKick isn't affected by this, so the obvious question is: is there a way to make the new damage affect quick kicks? Is there a picnum specfic to the QuickKick[that makes it different from the normal kick?], or am I stuck with a normal-strength quick-kick?
Lord Misfit is offline  
Old 09-10-2006, 12:35 PM   #23
DeeperThought

DeeperThought's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form
PROJ_RANGE is the number of ticks that a projectile lasts, not the distance it travels.
__________________
DUKE PLUS
New map effects and various optional extras for Duke 3D.

DUKE NUKEM: ATTRITION
XP based weapon upgrades, progressive difficulty, and more.
DeeperThought is offline  
Old 09-10-2006, 06:09 PM   #24
Hendricks266
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
I just figured it out! Why don't your remove your STATUSKNEE projectile, as it is useless now. Here is the new state, with the things in red what is changed:

Code:
gamevar picnum 0 2

state add_knee_damage
getactor[THISACTOR].htextra KNEEDAMAGE
ifvarn KNEEDAMAGE 0 {
addvarvar KNEEDAMAGE DUKEPHYSICALATTACK
mulvar KNEEDAMAGE 2
randvarvar DAMAGERANDOMIZER DUKEPHYSICALATTACK
divvar DAMAGERANDOMIZER 2
ifrnd 128 { addvarvar KNEEDAMAGE DAMAGERANDOMIZER } else { subvarvar KNEEDAMAGE DAMAGERANDOMIZER } 
setactor[THISACTOR].htextra KNEEDAMAGE
break }
ends

state status_knee_damage_control
getactor[THISACTOR].htpicnum picnum
ifvare picnum KNEE { state add_knee_damage }
break
ends
If that still doesn't work, I have one more thing up my ass sleeve.
Hendricks266 is offline  
Old 09-10-2006, 06:26 PM   #25
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
It seems to work for both fine enough. I had to redo my other tweaks to the new code[adding Deeper's htexta code, making it that Steroids change the multiplier for some of the damage, etc], but I seem to have gotten it down.

Code:
state add_knee_damage 
getactor[THISACTOR].htextra tempb
ifvarg tempb 0
{
 getactor[THISACTOR].htextra KNEEDAMAGE 
 ifvarn KNEEDAMAGE 0 { 
  setvarvar KNEEDAMAGE DUKEPHYSICALATTACK 
  ifp ponsteroids { mulvar KNEEDAMAGE 5 } else { mulvar KNEEDAMAGE 2 } // Steroids make damage 2.5x stronger
  randvarvar DAMAGERANDOMIZER DUKEPHYSICALATTACK 
  divvar DAMAGERANDOMIZER 2 
  ifp ponsteroids { mulvar DAMAGERANDOMIZER 5 } else { mulvar DAMAGERANDOMIZER 1 } // Steroids make damage 5x stronger
  ifrnd 128 { addvarvar KNEEDAMAGE DAMAGERANDOMIZER } else { subvarvar KNEEDAMAGE DAMAGERANDOMIZER } // Gives a Damage Error of 50% of the Physical Attack stat [+- 50% attack]
  setactor[THISACTOR].htextra KNEEDAMAGE 
  break } 
}
ends 

state status_knee_damage_control 
 getactor[THISACTOR].htpicnum picnum 
 ifvare picnum KNEE { state add_knee_damage } 
 break 
ends
Just for the sake of showing you what it looks like now. >.>
Lord Misfit is offline  
Old 09-10-2006, 06:41 PM   #26
Hendricks266
Re: Questions about using vars with quotes, or displaying vars on screen in text form
Glad you got it working (finally).
Hendricks266 is offline  
Old 09-10-2006, 06:45 PM   #27
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Well, there is a new question I got. For kicks, I decided to link the SHOTSPARK1 actor to the code to see how it'd work. It does the same thing for damage, but I find that any actor shooting it also does the same damage to me[battling BOSS1s makes this big trouble if the PHYSICAL stat for the player is high]. How do you set it specfically only to work when a certain actor(APLAYER, BOSS1, PIGCOP, etc) shoots the attack? >.>
Lord Misfit is offline  
Old 09-10-2006, 07:12 PM   #28
Hendricks266
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Here:

Code:
gamevar TEMP 0 2
gamevar TEMP2 0 2

state add_knee_damage 
getactor[THISACTOR].htextra tempb
ifvarg tempb 0
{
 getactor[THISACTOR].htextra KNEEDAMAGE 
 ifvarn KNEEDAMAGE 0 { 
  getactor[THISACTOR].htowner TEMP
  getactor[TEMP].picnum TEMP2
  ifvare TEMP2 APLAYER {
  setvarvar KNEEDAMAGE DUKEPHYSICALATTACK 
  ifp ponsteroids { mulvar KNEEDAMAGE 5 } else { mulvar KNEEDAMAGE 2 } // Steroids make damage 2.5x stronger
  randvarvar DAMAGERANDOMIZER DUKEPHYSICALATTACK 
  divvar DAMAGERANDOMIZER 2 
  ifp ponsteroids { mulvar DAMAGERANDOMIZER 5 } else { mulvar DAMAGERANDOMIZER 1 } // Steroids make damage 5x stronger
  ifrnd 128 { addvarvar KNEEDAMAGE DAMAGERANDOMIZER } else { subvarvar KNEEDAMAGE DAMAGERANDOMIZER } // Gives a Damage Error of 50% of the Physical Attack stat [+- 50% attack]
  setactor[THISACTOR].htextra KNEEDAMAGE 
  break } }
}
ends
Things in red are changed.
The thing in blue is what you need to change. If you want more than one, make a new state out of the contents between the green brackets and repeat the "ifvare TEMP2 <actor> { <name of your state> }" statements.
Last edited by Hendricks266; 09-10-2006 at 07:18 PM.
Hendricks266 is offline  
Old 09-10-2006, 07:23 PM   #29
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Thanks. That worked pretty good.

My next project for the moment will probably a potential DEFENSE system. As your level goes up, resistance to attacks will rise slowly. Basically, the defense amount would be subtracted from the damage of an enemy attack until it does only 0-1 damage[1 damage because I don't want him becoming completely immune to attacks.

If anyone has a good means to start me off though, it'd be nice. It's not something I'm gonna start on immediately though, unless I have incentitve to. :P
Lord Misfit is offline  
Old 09-10-2006, 07:41 PM   #30
Hendricks266
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
*yawn*

[Grammar Correction]
Quote:
Originally Posted by Lord Misfit
Thanks. That worked pretty good well.
[/Grammar Correction]

Add a reference to a state called "state player_defense" in the APLAYER actor, at the very top of its code.

Code:
state player_defense
getactor[THISACTOR].htextra tempb
ifvarg tempb 0 {
subvarvar tempb DUKEDEFENSELEVEL
ifvarl tempb 1 { setvar tempb 1 } // I edited my post with DT's fix.
setactor[THISACTOR].htextra tempb }
ends
Like just about everything I post, it is untested.
Last edited by Hendricks266; 09-11-2006 at 03:34 PM.
Hendricks266 is offline  
Old 09-10-2006, 07:56 PM   #31
DeeperThought

DeeperThought's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form
ifvarl tempb 1 setvar tempb 1
__________________
DUKE PLUS
New map effects and various optional extras for Duke 3D.

DUKE NUKEM: ATTRITION
XP based weapon upgrades, progressive difficulty, and more.
DeeperThought is offline  
Old 09-10-2006, 08:53 PM   #32
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
(bleh nevermind, I noticed my mistake, if something comes up, I'll repost >.<
Lord Misfit is offline  
Old 09-10-2006, 10:52 PM   #33
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Alright, I guess I'm onto the most[in my opinion] harrowing question yet:

I know Deeperthought's DNWMD mod has it where you can upgrade the player's maximum health/armor/atomichealth and ammo by buying upgrades.

However in the more traditional RPG sense of it, I hope to somehow get it set that Duke's Max Health and Stuff goes up with each level or so. Thing is, I don't know how exactly to start myself off on that. I do got case events for determining the level [if you have more/less than a certain amount of experience, the level and the KickAttack and Defense stats change to a certain amount, and I could probably put in a max health/ammo amount under each level, but I don't know I would actually get the variables to alter his maximum values.

Does anyone have some code to start off with? >.>;
Lord Misfit is offline  
Old 09-11-2006, 12:42 AM   #34
DeeperThought

DeeperThought's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form
If you have a specific question about how to do something that isn't covered in the Wiki, then I'm usually happy to help. If you want a few lines of code written for you, then I'm not as enthusiastic, but sometimes I'll oblige. TX and others have helped me along the way, and I now consider it my duty to return the favor to others when I'm able.

However, it sounds to me like what you are saying is essentially this: I want a feature in my mod that is very similar to a feature in DT's mod, but I don't know how to make the minor adjustments and port it over because I don't understand the code, and I want someone to tell me how to write it.
__________________
DUKE PLUS
New map effects and various optional extras for Duke 3D.

DUKE NUKEM: ATTRITION
XP based weapon upgrades, progressive difficulty, and more.
DeeperThought is offline  
Old 09-11-2006, 12:55 AM   #35
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Well don't worry about it then. The reason I asked you was because until I played DNWMD I didn't even think altering the maximums of things was possible. However even with looking over your code a few times, much of it has confused me when trying to use it as a base or remaking it.

The thing is I do best with learning stuff when I'm modifying existing code, I'm usually more successful with understanding from modifying the examples of others than trying brand new things completely from scratch myself and having it that I'm wanting to bang my head on something trying to figure out what I did wrong of if I'm even on the right track. I do not mean to intentionally take from your stuff. It's just you're the one person I know can actually do that stuff with the maximums(unless someone else can and hasn't revealed they can).

And yes I do look through the wiki, but there are somethings that I still do not fully understand on there when I look at them(not to mention it's not all documented and some things I probably need are not yet listed). Sorry if that's the way it is, but that's how it is for me right now. :\
Lord Misfit is offline  
Old 09-11-2006, 01:09 AM   #36
DeeperThought

DeeperThought's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form
Quote:
Originally Posted by Lord Misfit View Post
I'm usually more successful with understanding from modifying the examples of others than trying brand new things completely from scratch myself
I think that's true of everyone, up to a point. When I started my mod back in April, I had no idea what I was doing. Basically, I just started changing some lines in game.con to see what would happen. If you look at this thread, you will see what a noob I was. But you'll also notice that I started with things that were very simple and worked my way up. I had a pretty good grasp of the basics before I attempted the upgrade menu stuff. It seems to me that you need to slow down and spend some more time learning the basics. And maybe think about what those upgrades are for. Do you have increasingly tougher enemies that make them necessary, or will they just unbalance the game?
__________________
DUKE PLUS
New map effects and various optional extras for Duke 3D.

DUKE NUKEM: ATTRITION
XP based weapon upgrades, progressive difficulty, and more.
DeeperThought is offline  
Old 09-11-2006, 03:57 AM   #37
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
On the current subject, I do believe I have gotten the hang of Maxhealth.

In fact, on top of it, I did something extra, made a state that works like Quake's Health system. In other words, if your Health goes above your normal max, it'll slowly count down to its' normal maximum if this code is used. :P

Code:
gamevar PLAYERID 0 1
gamevar PLAYERHEALTH 0 1
gamevar CURRENTHITPOINTS 0 1
gamevar MAXHITPOINTS MAXPLAYERHEALTH 1
gamevar QUAKEHP 0 1

state quakestyleoverloadhp
getplayer[THISACTOR].i PLAYERID
getactor[PLAYERID].extra CURRENTHITPOINTS
 ifvarvarg CURRENTHITPOINTS MAXHITPOINTS
  {
   ifcount 30 // 30 is 1 second
   {
    setvarvar QUAKEHP CURRENTHITPOINTS
    subvar QUAKEHP 1
    setactor[PLAYERID].extra QUAKEHP
    resetcount
   }
  }
ends

onevent EVENT_DISPLAYREST

state quakestyleoverloadhp

endevent
Hopefully this'll be enough for the people who want to try it out. Lemme know how it works for you if you test it, or if it's already been done and I've been wasting my time :P
Lord Misfit is offline  
Old 09-11-2006, 12:55 PM   #38
TerminX

TerminX's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form
That kind of thing belongs in the APLAYER actor, not in a display event. The event has DISPLAY in the name because it's used for displaying graphics on the screen. Obviously, graphics on the screen must be re-drawn once per frame, so the event itself also runs once per frame. I'm not sure why you placed the code in question in a state, but if you had placed it directly into the event you would have noticed various warnings telling you not to use things like setactor inside of such an event. You should really read a Duke 1.3D/1.5 CON faq before messing with the EDuke stuff.

Anyways, your code can be simplified to the following in the APLAYER actor:

Code:
getactor[THISACTOR].extra TEMP
ifvarvarg TEMP MAXHP
    ifcount 52 // one second is 26 counts, not 30 or 32
    {
        addphealth -1
        resetcount
    }
Last edited by TerminX; 09-11-2006 at 12:59 PM.
TerminX is offline  
Old 09-11-2006, 01:21 PM   #39
Lord Misfit

Lord Misfit's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
Whoops, guess I do have more to learn on that. Yeah, your method works just as well, if not more conveinently. Thanks. Sorry about having been such a bother. For now, I got nothing more to mention. I'm moving on to levels affecting Maxarmor[but that's the same as maxhealth, so I don't think I'll need any help now that I got maxhealth down], and maybe some other stats. I'll figure it out, or I'll come back again.

Later for now, all.
Lord Misfit is offline  
Old 09-11-2006, 01:46 PM   #40
TerminX

TerminX's Avatar
Re: Questions about using vars with quotes, or displaying vars on screen in text form...
A bother? I don't think I've noticed that at all. Newbies are always welcome in the community. You seem to be willing to learn, so don't feel as if you've bothered anyone.
TerminX is offline  
 

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 12:32 PM.

Page generated in 0.34052300 seconds (100.00% PHP - 0% MySQL) with 16 queries

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

Website is ©1987-2014 Apogee Software, Ltd.
Ideas and messages posted here become property of Apogee Software Ltd.