EDuke32 Scripting "CON coding help"
#1968 Posted 04 June 2017 - 03:11 PM
#1969 Posted 04 June 2017 - 04:01 PM
Perro Seco, on 04 June 2017 - 03:11 PM, said:
I think you are confusing "strength" with "addstrength". Using negative values on "strength" should not work that way. In any case, what's going on here is that the .extra member of the projectile sprite, which stores damage, is being modified.
#1970 Posted 08 June 2017 - 05:44 AM
Drek, on 19 February 2017 - 12:46 PM, said:
Hello
I tried the script to open a door using an animated model. As a reminder, the closed door was a static model ("closed" position) while the next tile was defined as the same model with an animated opening.
The problem is when the model is switching to the next picnum to start the animation, the animation is not played but skips to the very last frame (completely opened).
As a result the door opens roughly anyway.
The behaviour is erratic because when I insisted on the door - opening & closing several times - it happens sometimes the animation is played (fluid opening),
and other times the animation goes "half-way". Is there some explanation or something to do ?
#1971 Posted 08 June 2017 - 10:03 AM
#1972 Posted 08 June 2017 - 12:09 PM
Trooper Dan, on 08 June 2017 - 10:03 AM, said:
#1973 Posted 08 June 2017 - 12:20 PM
David B., on 08 June 2017 - 12:09 PM, said:
That's what it's supposed to do when flags is set to 0, but I was just asking to confirm you can get the animation to display.
I'm beginning to think we may have an EDuke32 bug here. Like I said, I experienced a similar problem. It seems that in many instances, setting flags 1 on an animation will cause it to immediately skip to the last frame rather than play the whole thing.
#1974 Posted 11 June 2017 - 02:03 AM
(Here is what I wrote for now, but the while loop doesn't allow to looks like an animation. I even tried ifcount and resetcount inside the loop to make it changes the angle "step by step" but it makes the game bugs, thus I know all this is not the right solution) :
state rotate_door
ifvare mycount 16
{
setvar mybool 1
setvar mycount 0
}
ifvare mybool 0
{
addvar mycount 1
}
else
ifvare mybool 1
ifpdistl 1024 ifhitspace {
setvar temp 512
whilevarn temp 0 {
getactor[THISACTOR].ang angnum
addvar angnum 1
setactor[THISACTOR].ang angnum
subvar temp 1
}
}
ifvare temp 0 soundonce 412
setvar mybool 0
}
ends
useractor notenemy TEST_DOOR
state rotate_door
enda
I'd like to assign to the sprite a rotating speed ; is it possible at least ?
This post has been edited by David B.: 11 June 2017 - 02:04 AM
#1975 Posted 11 June 2017 - 08:27 AM
Eg setting temp to 256 and adding 2 to angvar each tic would double speed.
Slower you could set temp to 1024 add 1 to angvar each tic then divvar angvar 2 before setting it to the sprite, this would give you half speed rotation.
#1976 Posted 11 June 2017 - 09:43 AM
Drek, on 11 June 2017 - 08:27 AM, said:
Eg setting temp to 256 and adding 2 to angvar each tic would double speed.
Slower you could set temp to 1024 add 1 to angvar each tic then divvar angvar 2 before setting it to the sprite, this would give you half speed rotation.
I'd like to know a way to tell "wait a certain time" at the end of the loop. I used "ifcount" for that, but this crashes the game.
Or perhaps giving to the sprite a rotating velocity along the Z-axis, similarly to the linear velocity we may give by using xvel, yvel, zvel.
I can't think it's impossible to rotate a sprite but I need something which is unfortunately beyond my knowledge.
This post has been edited by David B.: 11 June 2017 - 09:44 AM
#1977 Posted 11 June 2017 - 09:58 AM
added later:
I reordered some brackets, but the worst offender for you was the while loop, it seemed to play out in 1 tic, I changed it to an ifvarn 0 then it cycles through now once each tic as event game is called, still not perfect it may animate at varying speeds for faster/slower pcs, I still recommend looking into using the actions and ifactioncount.
test_door.zip (1.68K)
Number of downloads: 652
state rotate_door
ifvare mycount 16
{
setvar mybool 1
setvar mycount 0
}
ifvare mybool 0
{
addvar mycount 1
}
ifvare mybool 1
{
ifpdistl 1024
{
ifhitspace
{
setvar temp 512 // the way this is set up set temp here to full rotation you want
getactor[THISACTOR].ang angnum
setvar mybool 0
soundonce 74
}
}
}
ifvarn temp 0
{
addvar angnum 16 // set speed here 1 is slow, 2 is still slow but faster, use power of 2 nums
setactor[THISACTOR].ang angnum
subvar temp 16 // match this to angnum above, 4,8,16 maybe 32 are decent speeds
}
ends
useractor notenemy TEST_DOOR
state rotate_door
enda
This post has been edited by Drek: 11 June 2017 - 12:56 PM
#1978 Posted 12 June 2017 - 09:02 AM
Drek, on 11 June 2017 - 09:58 AM, said:
added later:
I reordered some brackets, but the worst offender for you was the while loop, it seemed to play out in 1 tic, I changed it to an ifvarn 0 then it cycles through now once each tic as event game is called, still not perfect it may animate at varying speeds for faster/slower pcs, I still recommend looking into using the actions and ifactioncount.
This post has been edited by David B.: 12 June 2017 - 09:02 AM
#1979 Posted 15 June 2017 - 09:51 AM
action OPENING 1 9 1 1 4
useractor notenemy TEST_DOOR TOUGH OPENING
ifpdistl 1024 ifhitspace ifcansee
{
soundonce 412
action OPENING
}
endadefine TEST_DOOR 5646
and
dummytile 5646 128 128
texture 5646 {
pal 0 { file "fx/door.jpg" }
}
model "models/test/new test/door.md3" {
scale 2 shade 4
skin { pal 0 surface 0 file "models/test/door.jpg" }
skin { pal 30 surface 0 file "models/test/door_30.jpg" }
skin { surface 1 file "models/test/metal.jpg" }
skin { surface 2 file "models/test/glass.png" }
frame { name "closed1" tile 5646 }
anim { frame0 "open1" frame1 "open2" fps 10 flags 1 }
frame { name "open1" tile0 5647 tile1 5648 }
}
This time I can't get animation even with flags 0. The issue seems to come from the action itself or something is lacking...
The action was supposed to play the 9 next frames, the first frame (closed1) being reserved for the closed door in its initial position (this trick is inspired from the EGG definition).
#1980 Posted 15 June 2017 - 10:08 AM
#1981 Posted 15 June 2017 - 10:38 AM
Trooper Dan, on 15 June 2017 - 10:08 AM, said:
dummytile 5646 128 128
texture 5646 {
pal 0 { file "fx/door.jpg" }
}
model "models/test/new test/door.md3" {
scale 2 shade 4
skin { pal 0 surface 0 file "models/test/door.jpg" }
skin { pal 30 surface 0 file "models/test/door_30.jpg" }
skin { surface 1 file "models/test/metal.jpg" }
skin { surface 2 file "models/test/glass.png" }
frame { name "closed1" tile 5646 }
anim { frame0 "open1" frame1 "open9" fps 10 flags 1 }
frame { name "open1" tile0 5647 tile1 5655 }
}But I cannot control the door in the game yet. For the EGG, they put the animation on the second frame otherwise the animation would be played immediatly. I do the same here for my door but it seems the action don't fetch the frames for the animation.
This post has been edited by David B.: 15 June 2017 - 10:43 AM
#1982 Posted 15 June 2017 - 11:21 AM
action CLOSED 0 0 0 0 1
action OPENING 1 2 1 1 10
useractor notenemy TEST_DOOR TOUGH CLOSED
ifaction CLOSED
ifpdistl 1024 ifhitspace ifcansee
{
soundonce 412
action OPENING
}
endaI'm not sure, but try the above. It's more clear when you start with a defined action and then change to a different defined action only when the conditions are met.
#1983 Posted 15 June 2017 - 11:40 AM
Trooper Dan, on 15 June 2017 - 11:21 AM, said:
The door still not working, I just hear the sound being played like the other times.
#1984 Posted 15 June 2017 - 11:50 AM
David B., on 15 June 2017 - 11:40 AM, said:
I suspect that something is broken with displaying model animation in EDuke32 having to do with model flags. I recommend that you try old builds, like from 2 years ago, and see what happens. If you can get it to work with an older build then we can bisect it. The weird thing is that while I have had a similar problem myself, you don't see this happening with the HRP. If model flags were broken, then I would expect to see monster death animations not working.
#1985 Posted 15 June 2017 - 12:18 PM
Trooper Dan, on 15 June 2017 - 11:50 AM, said:
I have re-installed duke3d (in a new folder) with an eduke32 version from 2014 (eduke32_win64_20140706-4538.7z) I had kept for a while but when I run the map, the behaviour is unfortunately the same.
Maybe the problem has always been there, or... the script seems to be OK but considering my low experience in hardcoding I'm not really sure.
This post has been edited by David B.: 15 June 2017 - 12:26 PM
#1986 Posted 15 June 2017 - 12:25 PM
David B., on 15 June 2017 - 12:18 PM, said:
Well so much for that theory...
#1987 Posted 15 June 2017 - 12:34 PM
#1988 Posted 15 June 2017 - 12:37 PM
Drek, on 15 June 2017 - 12:34 PM, said:
Good point. He only showed dummytile for the one tile instead of dummytilerange over all of them.
#1989 Posted 15 June 2017 - 12:40 PM
Drek, on 15 June 2017 - 12:34 PM, said:
dummytilerange 5646 5655 128 128
texture 5646 {
pal 0 { file "fx/door.jpg" }
}
model "models/test/new test/door.md3" {
scale 2 shade 4
skin { pal 0 surface 0 file "models/test/door.jpg" }
skin { pal 30 surface 0 file "models/test/door_30.jpg" }
skin { surface 1 file "models/test/metal.jpg" }
skin { surface 2 file "models/test/glass.png" }
frame { name "closed1" tile 5646 }
anim { frame0 "open1" frame1 "open9" fps 10 flags 1 }
frame { name "open1" tile0 5647 tile1 5655 }
}The door opens now with a smooth animation, just by replacing dummytile by dummytilerange.
Nice idea;
#1991 Posted 15 June 2017 - 12:52 PM
David B., on 15 June 2017 - 12:42 PM, said:
You were trying to display animation on tiles that did not exist. When you define a tile range for a model, it's telling the game to draw the model instead of the 8-bit tiles that exist on those numbers. But if the tiles don't actually exist, then it won't work.
#1992 Posted 18 June 2017 - 10:55 AM
#1993 Posted 18 June 2017 - 01:00 PM
#1994 Posted 24 June 2017 - 05:27 AM
I have tried many things before to come back here but this is for closing that damn door again.
gamevar closed 1 2
action OPENING 1 9 1 1 2
action CLOSING 9 9 1 -1 2 // (I tried also CLOSING 1 9 1 -1 2 but normally the closing starts from the last frame...)
useractor notenemy TEST_DOOR 0
ifaction 0 { // (I have read ifaction 0 allows to spare an action)
ifpdistl 1024 ifhitspace ifcansee {
ifvare closed 1 {
soundonce 412
action OPENING
cstat 0
setvar closed 0
} else { // (now the part that seems to be ignored)
soundonce 412
action CLOSING
cstat 1
setvar closed 1
}
}
}
enda
Opening is solved but nothing happens when I hit space for closing the door, the sound is not played neither so it ignores totally the second part of the script.
I tried also 'savegamevar' & 'readgamevar' for "closed 1" thinking it didn't record its value, with no result.
This post has been edited by David B.: 24 June 2017 - 05:27 AM
#1995 Posted 24 June 2017 - 06:17 AM
action CLOSING 1 9 1 1 2
action OPENING 9 9 9 -1 2 // I'm assuming your existing numbers are right
useractor notenemy TEST_DOOR TOUGH CLOSING
ifpdistl 1024 ifcansee ifhitspace
ifaction CLOSING
{
soundonce 412
action OPENING
}
else
ifaction OPENING
{
soundonce 412
action CLOSING
}
enda
This post has been edited by Mark.: 24 June 2017 - 06:51 AM
#1996 Posted 24 June 2017 - 07:23 AM
Mark., on 24 June 2017 - 06:17 AM, said:
action CLOSING 1 9 1 1 2
action OPENING 9 9 9 -1 2 // I'm assuming your existing numbers are right
useractor notenemy TEST_DOOR TOUGH CLOSING
ifpdistl 1024 ifcansee ifhitspace
ifaction CLOSING
{
soundonce 412
action OPENING
}
else
ifaction OPENING
{
soundonce 412
action CLOSING
}
enda For now I'm a beginner too (hope it's gonna change:) and I have difficulty especially with actions.
The problem is despite the number -1 I set in the CLOSING action, this changes nothing ; this is not playing the animation backward.
(Also the OPENING action (which works satisfactorily) doesn't change behaviour with 'start frame' ; 'number of tiles' or 'delay' parameters, which I don't understand neither. And if I set "-1" as incvalue the code still opens the door (still playing forward despite of -1 !).
Let's say I define 5 for the 'start frame' I should see my door starting suddenly from the 5th frame instead of playing the whole animation, right ?)
Calling an action "CLOSING" where I defined "-1" as incvalue should necessarily play the animation backward. So what happens here... ?
If this can help, I post again how my model was defined :
dummytilerange 5640 5649 128 128
texture 5640 {
pal 0 { file "fx/door.jpg" }
}
model "models/doors/door.md3" {
scale 2 shade 4
skin { pal 0 surface 0 file "models/doors/door.jpg" }
skin { pal 30 surface 0 file "models/doors/door_30.jpg" }
skin { surface 1 file "models/doors/metal.jpg" }
skin { surface 2 file "models/doors/glass.png" }
normal { surface 0 file "models/doors/door_n.jpg" }
frame { name "closed1" tile 5640 }
anim { frame0 "open1" frame1 "open9" fps 8 flags 1 }
frame { name "open1" tile0 5641 tile1 5649 }
}
When I see how hard it is for a door coding, the guys who have hard coded the monsters in the HRP version are really Kings !!
This post has been edited by David B.: 24 June 2017 - 07:24 AM
#1997 Posted 24 June 2017 - 11:48 AM
EDIT: I see Drek is here. I also see a potential problem with my code suggestion. Save us!
This post has been edited by Mark.: 24 June 2017 - 01:42 PM

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


