Duke4.net Forums: Flying cars - Duke4.net Forums

Jump to content

Hide message Show message
Welcome to the Duke4.net Forums!

Register an account now to get access to all board features. After you've registered and logged in, you'll be able to create topics, post replies, send and receive private messages, disable the viewing of ads and more!

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Flying cars

User is offline   darkcaleb 

  • 91

#1

Does anybody know where i could get the code for flying cars and explain a little bit how and where i should put the code because i pretty much a rookie if we talk about con coding so. O yeah BTW the cars are models so just to be sure for what i'm asking!

!This Is The Record Of My Nightmares! Keep a Watch At ---> http://jerichoprojects.blogspot.nl/
0

User is offline   Drek 

  • 1,087

#2

You won't really find any "code for flying cars" that you can plug into a mod. Most of the mods that have vehicles use con tricks and feats of coding skill that are pretty complex. For reference DukePlus has the skycar and motorcycle, there is a bike in the 2013 DNF also. I would read those and see how they have manipulated the player view, hud, and so much other stuff. You would need to understand how it works to build a similar system into your own mod. It's not a rookie task, but not overly difficult.
0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 1,888

#3

View Postdarkcaleb, on 02 February 2017 - 02:21 PM, said:

Does anybody know where i could get the code for flying cars


What flying cars are you talking about?
0

User is offline   darkcaleb 

  • 91

#4

View PostTrooper Dan, on 02 February 2017 - 10:16 PM, said:

What flying cars are you talking about?


Oh sorry my bad :sweat: I was talking more about the flying cars that you have seen in AMC mod, you know those that fly in the background.

!This Is The Record Of My Nightmares! Keep a Watch At ---> http://jerichoprojects.blogspot.nl/
0

User is offline   blizzart 

  • 146

#5

View Postdarkcaleb, on 03 February 2017 - 04:45 AM, said:

Oh sorry my bad :sweat: I was talking more about the flying cars that you have seen in AMC mod, you know those that fly in the background.


That must be simple trains where the sprites are moving with them.
0

User is offline   darkcaleb 

  • 91

#6

View Postblizzart, on 03 February 2017 - 06:34 AM, said:

That must be simple trains where the sprites are moving with them.



Yeah something like that. If you played the amc mod you will now what kind of flying cars i am talking about. These are cars that go from one place to another.(A>------------------->B) or from (B>------------------->A) depends on how you see it.

!This Is The Record Of My Nightmares! Keep a Watch At ---> http://jerichoprojects.blogspot.nl/
0

User is offline   Jblade 

  • 1,384

#7

View Postblizzart, on 03 February 2017 - 06:34 AM, said:

That must be simple trains where the sprites are moving with them.

No they're not, they're just coded in to fly in a straight line when spawned.

darkcaleb; you can look inside AMCEXTRA.CON and the code for the flying cars is somewhere in there. You're welcome to use any code that's helpful.
1

User is offline   darkcaleb 

  • 91

#8

View PostJblade, on 05 February 2017 - 12:10 AM, said:

No they're not, they're just coded in to fly in a straight line when spawned.

darkcaleb; you can look inside AMCEXTRA.CON and the code for the flying cars is somewhere in there. You're welcome to use any code that's helpful.



Thanx James, hmmm.. is it possible right with 3d models? And do i need to delete certain things about the con or?
I made a con file and just with 3 of 4 sprites wich are models, i want use as simple as possible? Anybody who can explain to me what i need and what i don't.. because i haven't played much with con coding yet.

And I included HOVERCAR.con in Game.con!

Attached File(s)



!This Is The Record Of My Nightmares! Keep a Watch At ---> http://jerichoprojects.blogspot.nl/

This post has been edited by darkcaleb: 05 February 2017 - 12:39 PM

0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 1,888

#9

@darkcaleb: I'm not looking at the code but I can tell you that using models for the cars should not require you to change anything about the CON code. Just keep in mind that they will appear and disappear based on what the code says, so if the model dimensions do not match the sprite, you may see them appearing/disappearing too soon or too late, if you know what I mean.
0

User is offline   darkcaleb 

  • 91

#10

View PostTrooper Dan, on 05 February 2017 - 04:04 PM, said:

@darkcaleb: I'm not looking at the code but I can tell you that using models for the cars should not require you to change anything about the CON code. Just keep in mind that they will appear and disappear based on what the code says, so if the model dimensions do not match the sprite, you may see them appearing/disappearing too soon or too late, if you know what I mean.



Well this is what been getting as an error:

