Home : Downloads : Forums : Contact Us Copyright

AMC Web Forums

  • April 22, 2019, 11:04:10 PM *
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4 5

Author Topic: (Eduke) example code archive  (Read 50351 times)

Trooper Dan

  • Mario Nukem Team
  • Member
  • Offline Offline
  • Posts: 4243
  • EDuke32 Special Forces -- Code Ops
    • MSN Messenger - deeper-thought@hotmail.com
    • View Profile
    • Email
Re: (Eduke) example code archive
« Reply #30 on: May 22, 2007, 09:42:33 PM »
James, you should edit that to add a define for NORMALSIZE and a declaration for the var adr (or you could just replace 'adr' with '0').
Logged
"Democracy never lasts long. It soon wastes, exhausts and murders itself. There was never a democracy that did not commit suicide." John Adams


Fissile Materials

James

  • Administrator
  • Member
  • Offline Offline
  • Posts: 13876
    • MSN Messenger - Jstanf36@ntlworld.com
    • View Profile
    • WWW
    • Email
Re: (Eduke) example code archive
« Reply #31 on: May 22, 2007, 09:46:03 PM »
James, you should edit that to add a define for NORMALSIZE and a declaration for the var adr (or you could just replace 'adr' with '0').
You're right, those 2 things completely slipped my mind :) thanks (y)
Logged

James

  • Administrator
  • Member
  • Offline Offline
  • Posts: 13876
    • MSN Messenger - Jstanf36@ntlworld.com
    • View Profile
    • WWW
    • Email
Re: (Eduke) example code archive
« Reply #32 on: May 23, 2007, 02:38:25 AM »
Just realised there was something else I missed; when you had the pipebomb remote out it showed 0 ammo since it was trying to show ammo for the current weapon - it now shows the ammo you have for the pipebomb :)
Logged

Trooper Dan

  • Mario Nukem Team
  • Member
  • Offline Offline
  • Posts: 4243
  • EDuke32 Special Forces -- Code Ops
    • MSN Messenger - deeper-thought@hotmail.com
    • View Profile
    • Email
Re: (Eduke) example code archive
« Reply #33 on: May 24, 2007, 09:37:05 AM »
Just realised there was something else I missed; when you had the pipebomb remote out it showed 0 ammo since it was trying to show ammo for the current weapon - it now shows the ammo you have for the pipebomb :)

Oh, hahaha.  Watch out for the Mighty Boot as well.  You'll get some weird results displaying the ammo for that "gun".
Logged
"Democracy never lasts long. It soon wastes, exhausts and murders itself. There was never a democracy that did not commit suicide." John Adams


Fissile Materials

James

  • Administrator
  • Member
  • Offline Offline
  • Posts: 13876
    • MSN Messenger - Jstanf36@ntlworld.com
    • View Profile
    • WWW
    • Email
Re: (Eduke) example code archive
« Reply #34 on: May 25, 2007, 02:08:19 AM »
Quote from: DeeperThought
Oh, hahaha.  Watch out for the Mighty Boot as well.  You'll get some weird results displaying the ammo for that "gun".
I just tested it and it displayed 0 for me :)

