Home : Downloads : Forums : Contact Us Copyright

AMC Web Forums

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

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

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

Geoffrey

  • AMC Staff
  • Member
  • Offline Offline
  • Posts: 10709
  • elitist faggot
    • View Profile
    • Email
(Eduke) example code archive
« on: March 31, 2005, 08:23:13 PM »
Since some of us don't quite understand Eduke that well I thought it'd be nice to start an example code archive. There are some examples in the wiki but the really usable stuff, to make more dynamic missions and usermaps, is still something that has to be figured out first before you can actually start using it. For me, in any case. And since I don't exactly consider myself a moron compared to the rest of you fellers, I thought this thread was a good idea.

In case you're looking for the examples in the WIKI, follow this link.

For Fakir3d I've asked people for alot of con help, and to show my good faith I'll share the most usable things with you fine fellers.

Jumppad code - which Mblackwell was kind of enough to explain to me

If setplayer[THISACTOR].poszv is set to a negative number it makes the player fly up into the air. Example code for this is
ifpdistl 1024 { setvar TEMP -2000 setplayer[THISACTOR].poszv TEMP }

The only problem I've found with this is that the longer you stay bouncing, the more damage you'll get when you finally drop down. Mblackwell was kind of enough to try to help me figure that out, but it didn't really get across. You are more than welcome to correct anything in this thread ofcourse.

In-game quotes
The reason I put this here is because in-game text can make for some great mission objective texts and such, or even supply the author with a nice ego boost by displaying the maps name and author when it being. I haven't done anything with this yet since I haven't been arsed to.
 
The entry in the WIKI pretty much explains itself, but the line that it can only be actived during events creeped me out for a second. This is the GAMETEXT entry in the wiki:

Quote
gametext <tilenum> <x> <y> <quote> <shade> <pal> <orientation> <x1> <y1> <x2> <y2>

Prints a defined quote to the screen.

<tilenum> is the first tile of a sequence of characters. See tile 2822 for an example.
<x> and <y> are on-screen coordinates.
<quote> is the quote to print, as defined by definequote.
<shade> and <pal> are obviously shade and palette.
<orientation> is.. hard to explain. Play with values like 16 and 26.
<x1>, <y1>, <x2> and <y2> are boundaries on the screen that define where the text may be drawn.

Example code:

setvar x 0
setvar y 100
setvar shade 0
setvar pal 0
setvar tilenum STARTALPHANUM
setvar orientation 26
setvar TEMP 100
digitalnumber tilenum x y TEMP shade pal orientation ZERO ZERO xdim ydim

Please note that as with digitalnumber, minitext and friends, gametext only works during events.

Luckily RENEGADO explained my event problem at DNR:

Quote
You should put the display code inside an event (EVENT_DISPLAYREST recommended for this) and make it dependant of one or more variables (whatever to suit your needs)
 
You can trigger the variable anywhere you want: inside another event, triggered by some actor, action, pressing the spacebar, etc  and the text will be displayed until the variable is triggered again to his initial value.
 
for example:

Code: [Select]
gamevar DISPLAY_MYTEXT 0 1

onevent EVENT_DISPLAYREST
ifvare DISPLAY_MYTEXT 1
{  
[B](insert text code here) [/B]
}
endevent

// Now, wherever you want to trigger the text display :

....*blablabla actor code blablabla*

ifpdistl 1024 ifp pfacing // if the player is really near and facing the actor
{
ifhitspace { setvar DISPLAY_MYTEXT 1 } // if space is pressed, the text appears
}

ifpdistg 1024 // if the player goes away from the actor
{
setvar DISPLAY_MYTEXT 0 // The text dissapears
}
... ***blablabla more actor code, blablabla***


I do have some more useful ( and with useful I mean, useful for the masses that just want to enhance their map in a simple manner ) stuff but I got that from other mods that are still under construction, so I'll leave it up to them to decide if they want to post it or not.

And finally, this thread is also very much open for code from other mods, just so that there's a place where all the usefull code can be gathered and used. The whole idea of Eduke is great, but if it's a huge question mark for alot of people it won't exactly work out the way it's planned.

I hope I've created a useful thread and not something for people to bitch over and call me an ass for. Remember, it's all in the name of great justice!
« Last Edit: March 31, 2005, 09:29:23 PM by Fakir »
Logged
We'll build our own Tripods. Ours will have 4 legs...

Renegado

  • Member
  • Offline Offline
  • Posts: 455
    • View Profile
    • WWW
    • Email
(Eduke) example code archive
« Reply #1 on: March 31, 2005, 09:25:52 PM »
Quote
Luckily MRCK explained my event problem at DNR:

