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

Jump to content

  • 124 Pages +
  • « First
  • 11
  • 12
  • 13
  • 14
  • 15
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   OpenMaw 

  • Judge Mental

#361

I have a somewhat tricky project im working on. I know im probably in over my head, but I thought i'd ask here if anyone would be interested in taking me under their wing on this one.

Basically, what im trying to do is create a motion tracker ala Aliens that will appear in the lower right hand corner. The current weapon will be "holstered" and the motion tracker graphics displayed down there as part of the hud, then over the top of the graphics would be a small "zone" or "playpen" where any monsters within a certain units distance/radius would be displayed as white dots. This would update every couple seconds... So on, and so forth. Im not very experienced so obviously this is pretty tough. Im not even sure it can be done with Eduke, though I have seen something like this done with Wolfenstein 3D, and the 2D map was originally going to display monster sprites. so it should be possible... Anyway, help on this would be greatly appreciated. :o
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#362

View PostDeeperThought, on Oct 8 2009, 12:03 AM, said:

Yes.
How can I know how many player, bots or not, are there?
0

User is online   Danukem 

  • Duke Plus Developer

#363

View PostIlovefoxes, on Oct 7 2009, 09:16 PM, said:

How can I know how many player, bots or not, are there?


gamevar player 0 0
gamevar counter 0 0

state countplayers

headspritestat player 10

whilevarn player -1
{
	addvar counter 1
	nextspritestat player player
}

ends


I guess that would work, but if you try it once the game is underway, it would count holoduke holograms as players.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#364

Wow, I never knew of that command.
0

User is online   Danukem 

  • Duke Plus Developer

#365