warning: case mismatch: passed "HOVERCAR.CON", real "HOVERCAR.con"
Including: HOVERCAR.CON (2807 bytes)
HOVERCAR.CON: In state `SPAWNHOVERCAR':
HOVERCAR.CON:8: error: symbol `TEMP7' is not a game variable.
HOVERCAR.CON:9: error: symbol `TEMP7' is not a game variable.
HOVERCAR.CON:10: error: symbol `TEMP7' is not a game variable.
HOVERCAR.CON:11: error: symbol `TEMP7' is not a game variable.
HOVERCAR.CON:13: error: symbol `LOTAGSAVED' is not a game variable.
HOVERCAR.CON:17: error: symbol `TEMP' is not a game variable.
HOVERCAR.CON:17: error: expected a keyword but found `etactor'.
HOVERCAR.CON:17: error: expected a keyword but found `'.
HOVERCAR.CON:17: error: expected a keyword but found `'.
GAME.CON:32: error: parameter `ANULLACTION' is undefined.
GAME.CON:32: error: expected a keyword but found `0'.
Found 0 warning(s), 11 error(s).
Yes
Compiling: GAME.CON (151190 bytes)
Including: DEFS.CON (35992 bytes)
Including: USER.CON (45482 bytes)
GAME.CON:31: error: parameter `ANULLACTION' is undefined.
GAME.CON:31: error: expected a keyword but found `0'.
Found 0 warning(s), 2 error(s).
Error compiling CON files.

!This Is The Record Of My Nightmares! Keep a Watch At ---> http://jerichoprojects.blogspot.nl/
0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 1,888

#11

Looks like you didn't declare the gamevars used by the code.

Try adding these lines to the top:

gamevar LOTAGSAVED 0 2
gamevar TEMP7 0 0
gamevar TEMP 0 0
action ANULLACTION