It was me, but oh well... :biggrin2:
Useful thread btw ;)
Logged
I am your father's brother's nephew's cousin's former roommate!
-RTCMīs EDuke Source Code Development Center
-Eduke Developerīs Journal
-Duke Espaņa

Geoffrey

  • AMC Staff
  • Member
  • Offline Offline
  • Posts: 10709
  • elitist faggot
    • View Profile
    • Email
(Eduke) example code archive
« Reply #2 on: March 31, 2005, 09:28:18 PM »
What the really? Sorry, I'll fix it :)
Logged
We'll build our own Tripods. Ours will have 4 legs...

Sang

  • Moderators
  • Member
  • Offline Offline
  • Posts: 17446
    • MSN Messenger - sangmahn@hotmail.com
    • View Profile
    • Email
(Eduke) example code archive
« Reply #3 on: March 31, 2005, 10:00:59 PM »
Handy thread! I don't know anything about CON coding so I'll just sit back and see if anything I need pops up :) I'll ask it here anyway because people don't seem to view my little thread :(
Logged
"heh, a sidenote, Iīd not mind to clean her ass with my tongue after she takes a shit. " - Gambini

"Like a gay couple both have a penis but one will have to crouch and put the ass or it simply wonīt work." - Gambini

Last.fm

Geoffrey

  • AMC Staff
  • Member
  • Offline Offline
  • Posts: 10709
  • elitist faggot
    • View Profile
    • Email
(Eduke) example code archive
« Reply #4 on: March 31, 2005, 10:18:08 PM »
Oh better not make this a question thread, that'll just make it shit to browse. It'd be better if you ask things in other threads and then, if you want, you can post it here. If this thread even works out, that is. I get the feeling that not alot of people care to post their coding.
« Last Edit: April 01, 2005, 12:42:20 AM by Fakir »
Logged
We'll build our own Tripods. Ours will have 4 legs...

Mblackwell

  • Member
  • Offline Offline
  • Posts: 1484
    • MSN Messenger - mblackwell50@hotmail.com
    • AOL Instant Messenger - Mblackwell1024
    • View Profile
    • WWW
    • Email
(Eduke) example code archive
« Reply #5 on: April 01, 2005, 02:17:39 AM »
Quote
Oh better not make this a question thread, that'll just make it shit to browse. It'd be better if you ask things in other threads and then, if you want, you can post it here. If this thread even works out, that is. I get the feeling that not alot of people care to post their coding.
[snapback]109233[/snapback]


If you want the player to still fall really rapidly (in the jump pad example) but never get hurt, there are afew ways to do this, but a quick way is to check in the APLAYER code:

Code: [Select]
iffloordistl 10
{
     getplayer[THISACTOR].poszv TEMP
     ifvarg TEMP 2100
     {
       setvar TEMP 2100
       setplayer[THISACTOR].poszv TEMP
     }
}

Adjust the floordist value as necissary. Basically it just sets the players velocity/falling speed to a number where he won't take damage, right before they hit the ground.
Logged
"Smoke rises from the mountain of Doom, and the hour grows late,
and Gandalf the Grey rides to Isengard, seeking my counsel.
For that is why you have come, is it not?
My old friend... "

James

  • Administrator
  • Member
  • Offline Offline
  • Posts: 13876
    • MSN Messenger - Jstanf36@ntlworld.com
    • View Profile
    • WWW
    • Email
(Eduke) example code archive
« Reply #6 on: April 01, 2005, 04:49:08 AM »
Quote
I do have some more useful ( and with useful I mean, useful for the masses that just want to enhance their map in a simple manner ) stuff but I got that from other mods that are still under construction, so I'll leave it up to them to decide if they want to post it or not.
If any of that more useful code is from IW v2, feel free to post it :)
Logged

Quakis

  • Member
  • Offline Offline
  • Posts: 5378
    • MSN Messenger - quakis_962@hotmail.com
    • View Profile
    • WWW
    • Email
(Eduke) example code archive
« Reply #7 on: April 01, 2005, 05:03:55 AM »
POST THE KEYPAD AND MOTORBIKE CODES!!!!
Logged

James

  • Administrator
  • Member
  • Offline Offline
  • Posts: 13876
    • MSN Messenger - Jstanf36@ntlworld.com
    • View Profile
    • WWW
    • Email
(Eduke) example code archive
« Reply #8 on: April 01, 2005, 05:16:57 AM »
Keypad code is Survival; no chance I'm gonna post that  (Still a few bugs to fix eitherway)
Logged

FreeFrag

  • Member
  • Offline Offline
  • Posts: 3898
    • ICQ Messenger - 144729090
    • MSN Messenger - blaster_b4m
    • AOL Instant Messenger - FreeFragSGS
    • Yahoo Instant Messenger - freefragsgs
    • View Profile
    • WWW
    • Email
