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

Jump to content

  • 115 Pages +
  • « First
  • 65
  • 66
  • 67
  • 68
  • 69
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   David B. 

#1981

View PostTrooper Dan, on 15 June 2017 - 10:08 AM, said:

The first thing that strikes me when looking at that is that you have an action that goes for 9 frames (from tiles 5647 to 5655) but your model definition only covers 2 of them.
Ok I understand that point, the definition has been modified as follows :

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

0

User is online   Danukem 

  • Duke Plus Developer

#1982

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 

     }
 
enda


I'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.
0

User is offline   David B. 

#1983

View PostTrooper Dan, on 15 June 2017 - 11:21 AM, said:

I'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.

The door still not working, I just hear the sound being played like the other times.
0

User is online   Danukem 

  • Duke Plus Developer

#1984

View PostDavid B., on 15 June 2017 - 11:40 AM, said:

The door still not working, I just hear the sound being played like the other times.


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.
0

User is offline   David B. 

#1985

View PostTrooper Dan, on 15 June 2017 - 11:50 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.

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

0

User is online   Danukem 

  • Duke Plus Developer

#1986

View PostDavid B., on 15 June 2017 - 12:18 PM, said:

I have re-installed duke3d 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.


Well so much for that theory...
0

User is offline   Kyanos 

#1987

It could be something simple like not setting dummytile for each tilenum.
2

User is online   Danukem 

  • Duke Plus Developer

#1988

View PostDrek, on 15 June 2017 - 12:34 PM, said:

It could be something simple like not setting dummytile for each tilenum.


Good point. He only showed dummytile for the one tile instead of dummytilerange over all of them.
1

User is offline   David B. 

#1989

View PostDrek, on 15 June 2017 - 12:34 PM, said:

It could be something simple like not setting dummytile for each tilenum.
Incredible !!! Yes. That's it !

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;
1

User is offline   David B. 

#1990

I didn't know this point was so important...
0

User is online   Danukem 

  • Duke Plus Developer

#1991

View PostDavid B., on 15 June 2017 - 12:42 PM, said:

I didn't know this point was so important...


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.
1

User is offline   Kyanos 

#1992

I've been a huge fan of Notepad++, especially with the CON language color scheme I got from here. But lately I've had a few specific text editing needs that put me onto Editpad. 1 It's a great hex editor with good copy/paste there. 2 "Regex" using REGular EXpressions in search and replace (pic related)
Posted Image
1

User is offline   Hendricks266 

  • Weaponized Autism

  #1993

I use Notepad++ for source code and EditPad for text that doesn't need highlighting. Both support regex in their find and replace.
0

User is offline   David B. 

#1994

Hi, I'm back again with another issue. I would like to define two actions and choose one depending on a gamevar.
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

0

User is offline   Mark 

#1995

I'm a beginner level coder and my bracketing may be wrong but this is where I would start from. Basically you need the " ifaction OPENING" after the else which you were missing.


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

0

User is offline   David B. 

#1996

View PostMark., on 24 June 2017 - 06:17 AM, said:

I'm a beginner level coder and my bracketing may be wrong but this is where I would start from. Basically you need the " ifaction OPENING" after the else which you were missing.

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

0

User is offline   Mark 

#1997

Another thing to do until you get it working is change the sound of door closing. That way if you hear the sound change each time you press the "use" key then you know that open/close code is working and the problem is in the action which moves the model.

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

1

#1998

View PostDavid B., on 24 June 2017 - 05:27 AM, said:

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.

It isn't supposed to happen, since all your code is placed inside the "ifaction 0" condition. Action 0 is the default action for an actor, which can be used to initialize its properties, and as soon as you switch to another action (opening animation), that code is never executed again. Your door actually should have four different states, as actor animations keep looping forever after reaching last frame. Use "ifactioncount" to check for the right time to stop opening animation and put the actor into a fixed opened state (separate action, 'closed' variable isn't needed), from which it can begin closing.

This post has been edited by Jan Satcitananda: 24 June 2017 - 10:10 PM

1

User is offline   David B. 

#1999

I'm not sure to understand everything but here's the new script I have done :

action OPENING 1 9 0 1 0
action CLOSING 1 9 0 -1 0

state open
    soundonce 450
    action OPENING
ends

state close // (opened)
    soundonce 455
    action CLOSING
    resetactioncount
ends

useractor notenemy TEST_DOOR 0

ifpdistl 1024 ifhitspace ifcansee {
    ifactioncount 0  { 
        state open
        break }

    else {
        ifactioncount 9 { 
            state close 
            
        }
    }
}

enda 


Only the first part is working before the else. Once the door is opened, I hear the same opening sound (450) when I hit space, not the closing sound (455). The door doesn't close.
The script executes each time the open state while actioncount should normally be incremented (or I think so).

This post has been edited by David B.: 26 June 2017 - 09:22 AM

0

User is online   Danukem 

  • Duke Plus Developer

#2000

View PostDavid B., on 26 June 2017 - 09:21 AM, said:

Only the first part is working before the else.


The backwards animation defined with the -1 increment should begin on the tile where the first one ends, not on the same tile as the first one. Also, before going to state close you should be checking whether the action is action OPENING; you don't want it to loop the action CLOSING animation.

