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

Jump to content

  • 115 Pages +
  • « First
  • 76
  • 77
  • 78
  • 79
  • 80
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

#2311

I have a question regarding modding masked walls. I want to replace the regular waterfalls with a new animation so I use this:


onevent EVENT_ENTERLEVEL
{
	setvar w_wall_number 0
	whilevarvarn w_wall_number NUMWALLS		{
		getwall[w_wall_number].picnum w_wall_picnum
		ifvare w_wall_picnum 889 {
			setwall[w_wall_number].picnum 7224
		}
		addvar w_wall_number 1
	}
} 
endevent


However, this does not cover masked walls. Wat do?
0

User is offline   Danukem 

  • Duke Plus Developer

#2312

Just use an animated texture and you won't have to mess with code at all.
0

#2313

View PostTrooper Dan, on 03 September 2018 - 03:17 AM, said:

Just use an animated texture and you won't have to mess with code at all.


Does this work when attempting to replace a 4 frame animation with a more-than-4 frame animation (e.g. 8)?
0

User is offline   Danukem 

  • Duke Plus Developer

#2314

View PostDecember Man, on 03 September 2018 - 01:01 PM, said:

Does this work when attempting to replace a 4 frame animation with a more-than-4 frame animation (e.g. 8)?


Are you saying there aren't enough spaces in the art file to put your new animation without bumping into some other existing tiles? Then that's a problem. What happens when you make your loop replace overpicnum as well as picnum?
1

#2315

View PostTrooper Dan, on 03 September 2018 - 01:10 PM, said:

Are you saying there aren't enough spaces in the art file to put your new animation without bumping into some other existing tiles? Then that's a problem. What happens when you make your loop replace overpicnum as well as picnum?


Well damn, haven't thought about doing it like this. It works! Thank you very much!

This post has been edited by December Man: 03 September 2018 - 02:05 PM

0

User is online   Mark 

#2316

I want to add a lean to some 3D models. According to the wiki there are various commands such as pitch and roll but no example on how to use them. I tried a couple of ways in cons with no success.

Then I had the bright idea that those commands are probably used in the maphacks files. Sure enough, there they are. So I created a MYPROJECT.MHK file and entered in the line "sprite 6673 pitch 128" . I wasn't sure if maphack files need to be called so I typed "include MYPROJECT.MHK at the top of GAME.CON

When run I get an con error message. "expected a keyword but found sprite"

How does one implement pitch, roll and the other similar commands?

Also, for sprite ID is pitch looking for the ID from Mapster or the ID from DEFS.CON? I'm assuming from mapster

This post has been edited by Mark: 07 September 2018 - 01:44 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#2317

View PostMark, on 07 September 2018 - 01:38 PM, said:

I want to add a lean to some 3D models. According to the wiki there are various commands such as pitch and roll but no example on how to use them. I tried a couple of ways in cons with no success.


I don't know what went wrong, but you just set the .pitch and .roll members of the sprite struct to the values you want, either with numbers or gamevars.

https://wiki.eduke32.../Model_rotation

So for example seta[].pitch 512 would make the actor face plant.
1

User is online   Mark 

#2318

Thanks.

This once again points out the severe lack of simple examples for entries. For instance, your example shows that the model to manipulate must be made an actor. Not mentioned in the wiki. Noob coders are not going to automatically know that like the experienced coder does. And since the only example I could find of that command was in a maphack file that was simply: "sprite 6673 pitch 128" I naturally figured thats how to use it. Now I know better.
0

User is offline   Danukem 

  • Duke Plus Developer

#2319

View PostMark, on 07 September 2018 - 04:45 PM, said:

This once again points out the severe lack of simple examples for entries. For instance, your example shows that the model to manipulate must be made an actor. Not mentioned in the wiki. Noob coders are not going to automatically know that like the experienced coder does.


