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

Jump to content

  • 124 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is online   Danukem 

  • Duke Plus Developer

#22

View PostJames, on Jun 6 2009, 01:14 AM, said:

What's the best way to achieve the Blood Tommy Gun spray attack? I was thinking of spawning a bunch of actors in an arc infront of the player that fire a bullet at each angle, but I don't think that'd give the player the points for the kill in multiplayer. Any ideas?


That reminds me, I did this for one of the Blood mods a while ago. I was supposed to port the code for Dimebog, but I've been otherwise occupied. I am attaching the code that I used:

Attached File  EDUKE.zip (1.48K)
Number of downloads: 1577

Simplifying a bit, what I did was to add or subtract a number from the player's angle depending on the part of the firing sequence you are at. The angle is reset after firing so you can't tell that the player is turning. So: check altfire counter variable, and depending on what that is you change angle, fire bullet, reset angle (in the player's code). Then there is display code that syncs up with the firing.
0

User is offline   Jblade 

#23

groovy, that should help a great deal - thanks :)
0

User is offline   XThX2 

#24

onevent EVENT_GAME
.
.
.
ifactor MACE2
{
	getactorvar[THISACTOR].ACTORCOUNT countvar
	addvar countvar 1
	setactorvar[THISACTOR].ACTORCOUNT countvar
	
	ifvare countvar 5
	{
		ifaction MACEFRAMES action MACEFRAMES2 else
		ifaction MACEFRAMES2 action MACEFRAMES3 else
		ifaction MACEFRAMES3 action MACEFRAMES4 else
		ifaction MACEFRAMES4 action MACEFRAMES5 else
		ifaction MACEFRAMES5 action MACEFRAMES6 else
		ifaction MACEFRAMES6 action MACEFRAMES7 else
		ifaction MACEFRAMES7 action MACEFRAMES
		setvar countvar 0
		setactorvar[THISACTOR].ACTORCOUNT countvar
	}
}
.
.
.
endevent

define MACE2 7408
define MACESTAND 7414
action MACEFRAMES 0 1 1
action MACEFRAMES2 1 1 1
action MACEFRAMES3 2 1 1
action MACEFRAMES4 3 1 1
action MACEFRAMES5 4 1 1
action MACEFRAMES6 5 1 1
action MACEFRAMES7 6 1 1

defineprojectile MACE2 PROJ_WORKSLIKE 6278 //4096 + 2048 + 4 + 2
defineprojectile MACE2 PROJ_SPAWNS MACESTAND
defineprojectile MACE2 PROJ_VEL 125 
defineprojectile MACE2 PROJ_EXTRA 0
defineprojectile MACE2 PROJ_DROP -75
defineprojectile MACE2 PROJ_ISOUND -1 
defineprojectile MACE2 PROJ_HITRADIUS 1
defineprojectile MACE2 PROJ_BOUNCES 4
defineprojectile MACE2 PROJ_BSOUND -1
defineprojectile MACE2 PROJ_XREPEAT 50
defineprojectile MACE2 PROJ_YREPEAT 50
defineprojectile MACE2 PROJ_CSTAT 1
defineprojectile MACE2 PROJ_CLIPDIST 70

useractor notenemy MACE2 0 MACEFRAMES enda

useractor notenemy MACESTAND 0
sizeat 50 50
enda


That's the code I used for an object that is spawned upon the death of a monster... It basically spawns, falls on the ground, spins 4 times, and then disappears... it doesn't spawn the MACESTAND actor. What's wrong? And, this code USED to work on old versions.

This post has been edited by XThX2: 11 June 2009 - 04:06 AM

0

User is online   Danukem 

  • Duke Plus Developer

#25

View PostXThX2, on Jun 11 2009, 05:05 AM, said:

onevent EVENT_GAME
.
.
.
ifactor MACE2
{
	getactorvar[THISACTOR].ACTORCOUNT countvar
	addvar countvar 1
	setactorvar[THISACTOR].ACTORCOUNT countvar
	
	ifvare countvar 5
	{
		ifaction MACEFRAMES action MACEFRAMES2 else
		ifaction MACEFRAMES2 action MACEFRAMES3 else
		ifaction MACEFRAMES3 action MACEFRAMES4 else
		ifaction MACEFRAMES4 action MACEFRAMES5 else
		ifaction MACEFRAMES5 action MACEFRAMES6 else
		ifaction MACEFRAMES6 action MACEFRAMES7 else
		ifaction MACEFRAMES7 action MACEFRAMES
		setvar countvar 0
		setactorvar[THISACTOR].ACTORCOUNT countvar
	}
}
.
.
.
endevent