(Eduke) example code archive
« Reply #9 on: April 01, 2005, 06:28:14 AM »
You have code where you can type in numbers when you're using a panel? I'm freaked out if you are.
Logged
"In truth, I am nothing but a plodding mediocrity - please observe, a plodding mediocrity - for a mere mediocrity does not go very far, but a plodding one gets quite a distance."
-Benjamin Cardozo

James

  • Administrator
  • Member
  • Offline Offline
  • Posts: 13876
    • MSN Messenger - Jstanf36@ntlworld.com
    • View Profile
    • WWW
    • Email
(Eduke) example code archive
« Reply #10 on: April 01, 2005, 06:29:54 AM »
Yep; it's a tad buggy at the moment however. The codes are preset in the cons and are only 3 numbers long, but I'll probably see about adding more numbers. I will release this code at some point (besides even if I didn't people could just copy it from the cons when Survival is released anyways :D )
Logged

FreeFrag

  • Member
  • Offline Offline
  • Posts: 3898
    • ICQ Messenger - 144729090
    • MSN Messenger - blaster_b4m
    • AOL Instant Messenger - FreeFragSGS
    • Yahoo Instant Messenger - freefragsgs
    • View Profile
    • WWW
    • Email
(Eduke) example code archive
« Reply #11 on: April 01, 2005, 07:07:44 AM »
I'd send you mine if it worked. :>
Logged
"In truth, I am nothing but a plodding mediocrity - please observe, a plodding mediocrity - for a mere mediocrity does not go very far, but a plodding one gets quite a distance."
-Benjamin Cardozo

Geoffrey

  • AMC Staff
  • Member
  • Offline Offline
  • Posts: 10709
  • elitist faggot
    • View Profile
    • Email
(Eduke) example code archive
« Reply #12 on: April 01, 2005, 03:03:02 PM »
Ok, this is maybe the most useless thing ever but maybe it'll be useful for something. Sorry for the fact that this is utter n00b - but since it works and I'm using it everywhere in my mod it might prove useful, who knows.

I've replaced the MIKE actor because I was originaly working with 1.3 - haven't been arsed to change it yet.

'this door can not be opened' messages -- and the likes

They used something similar in Napalm, only they didn't use a sound and didn't kill the actor after having pressed space. I've found this bleep sound much prettier in F3d but when you're not making something cute and kiddie the napalm alternative might be a tad better.

Code: [Select]
actor MIKE
    cstat 32768
   ifp pfacing
      ifcount 6
        ifpdistl 1280
           ifhitspace
            ifspritepal 0
      {
        soundonce QUOTE
        quote 133        // "This door can not be opened" in F3d
        killit
      }      
        else

   ifp pfacing
      ifcount 6
        ifpdistl 1280
           ifhitspace
            ifspritepal 10
      {
        soundonce QUOTE
        quote 137        // ...
        killit
      }      
        else

And secondly for something more exciting;

Imagination World V2's custom loading screens
Code speaks for itself, volume 2 level 0, display tile 1054 instead of the nuke splash. 9 lines of heaven :)

Code: [Select]
onevent EVENT_GETLOADTILE
ifvare VOLUME 2
{
ifvare LEVEL 0
{
setvar RETURN 1054
}
}
endevent
« Last Edit: April 01, 2005, 03:33:13 PM by Fakir »
Logged
We'll build our own Tripods. Ours will have 4 legs...

Geoffrey

  • AMC Staff
  • Member
  • Offline Offline
  • Posts: 10709
  • elitist faggot
    • View Profile
    • Email
(Eduke) example code archive
« Reply #13 on: April 01, 2005, 03:05:34 PM »
Quote
POST THE KEYPAD AND MOTORBIKE CODES!!!!
[snapback]109278[/snapback]

The motobike is kind of a bugfest - the sw code is right on our doorstep so sector cars might be a nice eduke option in the near future.
Logged
We'll build our own Tripods. Ours will have 4 legs...

Quakis

  • Member
  • Offline Offline
  • Posts: 5378
    • MSN Messenger - quakis_962@hotmail.com
    • View Profile
    • WWW
    • Email
(Eduke) example code archive
« Reply #14 on: April 01, 2005, 06:37:58 PM »
I'm really wanting the Keypad code - non buggy ofcourse, :D (Im guessing others are too)

Custom loading screens? so thats like, if you about to enter a FACILITY level, you could take a screen, import into an art tile and when you load that level it would display that art tile, and the same if you took a pic of the next level as it loads to THAT?
Logged
Pages: [1] 2 3 ... 5
 

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