EDuke32 Scripting "CON coding help"
#511 Posted 25 March 2010 - 12:21 AM
#512 Posted 25 March 2010 - 08:04 PM
http://www.youtube.com/watch_private?v=Xy3...IMSfwYvhRVu1adg - 1:40 is what I am talking about.
Oddly enough, in MP clients ignore the movement effect but still suffer the damage from hitradius which is what I am after.
This post has been edited by The Commander: 25 March 2010 - 08:04 PM
#514 Posted 26 March 2010 - 04:38 AM
M210, on Mar 27 2010, 12:24 AM, said:
code for what?
All actors do this when hit with hitradius
#515 Posted 26 March 2010 - 04:51 AM
#516 Posted 26 March 2010 - 05:04 AM
Fox, on Mar 27 2010, 01:51 AM, said:
No, I am just trying to nullify the impact/movement you get from hitradius but still suffer the damage from the hitradius.
Your code would stop both would it not from a glance.
#517 Posted 26 March 2010 - 08:34 AM
#518 Posted 26 March 2010 - 03:41 PM
This post has been edited by CraigFatman: 26 March 2010 - 03:41 PM
#519 Posted 08 April 2010 - 11:43 PM
I played Call Of Duty 4: Modern Warfare a month ago and I noticed the health regen system.
I tried to code it into my mod. OK, works. But too fast (like 20 health points per second).
I want the HP to regen at 1hp per second if you manage to avoid shots for 3 seconds.
I might found the way for the 1hp per second :
// all APLAYER code above if count 16 { addphealth 1 resetcount } // If one second isn't 16, tell me. enda
But what about the 3 sec wait time. I am still unexperienced with the ifcount and similar commands.
#522 Posted 14 April 2010 - 07:04 AM
How can I make 3 projectiles be shot such that they form a vertical line and one of them is slightly above the crosshair (where the player is aiming), the other in the middle and the third slightly below the crosshair ? I was kind of hoping I could use horiz for this, but after lots of tries I guess I can't.
#523 Posted 14 April 2010 - 07:31 AM
XThX2, on Apr 14 2010, 08:04 AM, said:
How can I make 3 projectiles be shot such that they form a vertical line and one of them is slightly above the crosshair (where the player is aiming), the other in the middle and the third slightly below the crosshair ? I was kind of hoping I could use horiz for this, but after lots of tries I guess I can't.
Horiz has more to do with the camera than anything else, so no, I don't imagine it would be useful for what you're trying to do. I would probably just create the weapon from scratch, make three unique projectiles for each position, then have the player shoot them when the fire button is pressed. You could edit the z-position of each projectile in event EGS (or maybe use RETURN after they're shot and edit it right there on the spot). Of course, that's right off the top of my head, but it makes sense to me.
#524 Posted 14 April 2010 - 09:34 AM
#525 Posted 14 April 2010 - 09:41 AM
XThX2, on Apr 14 2010, 09:34 AM, said:
Well, you can use horiz to check whether or not the player's aiming up/down, and change the projectile from there, it's just that horiz can't/isn't supposed to directly manipulate it.
#526 Posted 11 June 2010 - 09:42 AM
ifai AIT1IDLE // if the bad guy is in his idle state { ifcansee { getplayer[THISACTOR].posx PERPLAYER1 getplayer[THISACTOR].posy PERPLAYER2 getactor[THISACTOR].x TEMP1 getactor[THISACTOR].y TEMP2 subvarvar TEMP1 PERPLAYER1 subvarvar TEMP2 PERPLAYER2 getangle TEMP3 TEMP1 TEMP2 // get the angle he'd have to be at to be facing the player ifvarl TEMP3 0 { mulvar TEMP3 -1 } // and if that angle happens to be less than zero, multiply it by -1 setvarvar TEMP6 TEMP3 setvarvar TEMP7 TEMP3 // store that value in two separate vars for later use getactor[THISACTOR].ang TEMP5 // get the actor's actual angle subvar TEMP6 200 // subtract 200 from one of the stored values addvar TEMP7 200 // and add 200 to another, so this should create an array of values between TEMP7 and TEMP6 where the enemy can see the player ifvarvarl TEMP5 TEMP7 { ifvarvarg TEMP5 TEMP6 { ai AIT1WALK } } // if the bad guy's angle is greater than the minimum needed angle, but less than the maximum, have him seek the player
This code does, in some small capacity work. Only problem is, it isn't working from the angle I 'need' it to be working from. The bad guy only goes into his seeking AI if I'm behind ( and usually kind of off to the side of) him. If I'm in front of him, he just stands there. The only thing I thought could fix this problem was adding 1024 to the needed angles, thinking that'd flip the values around or something, but he didn't do anything at all when I did that. Can anyone tell me what I'm screwing up?
EDIT: Nevermind, I think I just got it to work. I don't know if the math was suppose to be like this, but I flipped it around to where the enemy's angle subtracts from the player's angle, and it's working like a charm now.
This post has been edited by EmericaSkater: 11 June 2010 - 10:36 AM
#527 Posted 11 June 2010 - 10:39 AM
1) Calculate the angle that would make the actor face the player (let's call this ANGLE1)
2) Use getincangle to calculate the difference between the actor's current angle and ANGLE1. The difference, which is the return var of the getincangle command, we will call DIFF.
3) If the absolute value of DIFF is less than 512 (or whatever number you deem appropriate) then the player is in the actor's cone of vision.
#528 Posted 11 June 2010 - 11:06 AM
DeeperThought, on Jun 11 2010, 10:39 AM, said:
1) Calculate the angle that would make the actor face the player (let's call this ANGLE1)
2) Use getincangle to calculate the difference between the actor's current angle and ANGLE1. The difference, which is the return var of the getincangle command, we will call DIFF.
3) If the absolute value of DIFF is less than 512 (or whatever number you deem appropriate) then the player is in the actor's cone of vision.
Hmmm. I gave it a whirl and didn't have any luck, I may have misinterpreted something, though I've changed everything that might have caused it not to work, and the guy still switches into his seeking ai.
Quote
{ ifcansee {
getplayer[THISACTOR].posx PERPLAYER1
getplayer[THISACTOR].posy PERPLAYER2
getactor[THISACTOR].x TEMP1
getactor[THISACTOR].y TEMP2
subvarvar PERPLAYER1 TEMP1
subvarvar PERPLAYER2 TEMP2
getangle TEMP3 PERPLAYER1 PERPLAYER2 // get the angle he needs to face the player
ifvarl TEMP3 0 { mulvar TEMP3 -1 }
getactor[THISACTOR].ang TEMP5 // get his current angle
getincangle TEMP7 TEMP3 TEMP5 // get the difference between the two. When I first tried this, I had TEMP3 and TEMP5 swapped around, and he'd switch into his seeking ai as soon as I entered
// the room. With the variables like this, he doesn't do it immediately but he winds up doing it if I get to close, even though I haven't changed angles.
ifvarl TEMP7 512 { ai AIT1WALK break } // changing 512 to any other value doesn't seem to do anything
} }
I probably just royally screwed something up, but I've made all the changes I can think of.
#529 Posted 11 June 2010 - 11:52 AM
Instead, use ifvarl TEMP7 0 mulvar TEMP7 -1 after the getincangle
If you look at my previous post, you'll notice that I said to use the absolute value of the result of getincangle, not to change something to an absolute value before getincangle
I'm assuming you have your variables in the correct order for getangle etc.
This post has been edited by DeeperThought: 11 June 2010 - 11:56 AM
#530 Posted 11 June 2010 - 06:28 PM
DeeperThought, on Jun 11 2010, 11:52 AM, said:
Instead, use ifvarl TEMP7 0 mulvar TEMP7 -1 after the getincangle
If you look at my previous post, you'll notice that I said to use the absolute value of the result of getincangle, not to change something to an absolute value before getincangle
I'm assuming you have your variables in the correct order for getangle etc.
Yeah, that must've been what I did wrong, because I moved that line below the getincangle command and it works. So I've got two functional methods of doing this now, but I think I'll probably end up using yours because it's a bit less code-intensive and it looks like it can be manipulated to work with player distances a bit more easily as well. Thanks, DT.
#531 Posted 03 July 2010 - 03:55 AM
The other day I decided to make it so the palfrom "tint" that comes on screen when the player takes damage, to be controlled through gamevars and the .pals on the player strcture.
However, I can't see how to set the "tensity" using .pals and didn't see anything else that could control this. Without the tensity, even a colour of 64 is very faded.
So, how can I control the "tensity" of tints set through .pals.
This post has been edited by Chip: 03 July 2010 - 07:33 AM
#532 Posted 03 July 2010 - 05:51 PM
Chip, on Jul 3 2010, 04:55 AM, said:
The other day I decided to make it so the palfrom "tint" that comes on screen when the player takes damage, to be controlled through gamevars and the .pals on the player strcture.
However, I can't see how to set the "tensity" using .pals and didn't see anything else that could control this. Without the tensity, even a colour of 64 is very faded.
So, how can I control the "tensity" of tints set through .pals.
Do you mean intensity? If so, then it's controlled by the pals_time member of the player struct. It's not stated in the description, but the greater the time left, the greater the intensity.
#534 Posted 07 July 2010 - 01:10 PM
#535 Posted 07 July 2010 - 01:45 PM
James, on Jul 7 2010, 02:10 PM, said:
readarrayfromfile <arrayname> <quote#>
The name of the file that the array is stored in will be the quote
writearraytofile works the same way. I can add that to the wiki later, if no one else does.
#537 Posted 07 July 2010 - 03:02 PM
EDIT
Added some shit to the Wiki (finally got to register, lol).
This post has been edited by CraigFatman: 08 July 2010 - 11:46 AM
#538 Posted 09 July 2010 - 05:55 AM
I wanted to make a sprite, that's invisible.
When you shoot it, it disappears and a looping sound is playing, so that the sound never goes away.
Is this possible, with that looping sound thingy, because it never works for me
Thanks in advance guys!
#539 Posted 09 July 2010 - 06:11 AM
insane_metalhead, on Jul 9 2010, 05:55 AM, said:
I wanted to make a sprite, that's invisible.
When you shoot it, it disappears and a looping sound is playing, so that the sound never goes away.
Is this possible, with that looping sound thingy, because it never works for me
Thanks in advance guys!
Making a sound effect loop is easy. http://wiki.eduke32....iki/Definesound You just set the sound effect's "type" to 3, so it can be used for a music/sfx sprite, and it'll loop (1 is the important part of the bit-field, as it's what actually makes the sound loop). I'd be able to throw together some code so you could see how it'd be done, but I really don't get what you mean in the rest of the post. I mean, if the sprite's invisible in the first place, you wouldn't have to make it 'turn' invisible when it's shot...
#540 Posted 09 July 2010 - 07:59 AM
EmericaSkater, on Jul 9 2010, 04:11 PM, said:
No, I know. What I meant is that the sprite has to disappear eventhough it's invisible. I think it's done with the "killit" command, so when you shoot it again nothing happens.
I just don't know what to put first or to start with.
I got this, and trying to figure out what to do and such:
define WINDACTOR 19 useractor notenemy WINDACTOR cstat 32768 ifpdistl 864 ifcansee ifp palive ifhitweapon { soundonce WIND } enda
But this doesn't does anything.