define MACE2 7408
define MACESTAND 7414
action MACEFRAMES 0 1 1
action MACEFRAMES2 1 1 1
action MACEFRAMES3 2 1 1
action MACEFRAMES4 3 1 1
action MACEFRAMES5 4 1 1
action MACEFRAMES6 5 1 1
action MACEFRAMES7 6 1 1

defineprojectile MACE2 PROJ_WORKSLIKE 6278 //4096 + 2048 + 4 + 2
defineprojectile MACE2 PROJ_SPAWNS MACESTAND
defineprojectile MACE2 PROJ_VEL 125 
defineprojectile MACE2 PROJ_EXTRA 0
defineprojectile MACE2 PROJ_DROP -75
defineprojectile MACE2 PROJ_ISOUND -1 
defineprojectile MACE2 PROJ_HITRADIUS 1
defineprojectile MACE2 PROJ_BOUNCES 4
defineprojectile MACE2 PROJ_BSOUND -1
defineprojectile MACE2 PROJ_XREPEAT 50
defineprojectile MACE2 PROJ_YREPEAT 50
defineprojectile MACE2 PROJ_CSTAT 1
defineprojectile MACE2 PROJ_CLIPDIST 70

useractor notenemy MACE2 0 MACEFRAMES enda

useractor notenemy MACESTAND 0
sizeat 50 50
enda


That's the code I used for an object that is spawned upon the death of a monster... It basically spawns, falls on the ground, spins 4 times, and then disappears... it doesn't spawn the MACESTAND actor. What's wrong? And, this code USED to work on old versions.



