
EDuke32 Scripting "CON coding help"
#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.
#541 Posted 09 July 2010 - 08:24 AM
insane_metalhead, on Jul 9 2010, 07:59 AM, said:
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.
There could be several different things wrong with that code that's causing it not to work. If its cstat is set at 32768 it will, indeed, be invisible, but it won't do anything when hit by a weapon because it doesn't have the proper bits to make it "hittable" (or however you'd phrase that). You'll need to add 256 to the cstat (see the cstat page on the wiki to get an idea of how all the bits work). Also, can't really confirm it, but that ifpdistl line could be throwing things out of whack too. A distance check probably isn't necessary if you just want it to execute some kind of code if it gets hit, here's some rough code that'll mostly achieve the effect you're going for...
Quote
useractor notenemy THIS_VAGUELY_DESCRIBED_THING_THAT_IS_INVISIBLE 0
cstat 33024
ifhitweapon { sound BAR_MUSIC } enda
That'll make the actor invisible and be receptive to hits, but it won't be blocked so the player can still walk through it. There's no real need to change the actor after its been hit, because it'll just keep playing the same sound, but it won't start it over again. You definitely won't want to use killit (i.e, delete it from the map) because that'll stop playing the sound altogether. I don't know how your wind ambience sound is defined, but for the bar music sound, I had to change its definesound from this
definesound BAR_MUSIC barmusic.voc 0 0 254 2 0
to this
definesound BAR_MUSIC barmusic.voc 0 0 254 1 0
The sound won't loop if you don't change that one little bit.
#542 Posted 09 July 2010 - 09:20 AM
Only one little thing, could the hitscan of the invisible sprite be removed?
Because eventhough blocking and hitscan is turned of in mapster32, it still got this hitscan effect on it.
Thank you so much EmericaSkater!

#543 Posted 09 July 2010 - 09:26 AM
insane_metalhead, on Jul 9 2010, 09:20 AM, said:
Only one little thing, could the hitscan of the invisible sprite be removed?
Because eventhough blocking and hitscan is turned of in mapster32, it still got this hitscan effect on it.
Thank you so much EmericaSkater!

Just change its cstat back to 32768 after it plays the sound. That oughta do it.
#544 Posted 10 July 2010 - 07:30 AM

Thanks again EmericaSkater.
BTW, is it possible to remove duke from cracking his knuckles? Like when the game starts and when he waits too long?
I found a command in the Eduke32 Wiki like "knuckle_incs"
Can I remove duke from doing that cracking with this command?
#545 Posted 10 July 2010 - 07:38 AM
#547 Posted 10 July 2010 - 11:24 AM
The Commander, on Jul 10 2010, 08:23 PM, said:
setplayer[THISACTOR].crack_time -1
In the APLAYER code.
Great! That worked.
Thanks Commander, and also for PM'ing.
#548 Posted 10 July 2010 - 10:58 PM
I thought it was the DukePlus thread.... (dont ask, I am tired and drunk)
#549 Posted 12 July 2010 - 09:27 PM
I have tried to mess around with the shade and orientation in EVENT_DISPLAYMENU but I can only achieve making the tile darker or black.
I am not tempted to rewrite the whole menu in EVENT_DISPLAYMENUREST.

EDIT: I tried to photoshop the tile I am using to be brighter, but it does not look like the background I see when I look at the eduke32 credits section.
This post has been edited by The Commander: 12 July 2010 - 09:28 PM
#550 Posted 13 July 2010 - 10:37 AM
The Commander, on Jul 10 2010, 11:23 AM, said:
setplayer[THISACTOR].crack_time -1
In the APLAYER code.
That doesnt seem to stop Duke from cracking his knuckles at the start of a level, though. Hmm.
#551 Posted 13 July 2010 - 10:42 AM
Commando Nukem, on Jul 13 2010, 08:37 PM, said:
You could always delete the sound and tiles so you can't see it anymore.
#552 Posted 13 July 2010 - 01:44 PM
This post has been edited by Mblackwell: 13 July 2010 - 01:45 PM
#553 Posted 13 July 2010 - 03:22 PM
Mblackwell, on Jul 13 2010, 02:44 PM, said:
That's what I told him.
#554 Posted 13 July 2010 - 06:41 PM
#555 Posted 14 July 2010 - 06:16 AM
DeeperThought, on Jul 13 2010, 06:22 PM, said:
Good so it's not just my fuzzy memory then.