Keep in mind that you are pasting in code (no I'm not looking at it) from one file that was part of a set of different CONs; declarations and possibly other code from other files in the set might be needed to make it work.
0

User is offline   Mark. 

  • Honored Donor
  • 1,648

#12

I took a quick look at the code and I think its going to need even more. There is an action and a state being called that are not defined in that small chunk of code he is using. Someone with more knowledge could double check that.
0

User is offline   darkcaleb 

  • 91

#13

Well let me explain what i have in my folder:
*This con is a copy of the one from AMC 2 mod.
*I have put a include HOVERCAR.CON in the GAME.CON file
*I'm trying to use 3d models instead of sprites.
*i not using any other con codes at this moment so, this is the only one.
*The rotation of sprites is not needed because yes, i'm using 3d models.
*And i'm trying to make use of more than one model because you don't want to see
the same thing the whole time.Variation in more cars will be needed.


Maybe i have missed something out? And this this first time i'm using con coding. This is important aspect of
the map because it would look to empty without it.

!This Is The Record Of My Nightmares! Keep a Watch At ---> http://jerichoprojects.blogspot.nl/
0

User is offline   Mark. 

  • Honored Donor
  • 1,648

#14

The reason you are having problems is because parts of the code you need are in other con files. There are small chunks of code that will be used multiple times. So instead of duplicating the code every time you need it, that code can be placed just once and have other code call for it. My guess is you are missing that code that is placed somewhere else.

This post has been edited by Mark.: 06 February 2017 - 04:28 PM

0

User is offline   darkcaleb 

  • 91

#15

View PostMark., on 06 February 2017 - 04:26 PM, said:

The reason you are having problems is because parts of the code you need are in other con files. There are small chunks of code that will be used multiple times. So instead of duplicating the code every time you need it, that code can be placed just once and have other code call for it. My guess is you are missing that code that is placed somewhere else.


Yeah i thought about that before but my guess was on what james told me to do. I'll need to look again hopefully to find something.

!This Is The Record Of My Nightmares! Keep a Watch At ---> http://jerichoprojects.blogspot.nl/
0

User is offline   darkcaleb 

  • 91

#16

So thank God i finally got the code working and is it working perfecly. Now I just need to know one only
thing. These hover or flying cars need to hit the player if you are being close to them. Does anybody know
wich part of the code you need to make this work. I only need this and after this hopefully the little project is done.

!This Is The Record Of My Nightmares! Keep a Watch At ---> http://jerichoprojects.blogspot.nl/
0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 1,888

#17

View Postdarkcaleb, on 25 February 2017 - 11:03 AM, said:

So thank God i finally got the code working and is it working perfecly. Now I just need to know one only
thing. These hover or flying cars need to hit the player if you are being close to them. Does anybody know
wich part of the code you need to make this work. I only need this and after this hopefully the little project is done.


You could try copying the code that the bosses use to kill the player if he gets too close. But you will want to set the half-submerged (128) flag on the car cstat in that case, if it isn't set already. That's because ifpdistl is based on distance from the base of the sprite/model, so using it without that flag will result in the bottom and a little below the car being deadly and the upper half not.
0

User is offline   darkcaleb 

  • 91

#18

View PostTrooper Dan, on 25 February 2017 - 09:03 PM, said:

You could try copying the code that the bosses use to kill the player if he gets too close. But you will want to set the half-submerged (128) flag on the car cstat in that case, if it isn't set already. That's because ifpdistl is based on distance from the base of the sprite/model, so using it without that flag will result in the bottom and a little below the car being deadly and the upper half not.


Well i tried but not getting any results back. This pretty much the code i have gotten from James:
//
// ------------------------------------------------------------
// IW HOVERTRAIN SPAWNER
// ------------------------------------------------------------
//

action HOVERT 0 1 1 1 1

move HOVERTMOVE 1500 0

useractor notenemy 5607
sizeat 70 70
action HOVERT
move HOVERTMOVE geth
ifnotmoving killit
enda

useractor notenemy 5608
cstat 32768


ifcount 600
{
ifrnd 4
{
espawn 5607
ifrnd 96 setactor[RETURN].pal 21
else ifrnd 96 setactor[RETURN].pal 11
resetcount
}
}
enda

This is meant for a train that needs to hit the player and killing him in the proces. Btw i'm still learning con coding but it's going very slow so :mellow:

!This Is The Record Of My Nightmares! Keep a Watch At ---> http://jerichoprojects.blogspot.nl/
0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 1,888

#19

OK, so here's the code for the actor currently:

action HOVERT 0 1 1 1 1

move HOVERTMOVE 1500 0

useractor notenemy 5607
sizeat 70 70
action HOVERT
move HOVERTMOVE geth
ifnotmoving killit
enda


I'm trying to figure out why it even moves at all, because you are constantly setting it to "move HOVERTMOVE geth", which should be resetting its velocity every tic. I will guess that it moves much more slowly than 1500 as a result; if not, just raise that number back up.

action HOVERT 0 1 1 1 1

move HOVERTMOVE 1000

useractor notenemy 5607
ifmove 0
{
  sizeat 70 70
  cstator 128
  action HOVERT
  move HOVERTMOVE geth
}

ifnotmoving killit

ifp palive
  ifpdistl 1280
{
  addphealth -1000
  sound SQUISHED
  palfrom 63 63
}
enda


When you use this code, you will want to raise the spawns a few pageups higher in the map, becuase the cars will appear to be lower, as I explained in my previous post.
0

User is offline   darkcaleb 

  • 91

#20

View PostTrooper Dan, on 26 February 2017 - 11:18 AM, said:

OK, so here's the code for the actor currently:

action HOVERT 0 1 1 1 1

move HOVERTMOVE 1500 0

useractor notenemy 5607
sizeat 70 70
action HOVERT
move HOVERTMOVE geth
ifnotmoving killit
enda



I'm trying to figure out why it even moves at all, because you are constantly setting it to "move HOVERTMOVE geth", which should be resetting its velocity every tic. I will guess that it moves much more slowly than 1500 as a result; if not, just raise that number back up.

action HOVERT 0 1 1 1 1

move HOVERTMOVE 1000

useractor notenemy 5607
ifmove 0
{
  sizeat 70 70
  cstator 128
  action HOVERT
  move HOVERTMOVE geth
}

ifnotmoving killit

ifp palive
  ifpdistl 1280
{
  addphealth -1000
  sound SQUISHED
  palfrom 63 63
}
enda


When you use this code, you will want to raise the spawns a few pageups higher in the map, becuase the cars will appear to be lower, as I explained in my previous post.


Hey thanx! Still a problem with getting it fuctional, and getting error in the eduke32.txt

Compiling: GAME.CON (151236 bytes)
Including: DEFS.CON (36779 bytes)
Including: USER.CON (46766 bytes)
Including: HOVERCAR.CON (834 bytes)
Including: HOVERTRAIN.CON (450 bytes)
GAME.CON: In actor `ORGANTIC':
GAME.CON:3969: warning: found `else' with no `if'.
GAME.CON: In state `pigshootenemystate':
GAME.CON:5892: warning: found `else' with no `if'.
Found 2 warning(s), 0 error(s).

Just to give a insite of what is inside the project. The code I send ya was a copy of the original with a few tweaks.(Check the file)
This has a purpose for a train that comes back around every 20 sec maybe. So you have hovercars and a hovertrain. I used the almost the same method as the AMC mod.
O yeah just to let you know if it's possible to have a sound attached to the train when it come around? That is pretty much it.

Attached File(s)



!This Is The Record Of My Nightmares! Keep a Watch At ---> http://jerichoprojects.blogspot.nl/

This post has been edited by darkcaleb: 26 February 2017 - 01:30 PM

0

User is online   Trooper Dan 

  • Duke Plus Developer
  • 1,888

#21

The CON warnings you posted are original to the game and are not caused by my code.
0

User is offline   darkcaleb 

  • 91

#22

View PostTrooper Dan, on 26 February 2017 - 01:37 PM, said:

The CON warnings you posted are original to the game and are not caused by my code.



Done and fixed the con and it worked! :D Thanx allot :dukeaffirmative: Just one last thing if it possible because i think i'm almost done here with the project. Where do i put a sound for the train so can hear it coming? Maybe this little project will be done somewhere this upcoming week!

!This Is The Record Of My Nightmares! Keep a Watch At ---> http://jerichoprojects.blogspot.nl/
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks are property of their respective owners and all comments are owned by their posters. Yes, our forum uses cookies. © 2004-2017 Duke4.net and Voidpoint, LLC

Enter your sign in name and password


Sign in options