There is a bug in the current version of EDuke32 which causes actors spawned by bouncing projectiles to end up in random places (often so far away from the projectiles it appears they aren't spawning at all). The bug has been fixed, but the fixed version won't be released until polymer is. If you want the fix you need to use a recent polymer build.

As a workaround, you can change spawns to -1 and have the projectile spawn the actor in EVENT_KILLIT.
0

User is offline   Jimmy 

  • Let's go Brandon!

#26

Well, that explains a lot, actually.
0

User is offline   XThX2 

#27

View PostDeeperThought, on Jun 11 2009, 06:36 AM, said:

There is a bug in the current version of EDuke32 which causes actors spawned by bouncing projectiles to end up in random places (often so far away from the projectiles it appears they aren't spawning at all). The bug has been fixed, but the fixed version won't be released until polymer is. If you want the fix you need to use a recent polymer build.

As a workaround, you can change spawns to -1 and have the projectile spawn the actor in EVENT_KILLIT.


Hmm I guess I can wait the polymer's release... (I hope it is released shortly)
0

User is offline   XThX2 

#28

Has anyone experienced the player hitting the ceiling before? When the map starts I mean... Well I don't remember changing anything about player and his height but somehow he jumps infinitely till he hits the ceiling... and stops there hanging on the air. Anyone know a reason for this?
0

User is offline   Mblackwell 

  • Evil Overlord

#29

Hilariously I had this bug once a long time ago.

Unfortunately I can't remember what causes it. What was the last thing you implemented before you saw the bug?
0

User is online   Danukem 

  • Duke Plus Developer

#30

Setting jumping_counter to one of the values that causes upward acceleration would do that.
0

User is offline   XThX2 

#31

It was something about my new weapon replacing the tripbombs... Strange, such two different things doing that.

I'll check my jumping code, I remember coding something to limit the jump of the player...
0

User is offline   XThX2 

#32

I'm still having the issue I mentioned earlier, and I checked every bit of my code to see if it had anything related to jumping_counter, and only found this; which can't be the issue. Eitherway, I commented it out and the bug was still there. Any other ideas to solve this out?

/*
getplayer[THISACTOR].jumping_counter TEMP
ifvare TEMP 650
{
setplayer[THISACTOR].jumping_counter ZERO
}
*/


This post has been edited by XThX2: 25 June 2009 - 08:10 AM

0

User is online   Danukem 

  • Duke Plus Developer

#33

Look for anywhere in the code you are setting posz or poszv, or where the player is spawning stuff.
0

User is offline   XThX2 

#34

I've checked, commented out anywhere I found posz or poszv (commented the whole code block I mean) and still it is there. Pretty annoying, got no clue why that happens yet.
0

User is offline   Jimmy 

  • Let's go Brandon!

#35

Quakis was telling me he had a similar bug in Eduke32 a while ago when he tried playing with no .art files present at all. He was too lazy to post about it. Probably unrelated but still interesting.
0

User is offline   XThX2 

#36

Sorry, it's much worse than that apparently... If nothing else works, I'll try to use the old backup I had and insert the new code to it. (Which is going to be painful...)

Quote

Oh no, the server is melting! IT BURNS, IT BURNS, OH GOD IT BURNS!


I saw this below the reply box, right under the text "Attachments". Is this a joke ? D:
0

User is online   Danukem 

  • Duke Plus Developer

#37

View PostXThX2, on Jun 26 2009, 01:47 AM, said:

Sorry, it's much worse than that apparently... If nothing else works, I'll try to use the old backup I had and insert the new code to it. (Which is going to be painful...)


The player flying up to the sky is a fairly simple, isolated problem and it shouldn't be very difficult to debug, especially if it's happening every time.

Here's a few basic debugging procedures that you should have done already:

*verify whether it happens in a single room map with no sprites (this will tell you, for example, whether it is some other sprite setting the player sprites z coordinate)

*display the values of posz and poszv on the screen or print them to the log

*comment out or otherwise disable EVENT_GAME, and then other events until you find the one responsible (if none, then you know the problem is in actor code)
0

User is offline   Chip 

#38

I'm trying to make an actor reduce the player's health with a melee attack - and no, I can't just use "addphealth -%".
The attack damage is worked out by a formular which makes the attack damage higher depending on the actor's level. The actor also has access to multiple attacks but that's not really relevent.

After my formular is done, an actor at level 1 witch has an attack stat of 12 should do 4 damage to the player. That number is currently being held in a gamevar, how can I get that gamevar taken away from the player's HP? This value is also a positive value so I need to use subvar to take it away but I don't know what I'm meant to take it away since I can't edit the .extra for players.



*edit*

I've thought of a way but I would still prefere a different method.
Mine would be seomthing like this:
ifvarg TEMP 0 { addphealth -1 subvar TEMP 1 }
and then think of a way to have that loop till my attack value is empty.

Like I said, I would still prefere a better method, a more instant and direct reduction.

This post has been edited by Chip: 28 June 2009 - 06:40 AM

0

User is offline   Jblade 

#39

Have you tried getting the player being attacked's ID in the monster code, than setting their .htextra to the damage number you want to do? (so instead of addphealth -10 you'd have setplayer[THISACTOR].htextra DAMAGEVAR or something similar )
0

User is offline   Chip 

#40

I could never get htextra to work right but I may just stick with what I posted above.
My main concern with that was it would take too long for large damage amounts to be applies - in one test the player was killed outright but it took like 5 seconds for the HP to run all the way down. I solved that by making it take off 100s till there were no 100s left then it'll move onto 50s, then 10s then finally 1s. It still takes like nearly a second to knock down the HP but I kindof like seeing it rub down through numbers instead of instantly applied.

This post has been edited by Chip: 28 June 2009 - 11:19 AM

0

User is offline   XThX2 

#41

extra_extra8

There's this thing which could be useful to you, though I couldn't figure out how to use it properly. Does anyone know how to use it?

Apart from that, how would you get player's ID from the monster? I know it has to do with the player structure member "i" but how, hitscans from monster ?
0

#42

If I recall correctly:
getplayer[THISACTOR].i temp
getactor[temp].extra temp2
subvarvar temp2 damage
setactor[temp].extra temp2

getplayer[THISACTOR] for actors besides APLAYER refers to the nearest player, just like addphealth does. "extra" means health/strength for most actors. James's method has advantages, but is more complicated--I can't remember all the necessary details.

P.S.: Do you know about whilevarn? If you ever do need a loop.

This post has been edited by Dr. Kylstein: 29 June 2009 - 07:17 PM

0

User is offline   MIKE SIMS 

#43

I want an "overlay" to appear on the screen when the night vision goggles are in use, I have a sprite to cover the whole screen to add "effect" to the nightvision goggles when they are powered on, any help?
0

User is online   Danukem 

  • Duke Plus Developer

#44

View PostMIKE SIMS, on Jun 30 2009, 10:06 AM, said:

I want an "overlay" to appear on the screen when the night vision goggles are in use, I have a sprite to cover the whole screen to add "effect" to the nightvision goggles when they are powered on, any help?


onevent EVENT_DISPLAYREST

ifvare player[THISACTOR].heat_on YES
  rotatesprite xcoord ycoord size rotation tilenumber shade color orientation 0 0 xdim ydim

endevent


Look up rotatesprite in the EDuke32 wiki to understand this better. Replace the names I put in there (such as "tilenumber") either with numbers or your own variables. Good luck.
0

User is offline   Chip 

#45

Quote

If I recall correctly:
getplayer[THISACTOR].i temp
getactor[temp].extra temp2
subvarvar temp2 damage
setactor[temp].extra temp2

getplayer[THISACTOR] for actors besides APLAYER refers to the nearest player, just like addphealth does. "extra" means health/strength for most actors. James's method has advantages, but is more complicated--I can't remember all the necessary details.


Ahh, obtaining and altering the player's HP through the actor sructure - that's cunning!
But if that works then why can't we just have the .extra command on the player structure as well and alter it directly through that?

This post has been edited by Chip: 30 June 2009 - 12:08 PM

0

User is offline   XThX2 

#46

View PostChip, on Jun 30 2009, 12:05 PM, said:

Ahh, obtaining and altering the player's HP through the actor sructure - that's cunning!
But if that works then why can't we just have the .extra command on the player structure as well and alter it directly through that?


Then coding wouldn't be fun ! ;)
0

User is offline   Jimmy 

  • Let's go Brandon!

#47

Is there anyway to stop a projectile with flags of 6274 (RPG, NOENEMYHITS, LOSESVELOCITY, and NOAIM) from bouncing off of actors? I'm trying to finish up my gibs by coding the blood. The gibs bounce off stuff, which is natural, but of course blood shouldn't. Alternative ideas are also welcome.
0

User is online   Danukem 

  • Duke Plus Developer

#48

View PostCaptain Awesome, on Jun 30 2009, 04:48 PM, said:

Is there anyway to stop a projectile with flags of 6274 (RPG, NOENEMYHITS, LOSESVELOCITY, and NOAIM) from bouncing off of actors? I'm trying to finish up my gibs by coding the blood. The gibs bounce off stuff, which is natural, but of course blood shouldn't. Alternative ideas are also welcome.


Take away the NOENEMYHITS flag. That makes it bounce off of all sprites.
0

User is offline   Jimmy 

  • Let's go Brandon!

#49

I thought maybe it wouldn't work quite right but that's actually pretty much perfect. D'oh.

Another tidbit I'm having trouble figuring out. The blood flies through the air, and when it hits something it spawns a bloodsplat. This looks good when it hits the ground, rather natural and the like. I can't figure out how to setup so that when it hits a wall, instead of spawning a bloodsplat it shoots BLOODSPLAT# along the walls. I can't really figure it out. There is no ifnearactor equivalent for walls, as far as I know. Any ideas?
0

User is online   Danukem 

  • Duke Plus Developer

#50

View PostCaptain Awesome, on Jun 30 2009, 05:24 PM, said:

I thought maybe it wouldn't work quite right but that's actually pretty much perfect. D'oh.

Another tidbit I'm having trouble figuring out. The blood flies through the air, and when it hits something it spawns a bloodsplat. This looks good when it hits the ground, rather natural and the like. I can't figure out how to setup so that when it hits a wall, instead of spawning a bloodsplat it shoots BLOODSPLAT# along the walls. I can't really figure it out. There is no ifnearactor equivalent for walls, as far as I know. Any ideas?


First, do not set the projectile to spawn anything (set spawns to -1)

onevent EVENT_KILLIT

ifactor MYBLOODPROJECTILE
{
  getactor[THISACTOR].htmovflag TEMP
  ifvarn TEMP 0 // this means it hit SOMETHING, maybe a wall, maybe a sprite
	  state random_wall_jibs // if there's a wall nearby, it will splatter the wall
  else iffloordistl 8
	  spawn MYBLOODSPLAT // if it didn't hit something and it's near the floor, spawn the floor splat
  setvar RETURN 0
}
endevent


I just typed this and didn't test it.
0

User is offline   Jimmy 

  • Let's go Brandon!

#51

No dice. =(
0

Share this topic:


  • 124 Pages +
  • 1
  • 2
  • 3
  • 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