EDuke32 Scripting "CON coding help"
#865 Posted 26 July 2012 - 12:06 PM
What I do is create a state and make the actors call it from their actor code, before their call to ifhitweapon.
#866 Posted 26 July 2012 - 12:09 PM
#867 Posted 26 July 2012 - 12:19 PM
Reaper_Man, on 26 July 2012 - 12:09 PM, said:
Maybe this would work?
gamevar lastextra 32767 2
onevent EVENT_GAME
ifvare sprite[THISACTOR].statnum 1
ifvarvarl sprite[THISACTOR].extra lastextra
ifvarvare sprite[THISACTOR].htowner player[THISACTOR].i
{
// do your stuff here
}
getactor[THISACTOR].extra lastextra
endevent
#868 Posted 26 July 2012 - 01:36 PM
If I am not wrong, the problem is that ifhitweapon command seems to do more than checking for damage, but also re-calculates it when used, so you can't use htextra after it.
====//====//====
How can I find out if music option in menu is on or off?
This post has been edited by Fox: 26 July 2012 - 01:37 PM
#869 Posted 26 July 2012 - 02:19 PM
I also didn't realize that something like ifvarvare sprite[THISACTOR].htowner player[THISACTOR].i would work, that's useful to know.
This post has been edited by Reaper_Man: 26 July 2012 - 02:23 PM
#870 Posted 26 July 2012 - 02:38 PM
#871 Posted 26 July 2012 - 02:52 PM
Fox, on 26 July 2012 - 01:36 PM, said:
I know it's lame, but he has good reason to not want to modify the enemy code. Once you start doing that, your code becomes much less portable.
#873 Posted 26 July 2012 - 06:21 PM
Trooper Dan, on 26 July 2012 - 12:06 PM, said:
That's a serious problem for mutators, and unfortunately I can't think of a simple solution. Perhaps a second EVENT_GAME should be added before the actor block executes, but that seems like overkill for a corner case like this.
Do you know of any other instances where there is something you cannot do in EVENT_GAME that you can effectively only do in actor code?
#874 Posted 26 July 2012 - 06:32 PM
#875 Posted 27 July 2012 - 03:59 PM
#876 Posted 27 July 2012 - 04:18 PM
Reaper_Man, on 27 July 2012 - 03:59 PM, said:
onevent EVENT_EGS
ifspawnedby RESPAWN
{
// etc.
Works for me!
#877 Posted 27 July 2012 - 04:41 PM
Okay you're partly right. The problem is that the picnum of the spawned sprite is the literal picnum, IE a spawned LIZTROOPJETPACK's picnum is 1725 and not 1680 as would be expected. Is this a bug, or do I need to add in every spawn variant of every enemy actor?
This post has been edited by Reaper_Man: 27 July 2012 - 05:05 PM
#880 Posted 27 July 2012 - 05:40 PM
Reaper_Man, on 27 July 2012 - 04:41 PM, said:
It's not a bug; the behavior makes perfect sense. For example LIZTROOPJETPACK does not cactor into a regular LIZTROOP until it's actor code runs, but that can't happen until after EVENT_EGS.
It just takes a few moments to write code such as this:
getactor[THISACTOR].picnum picnum
switch picnum
case LIZTROOP
case LIZTROOPSTAYPUT
case LIZTROOPSHOOT
case LIZTROOPJETPACK
case LIZTROOPRUNNING
case LIZTROOPONTOILET
case LIZTROOPJUSTSIT
case LIZTROOPDUCKING
// do whatever
break
case PIGCOP
case PIGCOPDIVE
case PIGCOPSTAYPUT
// etc.
#881 Posted 03 August 2012 - 10:31 AM
i need replace original crosshair by my own texture, but why is black color transparent?
For test i replaed original crosshair with black 64x64 bmp in .ART and in HRP with 64x64 black png.
But in game its transparent black, why? Is there any control of transparency of crosshair?
And how i can control if is crosshair off / on?
I know about event_displaycrosshair in HUD file, but how exactly it works?
This post has been edited by Biturbo: 04 August 2012 - 05:09 AM
#882 Posted 05 August 2012 - 02:01 AM
I know, the problem would be the different screen resolutions, but can“t I just give it a %-value?
#883 Posted 05 August 2012 - 06:51 AM
#884 Posted 06 August 2012 - 03:09 AM
I placed my custom sprite in sector which i want do that effect of lighting. But there is problem, its working only for first sector, i need it for all sectors where is that sprite placed...
can someone help?
define LIGHTING_ICON 3589
gamevar timecounter 0 0
gamevar okay 0 1
gamevar sector_pos 0 0
onevent EVENT_DISPLAYROOMS
ifrnd 0
{
ifrnd 64
{
soundonce THUNDER
setvar okay 1
}
}
endevent
useractor notenemy LIGHTING_ICON
{
cstat 32768
getactor[THISACTOR].sectnum sector_pos
ifvare okay 1
{
setsector[sector_pos].floorshade 20
setsector[sector_pos].ceilingshade 20
addvar timecounter 1
setvar okay 1
}
ifvare timecounter 40
{
setsector[sector_pos].floorshade 30
setsector[sector_pos].ceilingshade 30
setvar timecounter 0
setvar okay 0
}
}
enda
#885 Posted 06 August 2012 - 06:38 AM
gamevar sector_pos 0 2
The wiki tells you different values you can set gamevars, but for the most part you'll be using 0 as a global var, 1 as a player var, and 2 as an actor var. You'll also want to change timecounter to a per actor var, judging by your code
This post has been edited by James: 06 August 2012 - 06:39 AM
#886 Posted 06 August 2012 - 11:25 AM
James, on 06 August 2012 - 06:38 AM, said:
gamevar sector_pos 0 2
The wiki tells you different values you can set gamevars, but for the most part you'll be using 0 as a global var, 1 as a player var, and 2 as an actor var. You'll also want to change timecounter to a per actor var, judging by your code
Many Thanks i didnt know this (im just a new to .CON) but problem is it still doesnt work...
If i do this:
define LIGHTING_ICON 3589
gamevar timecounter 0 2
gamevar okay 0 0
gamevar sector_pos 0 2
onevent EVENT_DISPLAYROOMS
ifrnd 0
{
ifrnd 64
{
soundonce THUNDER
setvar okay 1
}
}
endevent
useractor notenemy LIGHTING_ICON
{
cstat 32768
getactor[THISACTOR].sectnum sector_pos
ifvare okay 1
{
setsector[sector_pos].floorshade 20
setsector[sector_pos].ceilingshade 20
addvar timecounter 1
}
ifvare timecounter 40
{
setsector[sector_pos].floorshade 30
setsector[sector_pos].ceilingshade 30
setvar timecounter 0
setvar okay 0
}
}
enda
Then it isnt working properly, first one sector goes dark and return back, later another one, but both never goes dark and return together.
I tried also this without that "setvar okay 0":
ifvare timecounter 40
{
setsector[sector_pos].floorshade 30
setsector[sector_pos].ceilingshade 30
setvar timecounter 0
}
and its really close to what i need, but still is there problem, when both sectors goes dark, they keep blinking...
So we are very close, just tell me someone what im doing bad
#887 Posted 06 August 2012 - 11:54 AM
#888 Posted 07 August 2012 - 05:25 AM
cant you show me exactly i how can do it?
because ive tried many combinations of this + that aplayer code, but still it isnt working properly.
video is here: video
im trying to make own mod, something like slendergame.net with nice atmosphere, but first problem is these lighting, and another one is i dont know how control if is crosshair on or off.
I know maybe in some data or cfg file can be this information stored, but that isnt very useful because i need control it in .CON
I'd appreciate any help, thanks!
This post has been edited by Biturbo: 07 August 2012 - 05:34 AM
#889 Posted 07 August 2012 - 11:27 AM
#890 Posted 07 August 2012 - 03:46 PM
Biturbo, on 07 August 2012 - 05:25 AM, said:
gamevar thunder_count 0 0
gamevar runonce 0 2
gamevar default_cshade 0 2 // to store the original sector shade
gamevar default_fshade 0 2 // to store the original sector shade
gamevar new_cshade 0 2
gamevar new_fshade 0 2
useractor notenemy LIGHTING_ICON
cstat 32768
ifvare runonce 0 // we only want to store the shade at its default value
{
getsector[THISACTOR].floorshade default_fshade
getsector[THISACTOR].ceilingshade default_cshade
setvar runonce 1
}
ifvarg thunder_count 30 // if the counter is above a good value
{
setvarvar new_cshade default_cshade
setvarvar new_fshade default_fshade
subvar new_cshade 10 // subtract! lower numbers are brighter numbers
subvar new_fshade 10
ifvarg thunder_count 35 // I made two stages of brightness for the heck of it
{
subvar new_cshade 10
subvar new_fshade 10
}
setsector[sector_pos].floorshade new_fshade
setsector[sector_pos].ceilingshade new_cshade
}
else // otherwise just keep the default/original sector shade
{
setsector[THISACTOR].floorshade default_fshade
setsector[THISACTOR].ceilingshade default_cshade
}
enda
actor APLAYER
ifvare thunder_count 0 ifrnd 16 // we only start counting sometimes
{
setvar thunder_count 1
}
else ifvarg thunder_count 0 // count as long as the var is more than 0
{
addvar thunder_count 1
ifvarg thunder_count 40 // reset it when it goes over the max value we want
setvar thunder_count 0
}
// rest of player code
enda
#891 Posted 07 August 2012 - 10:25 PM
rasmus thorup, on 07 August 2012 - 11:27 AM, said:
That is circuitous. Use getuserdef[THISACTOR].crosshair only to see if the user has enabled or disabled the crosshair in their options. You should not change it because that would alter their preference.
Instead, utilize EVENT_DISPLAYCROSSHAIR. If you want to forcefully disable the crosshair, in that event, "setvar RETURN -1". If you only want to change the crosshair image, I added functionality so that all you have to do is set RETURN to the tilenum of the image you want to use. If you are doing anything more fancy than that, such as color palette or positioning changes, let me know and I will help you with that.
#892 Posted 24 August 2012 - 11:34 AM
Hendricks266, on 26 July 2012 - 06:21 PM, said:
Do you know of any other instances where there is something you cannot do in EVENT_GAME that you can effectively only do in actor code?
So hey, now that you've got your new computer, any chance of this happening soonish? I'm sort of bedridden post-surgery for the next couple of days, I'd love to be able to finish up that mutator I was working on.
#893 Posted 02 September 2012 - 02:00 AM
or i need to edit eduke32.exe ?
This post has been edited by Biturbo: 02 September 2012 - 02:16 AM
#894 Posted 10 September 2012 - 05:30 PM
onevent EVENT_PREGAME
{
ifvarn sprite[THISACTOR].htextra -1
{
redefinequote 254 Actor (%d) Extra (%d) Htextra (%d) Owner (%d)
qsprintf 254 254 THISACTOR sprite[THISACTOR].extra sprite[THISACTOR].htextra player[THISACTOR].i
echo 254
}
}
endeventShooting something with a hitscan weapon works fine:
Actor (448) Extra (24) Htextra (9) Owner (644)
But shooting them with anything else (freezer, RPG, etc.) only seems to output for spawned debris, gibs, and other effects. The original actor doesn't show up in the output.
Is this a bug, or am I doing things wrong?

Help
Duke4.net
DNF #1
Duke 3D #1