Good rule of thumb: if you are having trouble getting an animation to display, test the animation by itself before adding the animation to other code. More generally: when code isn't working and you can't figure out why, isolate the problem by testing individual components of the code. If you don't understand the individual components well enough to test them, then expect problems when you put them together.
1

User is offline   FezGuy 

#2001

Hi! Is there a way to add variety to the enemy sounds recognizing the player?

I'm creating human enemies. Instead of the enemies growling I want them to just say a few taunting lines. But I don't want them to say "Hey!" every time they see the player. It would get annoying and if I made each type of enemy say something different it would still get repetitive after awhile. It would be nice to get the trooper to say a random set of five lines so it has variety throughout the map. Same with the pig cop and lizard chain gunner guy., etc.

Is it just a line of code to add? I know how to define sounds in the game and know a little bit about .con files. Sometimes it's a matter of changing values. But this seems a little more detailed. Anybody have ideas?
0

User is offline   Kyanos 

#2002

That's a fairly easy task. If you quickly browse through GAME.CON you will find exactly what you're looking for, except it's for Dukes one liners. Look for jibbed actor sound.

To sum up, instead of playing the recog sound, you would use rand to generate a number then if statements that check the random number to determine which sounds to play.
0

User is online   Danukem 

  • Duke Plus Developer

#2003

View PostDrek, on 30 June 2017 - 12:30 AM, said:

That's a fairly easy task. If you quickly browse through GAME.CON you will find exactly what you're looking for, except it's for Dukes one liners. Look for jibbed actor sound.

To sum up, instead of playing the recog sound, you would use rand to generate a number then if statements that check the random number to determine which sounds to play.


He's going to have a problem if he is using the default enemy tile numbers (PIGCOP, LIZMAN, etc.). The game is hardcoded to play their RECOG sounds when those enemies appear -- there is no CON code for him to edit. So, before he can even do what you suggest, he either has to replace the sounds on the recog sound numbers with null sounds, or write code that detects playback of the recog sounds, stops them and then plays a different random sound.
0

User is offline   Hendricks266 

  • Weaponized Autism

  #2004

With EVENT_SOUND you can intercept and replace sounds by checking and setting RETURN.
0

User is offline   David B. 

#2005

After some work I finally managed to make a well-functioning script for an operable door sytem (rotating or whatsoever) in both directions.
I have chosen to add tiles for the closing animation in the model instead of using backward animation in the script.

I'm posting it in case someone else would be interested by the script. Here's the feedback :

action OPENING 1 8 1 1 0
action CLOSING 10 8 1 1 0

useractor notenemy OPERABLE_DOOR1

ifaction 0 ifpdistl 1800 ifcansee ifhitspace {
    soundonce 450
    action OPENING
    cstat 0
}

ifactioncount 30 ifaction OPENING ifpdistl 1800 ifcansee ifhitspace { 
    soundonce 455
    action CLOSING
    cstat 1
}

ifactioncount 30 ifaction CLOSING ifpdistl 1800 ifcansee ifhitspace { 
    soundonce 450
    action OPENING
    cstat 0
}
enda 

Thank you guys.

This post has been edited by David B.: 01 July 2017 - 11:21 AM

0

User is offline   David B. 

#2006

Hi everyone

Is it possible to control a point light (SE49) with a script ? I need a way to light up a room with real light source, when a switch is used.
0

User is offline   Mark 

#2007

Switch controlled lights are one of the many features of a mod by High Treason called CONfetti. A search in the forums should take you to the thread. There may even be a YT video showcasing it.

This post has been edited by Mark.: 25 July 2017 - 11:44 AM

1

User is offline   David B. 

#2008

I've tested it, that's what I was looking for... ok thanks.
0

User is offline   David B. 

#2009

Hi everyone

How to control a SE (SE12 in my case for controlling the lighting of a room) with a custom light switch model ? (I know how to do for activators but I haven't found nothing for SE).
In fact I need a model because it must also execute other stuffs like change the picnum of the wall-light model (5439 to 5440, the last being defined with a glow map when the room is bright).

eventloadactor SWITCH
    getactor[THISACTOR].lotag SPRITE_LOTAG  // = SECTOR EFFECTOR CHANNEL
    setactor[THISACTOR].lotag 0
enda

useractor notenemy SWITCH
    [...]

    ifvare MODE 1 ifhitspace ifcansee {    // MODE 1 being conditions like facing it, being close to it, ... don't worry.
         operatemasterswitches SPRITE_LOTAG  // Is there a right command for what I want ?
    // OR :
         operateactivators SPRITE_LOTAG 0 // doesn't work neither as SE is not an activator of course;)
    }
 enda



-Subsidiary issue : is it possible to activate a glow map on a model directly by a script instead of defining two wall-light models and switching their picnum ?

This post has been edited by David B.: 01 August 2017 - 07:59 AM

0

User is offline   Mark 

#2010

Make the lamp model with a 2 frames. Frame 1 will have the dark lens surface in front. Frame 2 will have the bright lens surface in front. In frame 1 the bright lens will be shrunk and behind the dull lens. In frame 2, the opposite. The dark lens will be behind the bright one. Then use your code of your choice for which frame will display. Its like how muzzle flashes are shrunk and hidden inside the mesh until they are needed.

This post has been edited by Mark.: 01 August 2017 - 10:01 AM

0

Share this topic:


  • 115 Pages +
  • « First
  • 65
  • 66
  • 67
  • 68
  • 69
  • 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