You can set the structs on any sprite in the game, it doesn't have to be an actor. I think the real issue here is that people look up individual pages that assume knowledge of how to use sprite structs, without knowing how to use sprite structs. Ideally, the novice CON coder has already read this page first:

https://wiki.eduke32...tructure_access

But it's not desirable to have tutorials on structure access in every entry about a sprite struct. That would make the entries bloated and hard to read, not to mention it would be a ton of work. The correct solution is to have the wiki organized in such a way that the novice has a clear order to read stuff in so they get all the basics. In theory, the novice would come here first and work their way through most of that page.
0

User is online   Mark 

#2320

I learn better by example. I'm resigned to the fact I will never get so heavily into con coding as you or other "master coders". I haven't the patience. I'm certainly not a role model for other new coders. I will find an example in the wiki or other people's code. With it in front of me I have a much easier time figuring why it works and how to adapt it to what I need. Reading something that looks like techno-babble without a real world example in the wiki frustrates me.
0

#2321

Does someone have some code that teleports monsters close to the player consistently? And how do I make sure you can't pick up handbombs (a single pipe, be it your own or another player's)?

This post has been edited by thisbecasper: 18 September 2018 - 10:00 AM

0

User is offline   Zaxtor 

#2322

I think AMC mod has some code that those floating cultists teleports near or close of you.
Dunno the code but I know what you mean.
I'm trying to find out how is done.

if I find out ill let u know
I'm sure someone with more knowledge on things teleporting near players will help

This post has been edited by Zaxtor: 18 September 2018 - 11:59 AM

1

User is offline   Perro Seco 

#2323

I've got a complicated question:

Posted Image

I want those two sprites to stay with the player. If he moves, they move with him, and if he rotates, they also rotate, but always keeping the same distance. Is this something possible to do?
0

User is online   Mark 

#2324

I don't know how but it can be done. I'm pretty sure thats how the flashlight in the Graveyard TC works or the player light in DukePlus. Search for Darkus's original flashlight code on the forum. It may give you a hint on how its done.
1

User is offline   Hendricks266 

  • Weaponized Autism

  #2325

defstate doangle
    getactor[THISACTOR].ang temp
    setactor[actor0].ang temp
    setactor[actor1].ang temp

    addvar temp 512 // rotate angle 90 degrees
    cos x temp
    sin y temp

    mulscale x2 radius x 14
    mulscale y2 radius y 14

    getactor[THISACTOR].x temp
    addvarvar temp x2
    setactor[actor0].x temp
    getactor[THISACTOR].y temp
    addvarvar temp y2
    setactor[actor0].y temp

    getactor[THISACTOR].x temp
    subvarvar temp x2
    setactor[actor1].x temp
    getactor[THISACTOR].y temp
    subvarvar temp y2
    setactor[actor1].y temp
ends


There may be more steps for the motion to look correct in relation to movement interpolation.
3

User is offline   Perro Seco 

#2326

Thank you both for your help! I'll try both solutions.
0

User is offline   Danukem 

  • Duke Plus Developer

#2327

View PostPerro Seco, on 24 September 2018 - 02:17 PM, said:

Thank you both for your help! I'll try both solutions.


The other solution that Mark referred to makes use of of the rotatepoint command; the results should be equivalent.