If an enemy with cstat 0 is exposed to an explosion, the hit registers and the enemy can respond accordingly by blowing up. But actors who are not enemies do not register the hit. Was it always this way? I want a notenemy to be hittable by explosives and no other weapons (and there's a good reason for it). I can't give it cstat 256 or it will block projectiles, which would be really bad in this case.
0

User is offline   OpenMaw 

  • Judge Mental

#366

View PostDeeperThought, on Oct 8 2009, 01:15 AM, said:

If an enemy with cstat 0 is exposed to an explosion, the hit registers and the enemy can respond accordingly by blowing up. But actors who are not enemies do not register the hit. Was it always this way? I want a notenemy to be hittable by explosives and no other weapons (and there's a good reason for it). I can't give it cstat 256 or it will block projectiles, which would be really bad in this case.


Wouldnt giving it con exceptions work? IE... ifwasweapon...?
0

User is offline   OpenMaw 

  • Judge Mental

#367

EDIT: I think I figured it out. Updated code has been placed in the code bracket. It seems to work, muahaha.

Been digging through the Eduke wiki on this other thing im doing, and because im stupid I dont know what im looking for... I have the following code:

gamevar armorhud 0 2
gamevar armorhud2 0 2
gamevar xvar2 0 2

define ARMSCALE 1

onevent EVENT_DISPLAYREST {
	setvar xvar2 0 // set starting x coordinate
	getplayer[THISACTOR].shield_amount armorhud // get the player's health.
	ifvarg armorhud 0 { // only proceed if the player has any health.
		setvarvar armorhud2 armorhud // save a copy for later.
		divvar armorhud ARMSCALE // make each column worth 10 hp.
		modvar armorhud2 ARMSCALE // gets the remainder of the division so that...
		ifvarg armorhud2 0 {
			addvar armorhud 1 // ...we can round up. each column will only disappear when all 10 hp are gone.
		}
		whilevarn armorhud 0 { // repeat for each column
			rotatesprite xvar2 0 65536 0 199 0 1 16 0 0 xdim ydim // draws one column at (xvar,182)
			addvar xvar2 1 // move to the right
			subvar armorhud 1 // next column
		}
	}
} endevent


Basically I figured i could duplicate the health bar code and point it towards the armor like it was nothing. I suppose if I knew what the heck I was doing that would help. I've tried a couple different strategies and I just dont get it... I dont even get how the health bar code actually finds the players health as it original is which basically leaves me unable to figure out the armor code either.

NOTE: I changed the gamevars for this one on the off chance it was causing some kind of a contradiction. I know that changing it to 'armorhud' does not make it put to armor.

This post has been edited by Commando Nukem: 08 October 2009 - 05:08 AM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#368

View PostDeeperThought, on Oct 8 2009, 05:15 AM, said:

If an enemy with cstat 0 is exposed to an explosion, the hit registers and the enemy can respond accordingly by blowing up. But actors who are not enemies do not register the hit. Was it always this way? I want a notenemy to be hittable by explosives and no other weapons (and there's a good reason for it). I can't give it cstat 256 or it will block projectiles, which would be really bad in this case.
Had you tried changing the clipdist?
0

User is offline   m210® 

#369

help me to change PHEIGHT value in eduke. It is possible?
0

User is online   Danukem 

  • Duke Plus Developer

#370

View PostM210, on Oct 8 2009, 01:55 PM, said:

help me to change PHEIGHT value in eduke. It is possible?


It's possible, but it's about ten times more difficult than it sounds. First of all, using sizeat to change the height of the player sprite will not do what you want, so don't even try. It will warp your field of view (unless you are using Polymer), and it won't actually make the player's perspective any higher. You can, of course, use a higher resolution player sprite to make him appear taller in F7 view, but that won't make things look any different in first person view.

The most important thing is to move the game camera up, while being careful not to place it inside of a ceiling. I posted some code for this over at the 3DR forum for the other Blood TC. I think that was over a year ago, and I don't have a copy of it. It was not very complicated.

But the player's bullets and other projectiles will continue to have their old origin even if the camera is moved up. This means it will seem like you are shooting from your hip, or knee, and your shots will hit below the crosshair. To fix that, you have to move the shots (which is tricky in the case of bullets). I posted some code for this over at 3DR for the other Blood TC, around the same time as the other code.

It wouldn't surprise me if there were other things you have to change to make it work.
0

User is offline   OpenMaw 

  • Judge Mental

#371

Ugh...

Been trying to figure out how to display current ammo amount on screen with digitalnumber/digitalnumberz. I dont get it.

gamevar ammo 0 2
gamevar x 0 2
gamevar y 0 2
gamevar shade 0 2
gamevar pal 0 2
gamevar tilenum 0 2
gamevar orientation 0 2

onevent EVENT_DISPLAYREST {
ifvarg ammo 0 {
setvarvar tilenum ammo
}
setvar x 10
setvar y 20
setvar shade 0
setvar pal 0
setvar tilenum 2472
setvar orientation 0
getactor[THISACTOR].extra tilenum
digitalnumberz tilenum x y ammo shade pal orientation 0 0 x y 65536
} endevent


Likely, this isnt doing anything. Just when I thought I was begining to understand... Nope. :o
I'm pretty sure my problem lies with "getactor[THISACTOR].extra" I couldnt figure out how to reference the current weapons ammunition, looking through the commands... Meh.

This post has been edited by Commando Nukem: 09 October 2009 - 11:14 AM

0

User is online   Danukem 

  • Duke Plus Developer

#372

The <tilenum> parameter of the digitalnumber command should be set to the tile number of the '0' in the sequence of number tiles. It should not be set to the player's health amount, which is what you are doing now.

Secondly, the ammo variable should be set to the ammo amount you want to display.
0

User is offline   OpenMaw 

  • Judge Mental

#373

Urgh...

View PostDeeperThought, on Oct 9 2009, 12:21 PM, said:

The <tilenum> parameter of the digitalnumber command should be set to the tile number of the '0' in the sequence of number tiles. It should not be set to the player's health amount, which is what you are doing now.


Isnt it? setvar tilenum 2472 ...

I thought I had this too...

and then I tried changing this:

getactor[THISACTOR].extra tilenum

to this:

getactor[currentweapon].extra ammo

and again, nothing happened. It wouldnt be so bad if I was getting an error or something, but no... nothing, natta, zipola.

View PostDeeperThought, on Oct 9 2009, 12:21 PM, said:

Secondly, the ammo variable should be set to the ammo amount you want to display.


ifvarg ammo 0 ? I want it to display whatever the current ammount of ammo is for the current weapon. Obviously im missing something big along the way here... Merrgh. The code is "working" its just not showing up. references must be wrong.
0

User is online   Danukem 

  • Duke Plus Developer

#374

Don't take this the wrong way, but it seems like you are just trying things at random without gaining any knowledge. I think what's missing is that you lack a basic understanding of how code is executed.

For example, it's true that one of your lines was "setvar tilenum 2472". Sure enough, that sets tilenum to 2472 But then, after that, in the same block of code, you added "getactor[THISACTOR].extra tilenum" which sets tilenum to the value of the current actor's extra member (which would be the current player's health amount). I guess you thought that tilenum would remain at 2472, despite that, but it's hard for me to fathom what your though process was.
0

#375

Get rid of this, it makes no sense:

View PostCommando Nukem, on Oct 9 2009, 03:07 PM, said:

ifvarg ammo 0 {
setvarvar tilenum ammo
}

In English, it says "if 'ammo' is greater than zero (ifvarg ammo 0), then 'tilenum' becomes equal to 'ammo' (setvarvar tilenum ammo)," which has no bearing on what you're trying to do and doesn't have any effect on the rest of the script.

The important thing is to change this:

View PostCommando Nukem, on Oct 9 2009, 03:07 PM, said:

getactor[THISACTOR].extra tilenum

to:
getplayer[THISACTOR].ammo_amount[currentweapon] ammo

which sets 'ammo' to the ammo left (getplayer[].ammo_amount[]) in the current gun (currentweapon) for the current player (THISACTOR).
http://wiki.eduke32....iki/Ammo_amount

I share Deeperthought's sentiments, and suggest that you do some general study on computer programming, or at least look up each of the commands in the wiki.

This post has been edited by Dr. Kylstein: 09 October 2009 - 12:26 PM

0

User is offline   OpenMaw 

  • Judge Mental

#376

Thanks guys. I got it working now. :o
0

User is offline   Jblade 

#377

Is there any way I can use readgamevar to create unlockable stuff in multi? I've noticed that readgamevar only reads the local player's variables in multiplayer - which is fine for things that don't affect gameplay like certain computer screens and achivements I've coded...but I want to make unlockable weapons and since this modifies gameplay it desyncs the game.

I mean I've coded in a computer system that reads saved gamevars and displays them onscreen as a status thing. When I press K to see my ally's stuff it just reads the gamevars in my config file rather than his; but of course from his point of view it's displaying his stuff and pressing K when I'm using the PC displays his again as well. When I try and read if the weapon is unlocked, since it's unlocked for me it works ok but since it's still locked on his system it comes out negative and so desyncs since the game doesn't understand that our configs would have different saved vars or something.

This post has been edited by James: 10 October 2009 - 03:38 AM

0

User is online   Danukem 

  • Duke Plus Developer

#378

View PostJames, on Oct 10 2009, 04:37 AM, said:

Is there any way I can use readgamevar to create unlockable stuff in multi? I've noticed that readgamevar only reads the local player's variables in multiplayer - which is fine for things that don't affect gameplay like certain computer screens and achivements I've coded...but I want to make unlockable weapons and since this modifies gameplay it desyncs the game.

I mean I've coded in a computer system that reads saved gamevars and displays them onscreen as a status thing. When I press K to see my ally's stuff it just reads the gamevars in my config file rather than his; but of course from his point of view it's displaying his stuff and pressing K when I'm using the PC displays his again as well. When I try and read if the weapon is unlocked, since it's unlocked for me it works ok but since it's still locked on his system it comes out negative and so desyncs since the game doesn't understand that our configs would have different saved vars or something.


What if you did something like this:

gamevar initplayer NO 1
gamearray weapmods 8 // each element is a bitfield storing all weapon mods for a player
gamevar myweapmods 0 1 // this is what is saved to the ini file
gamevar temp 0 0


state initp

  setvar initplayer YES
  readgamevar myweapmods
  getactor[THISACTOR].yvel temp
  setarray weapmods[temp] myweapmods

ends

actor APLAYER MAXPLAYERHEALTH PSTAND 0 0

ifvare initp NO state initp


So what you do is read the array element corresponding to the player number, rather than reading the gamevar from the file. Then you can display each player's stuff separately. When you get a new weapon mod, you add that to myweapmods, save that gamevar, and then update the array accordingly.

EDIT: It would make things messy if players changed their IDs in mid-game, but the basic concept seems sound.

This post has been edited by DeeperThought: 10 October 2009 - 09:03 AM

0

User is offline   Jblade 

#379

Cool! I'll give that a shot as soon as I can - thanks :o
0

User is online   Danukem 

  • Duke Plus Developer

#380

I have a request. I would like CON access to which sprites are actually being rendered (i.e. which ones have tsprite), and also to which sectors/walls are being rendered. AFAIK, there is currently no way to access this information in CON. Since the information is already in the system, checking it would allow for some optimizations. For example, it could be a substitute or a precondition for expensive visibility checks. Also, if you want to know whether a certain wall is being rendered (say, because you want to use the DISPLAYROOMS invalid texture trick to project another part of the map onto it and you want to avoid the extra rendering if the wall is not being rendered), then direct access to the information is vastly superior to the alternatives (such as checking visibility to a nearby sprite).
0

User is offline   Plagman 

  • Former VP of Media Operations

#381

How exactly would that system that tells you which sprites are being rendered would differ from just looking at the tsprite array today?

For walls and sectors, there are several things to consider:
  • The game code doesn't know which walls and sectors are getting rendered. Before implementing a way for the game code to tell CON, we would need to implement a way for the engine code to tell the game code. This would make the engine <-> game limit even more broken than it already is.
  • Rendered doesn't necessarily mean visible, and possibly vice versa.
  • These results would vary depending of the renderer that's being used, and would even vary with different performance settings in the same renderer. That means CON scripts could potentially make wrong assumptions and only work on the renderer they were developed against.
I know why you need it and I agree that it would help in some cases, but it probably needs a little more thought than just giving that kind of information.
0

User is online   Danukem 

  • Duke Plus Developer

#382

View PostPlagman, on Oct 14 2009, 10:05 AM, said:

How exactly would that system that tells you which sprites are being rendered would differ from just looking at the tsprite array today?

For walls and sectors, there are several things to consider:
  • The game code doesn't know which walls and sectors are getting rendered. Before implementing a way for the game code to tell CON, we would need to implement a way for the engine code to tell the game code. This would make the engine <-> game limit even more broken than it already is.
  • Rendered doesn't necessarily mean visible, and possibly vice versa.
  • These results would vary depending of the renderer that's being used, and would even vary with different performance settings in the same renderer. That means CON scripts could potentially make wrong assumptions and only work on the renderer they were developed against.
I know why you need it and I agree that it would help in some cases, but it probably needs a little more thought than just giving that kind of information.


Thank you for the detailed reply.

About tsprite access:

I know that there's an event EVENT_ANIMATESPRITES which works sort of like EVENT_GAME, except for tsprites. But tsprites get processed in that event only if the corresponding game world sprite has had bit 4 (16) added to its mdflags member. I was confused and I also thought that sprites would be forced into the tsprite array by that flag whether they were rendered or not (which is why I thought it was impossible to determine whether they were actually being rendered). Fortunately the reality is more sensible than my assumption!
0

User is offline   Chip 

#383

Simple question: What sort of problems can occur by not using the scriptsize command?
Are they dire? are they things which can alter an actor's behaviour or sometihng else?
0

User is offline   Plagman 

  • Former VP of Media Operations

#384

Not really, the automatic script buffer increasing code should take care of that for you.
0

User is online   Danukem 

  • Duke Plus Developer

#385

Plagman just fixed a bug in the showview command which would cause it to mess up moving sectors (e.g. rising doors) when used in EVENT_DISPLAYROOMS. It wasn't working properly with the movement interpolation code when called from that event. The problem was framerate dependent, which means that any use of showview in EVENT_DISPLAYROOMS would break sync in multiplayer.

Here's a link to the fixed build.

Once again, Plagman, thanks!
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#386

I am having an error with new snapshot (EDuke32 2.0.0devel 20091017)

Quote

42154928
33317: 31337 {
33318: 1899 getactor 253 19 332 230 332 14
33325: 1901 divvarvar 332
33327: 4 guniqhudid 253 17
33330: 1902 cos 385
33332: 4 guniqhudid 253 15
33335: 1903 sin 386
33337: 4 guniqhudid 253 15
33340: 1904 hitscan
33341: 4 guniqhudid 253 0
33344: 4 guniqhudid 253 1
33347: 4 guniqhudid 253 2
33350: 4 guniqhudid 253 13 385 386 332current actor: 288 (2605)
g_errorLineNum: 0, g_tw: 386


This is the CON part that causes the error:

Quote

getactor[THISACTOR].zvel ATEMP
mulvar ATEMP 16384
divvarvar ATEMP sprite[THISACTOR].xvel
cos ANGX sprite[THISACTOR].ang
sin ANGY sprite[THISACTOR].ang
hitscan sprite[THISACTOR].x sprite[THISACTOR].y sprite[THISACTOR].z sprite[THISACTOR].sectnum ANGX ANGY ATEMP
RETURN RETURN ATARGET RETURN RETURN RETURN 4294901808

0

User is offline   Jblade 

#387

I've got a question about build script - what can it be used for? there's lots of instructions on the wiki but no tutorials or anything that tells me what it can do.
0

#388

Time for a new question [I think :o]:

I'm developing a shield buff [like a status buff] for NR, which is supposed to in theory "block" and sometimes "reflect/deflect" mystic-based attacks [one example can be the Octabrain's/Cycloid's mindblasts. I got it to "block" okay, but I was curious if anyone had ever tried the "deflect" part in their own code runs before.

Basically what I'm hoping to pull off is that when a projectile that can be blocked/deflected hits the shield, the original Projectile copies certain properties to a new projectile of identical strength and stuff but with the player's owner id, and bounce it away from them. For the best effect in my opinion, I need to know if it's possible to make a projectile disappear mid-impact[as in it won't show it's impact/explosion animation and just vanishes instantly]. I'm not sure if it can be done with custom or hard-coded projectiles or not.

I'm going to eventually work at this, but I got other tweaks for earlier stuff to worry about before I do, and I figured on dropping this set of questions on you guys in the meantime. ;)

This post has been edited by Lord Misfit: 22 October 2009 - 06:55 PM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#389

htg_t may help. I am not sure, but it may be acessible before the projectile impact.
0

User is online   Danukem 

  • Duke Plus Developer

#390

View PostLord Misfit, on Oct 22 2009, 07:54 PM, said:

Basically what I'm hoping to pull off is that when a projectile that can be blocked/deflected hits the shield, the original Projectile copies certain properties to a new projectile of identical strength and stuff but with the player's owner id, and bounce it away from them. For the best effect in my opinion, I need to know if it's possible to make a projectile disappear mid-impact[as in it won't show it's impact/explosion animation and just vanishes instantly]. I'm not sure if it can be done with custom or hard-coded projectiles or not.


I've made a few player force fields that deflect projectiles. Just change the angle of the projectile, it's zvel and owner. You don't need to fire a new one. You can spawn an animation sprite at the point where it deflects and play a sound. Maybe the real problem is you don't know how to make the projectile deflect without it dying. You can have the projectile detect distance to the force field and hitscan for it, then turn it around before it actually hits anything. Another method is to allow it to hit, but use EVENT_KILLIT to cancel its death and then turn it around from there.
0

Share this topic:


  • 124 Pages +
  • « First
  • 11
  • 12
  • 13
  • 14
  • 15
  • 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