I coded in the Blood Hud for NS (as an alternate selection to the original one - I've also recreated the Duke Nukem Advance and Duke Nukem 64 HUD as well) but it didn't fit well so I took it out. I don't want the work I did on it wasted so I'm releasing it here for anybody to use or at least play around with. The file includes the art as well as a GAME.CON file with the code in it so you can try it out right away.

Code: [Select]
// This defines 2 variables where temporary data can be stored
gamevar TEMP 0 2
gamevar TEMP2 0 2

// This number is the number you use to display a sprite at it's original size in rotatesprite
define NORMALSIZE 65536

onevent EVENT_DISPLAYREST
setuserdef[THISACTOR].screen_size 0 // This sets the player's screen size to it's biggest

rotatesprite 34 187 NORMALSIZE 0 5120 0 0 0 0 0 xdim ydim // HEALTH AND AMMO BOX
      rotatesprite 17 13 NORMALSIZE 0 5122 0 0 0 0 0 xdim ydim // ARMOUR BOX

      getplayer[THISACTOR].shield_amount TEMP // Gets the player's armour into a variable
      ifvarg TEMP 99 digitalnumber 5124 20 9 TEMP 0 10 0 0 0 xdim ydim else
      ifvarg TEMP 9  digitalnumber 5124 25 9 TEMP 0 10 0 0 0 xdim ydim else
    digitalnumber 6048 29 9 TEMP 0 10 0 0 0 xdim ydim
getactor[THISACTOR].extra TEMP // Gets the player's health into a variable
      ifvarg TEMP 99 digitalnumber 5124 21 183 TEMP 0 10 0 0 0 xdim ydim else
      ifvarg TEMP 9 digitalnumber 5124 26 183 TEMP 0 10 0 0 0 xdim ydim else
digitalnumber 5124 29 183 TEMP 0 10 0 0 0 xdim ydim // HEALTH NUMBER
ifvare currentweapon 10 // If the player has the Pipebomb trigger selected than get the amount of pipebomb ammo into TEMP
{
getplayer[THISACTOR].ammo_amount 5 TEMP
}
else
getplayer[THISACTOR].ammo_amount currentweapon TEMP // otherwise get the current weapon's ammo into TEMP
ifvarg TEMP 99 digitalnumber 5124 55 183 TEMP 0 0 0 0 0 xdim ydim else
ifvarg TEMP 9 digitalnumber 5124 59 183 TEMP 0 0 0 0 0 xdim ydim else
      digitalnumber 5124 63 183 TEMP 0 0 0 0 0 xdim ydim // Display the ammo amount
      rotatesprite 284 187 NORMALSIZE 0 5121 0 0 0 0 0 xdim ydim // INVENTORY BOX

getplayer[THISACTOR].got_access TEMP // Get the access card bit into TEMP
ifvarand TEMP 1 { rotatesprite 255 178 NORMALSIZE 0 2471 0 0 0 0 0 xdim ydim } // If the player has the blue card, display it
ifvarand TEMP 2 { rotatesprite 259 178 NORMALSIZE 0 2471 0 21 0 0 0 xdim ydim } // If the player has the red card, display it
ifvarand TEMP 4 { rotatesprite 264 178 NORMALSIZE 0 2471 0 23 0 0 0 xdim ydim } // If the player has the yellow card, display it

getplayer[THISACTOR].inven_icon TEMP
ifvarn TEMP 0 // If the player's inventory is 'active'
{
ifvare TEMP 1 // MEDKIT
{
rotatesprite 285 186 NORMALSIZE 0 2460 0 0 0 0 0 xdim ydim
getplayer[THISACTOR].firstaid_amount TEMP2
digitalnumber 3087 309 182 TEMP2 0 10 0 0 0 xdim ydim
}
ifvare TEMP 2 // STEROIDS
{
rotatesprite 285 186 NORMALSIZE 0 2469 0 0 0 0 0 xdim ydim
getplayer[THISACTOR].steroids_amount TEMP2
divvar TEMP2 4
digitalnumber 3087 309 182 TEMP2 0 10 0 0 0 xdim ydim
}
ifvare TEMP 3 // HOLODUKE
{
rotatesprite 285 186 NORMALSIZE 0 2470 0 0 0 0 0 xdim ydim
getplayer[THISACTOR].holoduke_amount TEMP2
divvar TEMP2 24
digitalnumber 3087 309 182 TEMP2 0 10 0 0 0 xdim ydim
}
ifvare TEMP 4 // JETPACK
{
rotatesprite 285 186 NORMALSIZE 0 2467 0 0 0 0 0 xdim ydim
getplayer[THISACTOR].jetpack_amount TEMP2
divvar TEMP2 16
digitalnumber 3087 309 182 TEMP2 0 10 0 0 0 xdim ydim
}
ifvare TEMP 5 // NIGHT VISION GOGGLES
{
rotatesprite 285 186 NORMALSIZE 0 2461 0 0 0 0 0 xdim ydim
getplayer[THISACTOR].heat_amount TEMP2
divvar TEMP2 12
digitalnumber 3087 309 182 TEMP2 0 10 0 0 0 xdim ydim
}
ifvare TEMP 6 // SCUBA GEAR
{
rotatesprite 285 186 NORMALSIZE 0 2468 0 0 0 0 0 xdim ydim
getplayer[THISACTOR].scuba_amount TEMP2
divvar TEMP2 64
digitalnumber 3087 309 182 TEMP2 0 10 0 0 0 xdim ydim
}
ifvare TEMP 7 // BOOTS
{
rotatesprite 285 186 NORMALSIZE 0 2463 0 0 0 0 0 xdim ydim
getplayer[THISACTOR].boot_amount TEMP2
divvar TEMP2 2
digitalnumber 3087 309 182 TEMP2 0 10 0 0 0 xdim ydim
}
}

endevent

As I said, if anybody wants to use it in their projects be my guest. As the picture shows it's not an exact recreation as I created a new box for armour, and put the keycards into one of the block slots where the armour types would be display in Blood. If you're making a mod you could use the remaining 2 to display whatever you want  (y)

[attachment deleted by admin]
Logged

DavoX

  • Guest
Re: (Eduke) example code archive
« Reply #35 on: May 25, 2007, 03:30:41 AM »
Lovely, Blood is right there at the top along with duke3d in my opinion  :ph34r:
Logged

Geoffrey

  • AMC Staff
  • Member
  • Offline Offline
  • Posts: 10709
  • elitist faggot
    • View Profile
    • Email
Re: (Eduke) example code archive
« Reply #36 on: May 27, 2007, 03:40:31 PM »
Something that might be of interest:

http://forums.3drealms.com/vb/showthread.php?p=540256#post540256

3dr forum user Devan released car, a sprite car that you can use for whatever map or mod you choose. It's still a bit buggy but a great start nonetheless :)
Logged
We'll build our own Tripods. Ours will have 4 legs...

DavoX

  • Guest
Re: (Eduke) example code archive
« Reply #37 on: May 27, 2007, 04:25:49 PM »
I wonder if there is any code to make a pickable item then become your melee weapon (substituting the quick kick slot) is it possible?
Logged

James

  • Administrator
  • Member
  • Offline Offline
  • Posts: 13876
    • MSN Messenger - Jstanf36@ntlworld.com
    • View Profile
    • WWW
    • Email
Re: (Eduke) example code archive
« Reply #38 on: May 28, 2007, 03:59:34 PM »
^ It's possible for sure, but this is the wrong topic for that :o

Here's a very basic inventory system I coded. The code's a few weeks old so I'm sure I could optimise it a bit, but it's already pretty good (in my opinion) You access the inventory by pressing look left - of course the inventory itself is useful, but that was beyond the scope of what I was doing. It was just practice to see if I could make an inventory system and I accomplished it, but rather than put the code to waste I'm releasing it incase anybody wants to put it in their projects. It shouldn't be difficult to make the objects useable at all.

[attachment deleted by admin]
« Last Edit: May 28, 2007, 04:02:19 PM by James »
Logged

James

  • Administrator
  • Member
  • Offline Offline
  • Posts: 13876
    • MSN Messenger - Jstanf36@ntlworld.com
    • View Profile
    • WWW
    • Email
Re: (Eduke) example code archive
« Reply #39 on: December 12, 2007, 07:10:23 AM »
I posted this in the DukePlus thread, but I'll repost it here self contained so you can just stick it into any game.con so it'll work right away.
Code: [Select]
//Stick this anywhere
gamevar EXTRASAVED 0 2
gamevar TEMP 0 2
gamevar TEMP2 0 2
gamevar TEMP3 0 2

//The following gets the camera's extra value into a variable, than sets it to 0 to avoid any possible glitches
eventloadactor CAMERA1 getactor[THISACTOR].extra EXTRASAVED setactor[THISACTOR].extra 0 enda

onevent EVENT_GAME
ifactor CAMERA1
{
getplayer[THISACTOR].newowner TEMP
ifvarvare TEMP THISACTOR
{
ifvare EXTRASAVED 1 // Delete this line if you want all cameras to be able to do this
{
getinput[THISACTOR].extbits TEMP2
ifvarand TEMP2 16 // If the player presses 'turn left'
{
getactor[THISACTOR].ang TEMP3 // Get the Camera's angle
subvar TEMP3 16 // Turn it left (subtracting from an angle turns it left)
setactor[THISACTOR].ang TEMP3 // Change it to the new value
}
ifvarand TEMP2 32 // If the player presses 'turn right'
{
getactor[THISACTOR].ang TEMP3 // Get the Camera's angle
addvar TEMP3 16 // Turn it right (adding to an angle turns it right)
setactor[THISACTOR].ang TEMP3 // Change it to the new value
}
getinput[THISACTOR].bits TEMP3
ifvarand TEMP3 8192
{
getactor[THISACTOR].shade TEMP4
ifvarl TEMP4 124
{
addvar TEMP4 4
setactor[THISACTOR].shade TEMP4
}
}
ifvarand TEMP3 16384
{
getactor[THISACTOR].shade TEMP4
ifvarg TEMP4 -128
{
subvar TEMP4 4
setactor[THISACTOR].shade TEMP4
}
}
}
}
}
endevent

EDIT: Added in code so you can move the camera's angle up and down by pressing Look Up/Down
« Last Edit: December 12, 2007, 11:46:11 PM by James »
Logged

DavoX

  • Paradise worlds mod
  • Member
  • Offline Offline
  • Posts: 2543
  • Level Designer
    • View Profile
    • WWW
Re: (Eduke) example code archive
« Reply #40 on: January 25, 2008, 03:13:08 AM »
I'm having problems changing the explosion sprite, what am I doing wrong here?

Error on line Textures/textures.def:6: expecting int, got "Textures/effects/explosion/pbe_01.png"
Logged

Trooper Dan

  • Mario Nukem Team
  • Member
  • Offline Offline
  • Posts: 4243
  • EDuke32 Special Forces -- Code Ops
    • MSN Messenger - deeper-thought@hotmail.com
    • View Profile
    • Email
Re: (Eduke) example code archive
« Reply #41 on: January 25, 2008, 04:55:19 AM »
That error says there is something wrong with your definition.  Too bad you won't show us what your definition is so we can look at it.
Logged
"Democracy never lasts long. It soon wastes, exhausts and murders itself. There was never a democracy that did not commit suicide." John Adams


Fissile Materials

DavoX

  • Paradise worlds mod
  • Member
  • Offline Offline
  • Posts: 2543
  • Level Designer
    • View Profile
    • WWW
Re: (Eduke) example code archive
« Reply #42 on: January 25, 2008, 05:49:17 AM »
Nevermind, the problem was that I put two things together when there should've been a space inbetween, the most time-spending errors are always the most stupid ones.
Logged

dopefish7590

  • Member
  • Offline Offline
  • Posts: 397
    • View Profile
    • Email
Re: (Eduke) example code archive
« Reply #43 on: January 25, 2008, 12:37:11 PM »
Nevermind, the problem was that I put two things together when there should've been a space inbetween, the most time-spending errors are always the most stupid ones.


wow could i ever relate ^_^
Logged
- Swim, Swim, Hungry

DaVince

  • Member
  • Offline Offline
  • Posts: 348
  • Weeee
    • MSN Messenger - vincentbeers@gmail.com
    • AOL Instant Messenger - DaVince021
    • View Profile
    • WWW
    • Email
Re: (Eduke) example code archive
« Reply #44 on: January 25, 2008, 09:19:17 PM »
Yup, the smallest typos can bring the most frustration. :/
Logged
It'sa my website! (not much Duke on there though.)
Pages: 1 2 [3] 4 5
 

(C) 2009, Alejandro Glavic. http://www.amcwebforums.com Go top