You have 3 choices with regard to how the side-sprites will appear to move: jumpy (current solutions), smooth, or smooth and laggy. The reason they will appear jumpy right now is that they are being teleported 30 times per second, but otherwise not moving. Whereas the player and other sprites get movement interpolation in between tics (that's what Hendricks266 was referring to.) I don't know how you would give them proper interpolation and also make them keep up with the player. An improper but proven way to do it is to set their t-sprites based on camera coordinates in a display event, in addition to setting their actual sprites in actor code.
0

#2328

DELETED

This post has been edited by thisbecasper: 25 September 2018 - 07:34 AM

0

User is offline   Perro Seco 

#2329

View PostTrooper Dan, on 24 September 2018 - 05:08 PM, said:

You have 3 choices with regard to how the side-sprites will appear to move: jumpy (current solutions), smooth, or smooth and laggy. The reason they will appear jumpy right now is that they are being teleported 30 times per second, but otherwise not moving. Whereas the player and other sprites get movement interpolation in between tics (that's what Hendricks266 was referring to.) I don't know how you would give them proper interpolation and also make them keep up with the player. An improper but proven way to do it is to set their t-sprites based on camera coordinates in a display event, in addition to setting their actual sprites in actor code.
I know this sounds surrealist, but I'm not interested in the sprites, but rather in their positions. In my TC I use Lezing's motorbike code (the same used in DNF 2013) to make drivable cars, but everytime I exit one, the player spawns just in the middle of it (player position = car position). I said I wanted to keep the sprites with the player because I thought the code provided would be useful to know those two positions everytime he exits the car, so you can move him to the left or, if there's a wall, to the right side of the car.

I think I almost got what I want, but now I'm unable to change the player's position. I'm using setplayer[THISACTOR].posx and posy, but it doesn't seem to affect the position. Do I need something more or something completely different to change the position?
0

User is offline   Danukem 

  • Duke Plus Developer

#2330

View PostPerro Seco, on 29 September 2018 - 06:50 AM, said:

I said I wanted to keep the sprites with the player because I thought the code provided would be useful to know those two positions everytime he exits the car, so you can move him to the left or, if there's a wall, to the right side of the car.


If that's all you need, then don't make extra sprites and don't do the calculations all the time. Just do the calculation once when the player exits the vehicle and move the player to those coordinates.

View PostPerro Seco, on 29 September 2018 - 06:50 AM, said:

I think I almost got what I want, but now I'm unable to change the player's position. I'm using setplayer[THISACTOR].posx and posy, but it doesn't seem to affect the position. Do I need something more or something completely different to change the position?


Changing the player coordinates is usually all you need for changing the player's actual position. It's better if you also update the player's sector, in case the new coordinates are in a new sector. You can feed your new coordinates into the updatesector or updatesectorz command, then set the player's cursectnum to the outputed sector (but don't set it if the output is -1 for some reason).

As for why it's not working when you set posx and posy, it could be because you aren't setting the sector but I think it's more likely something else which is blocking your attempt. The first thing I would check is make sure that Lezing's bike code is not setting the player's coords at that point, since it could be overriding your attempt. Also, you should verify 100% that you have calculated the new coordinates correctly. You can do a visual confirmation by espawning a sprite there and setting it to those coordinates; do so in F7 view mode so that you can see it in game and verify it is in the right place.
1

#2331

Is there a way to have dynamic music i.e. music that changes depending on the room the player is in?
Also, the same thing but with messages displaying the name of the room the player has entered?
0

User is offline   Danukem 

  • Duke Plus Developer

#2332

For those kinds of effects you should make your own effect sprites, similar to sector effectors. The sprites would have vars on them, which are loaded from tags in the map. The vars would control their use of commands such as starttrackvar and quote. There are many examples of this from different mods -- it's not particularly difficult but I don't plan to write a tutorial.
1

User is offline   Danukem 

  • Duke Plus Developer

#2333

As an aside, I hope this doesn't offend anyone but I've noticed something about a lot of CON scripting questions. A lot of questions are of the form "Is it possible to do X?" but what they really mean is "Is there a command to do X?"

CON does have a huge number of commands which often do complex things. Want some money sprites to spawn and float realistically to the ground? Easy: use the money command. Want to make an earthquake? Easy: use the quake command. And so on. Those sorts of commands are like a vending machine -- you just press the right button and the thing you want comes out, already packaged for you. But in addition to the vending machine, CON also has a kitchen fully stocked with raw ingredients where you can make pretty much anything you want.

I think some people get caught up on the convenience of the vending machine and never learn how to cook. If you are making a mod that has non-trivial coded features, you should learn how to cook.
4

#2334

View PostTrooper Dan, on 30 September 2018 - 03:18 PM, said:

I think some people get caught up on the convenience of the vending machine and never learn how to cook. If you are making a mod that has non-trivial coded features, you should learn how to cook.

Programming can be a very scary thing for some people. I've seen professional designers get scared, looking at scripting systems like Lua, but work just fine in a visual script language such as UE4 Blueprint. CON coding can be intimidating for people that want to do design work.

Is there a library somewhere with a bunch of general use CON script functions, that anyone can just grab and include in there projects? I've seen people put some fantastic things together, when they have something just above "raw ingredients".

This post has been edited by icecoldduke: 30 September 2018 - 04:34 PM

1

User is offline   Danukem 

  • Duke Plus Developer

#2335

View Posticecoldduke, on 30 September 2018 - 04:30 PM, said:

Is there a library somewhere with a bunch of general use CON script functions, that anyone can just grab and include in there projects? I've seen people put some fantastic things together, when they have something just above "raw ingredients".


No, there should be a library like that, but there isn't. So each of us who has done a lot of scripting has essentially built our own library. One complication is that CON does not allow local variables. So, if my function uses a variable named "TEMPVAR", then it won't compile in your project unless you have a variable of that same name. I could include the variable declaration with my provided function, but then your project will have that global variable in it, just because you use my function. Worse, you might already have a variable of that name but with different flags, so it will actually conflict and not work the same. Another issue we used to have is that you couldn't append new event code. So, if I wanted to share something cool to do in EVENT_GAME, the user would have to know how to integrate it with any existing EVENT_GAME code they may have.

Given the obstacles and how few people are using the scripting language at any given time, it just never seemed worth it to try to make a public library.
0

User is online   Mark 

#2336

Over the years I have collected bits and pieces of code examples from the threads here. My plan was to some day clean them up and add a lot of comments to the lines for explanations. Then add them to the handful of existing ones in the wiki. I have 83 files in that folder right now. I really should get going on that. :rolleyes:
2

User is offline   MC84 

#2337

View PostMark, on 30 September 2018 - 07:08 PM, said:

Over the years I have collected bits and pieces of code examples from the threads here. My plan was to some day clean them up and add a lot of comments to the lines for explanations. Then add them to the handful of existing ones in the wiki. I have 83 files in that folder right now. I really should get going on that. :rolleyes:


Man that would be awesome - I've been trying to get my head around CON coding these last few weeks and I'm finding the learning curve VERY steep!
1

User is offline   Forge 

  • Speaker of the Outhouse

#2338

View Postconoklast, on 30 September 2018 - 07:31 PM, said:

Man that would be awesome - I've been trying to get my head around CON coding these last few weeks and I'm finding the learning curve VERY steep!

i wouldn't even try to figure out con aside from changing sounds & episodes/maps. Some of the effects people pull off are pretty amazing.

Gotta be dedicated to learn it.
The major downside to me seems like eduke32 updates are always inadvertently breaking things. Pretty good deterrent for someone with a lack of patience.

This post has been edited by Forge: 30 September 2018 - 07:48 PM

1

User is online   Mark 

#2339

A lot of my snippets of code are for simple things like that.
0

User is offline   Forge 

  • Speaker of the Outhouse

#2340

If there isn't a con wiki, there should be

nvm, I did not know this existed

http://wiki.eduke32.com/wiki/Scripting

people should read this & the references first, & show the code they tried to use - before they ask questions

I can kinda see Dan's point now. Asking "how do I...", instead of, "I did...but I didn't get the results I wanted" are two different things.

Almost reminds me of those people that used to randomly show up and declare some massive project and wanting everyone to join - to do all the work for them so they can sit back and see their vision come to life with zero effort on their part.

This post has been edited by Forge: 30 September 2018 - 08:02 PM

0

Share this topic:


  • 115 Pages +
  • « First
  • 76
  • 77
  • 78
  • 79
  • 80
  • 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