Author Topic: Learning Simple E2 with Kräsher!  (Read 3486 times)

0 Members and 1 Guest are viewing this topic.

Offline Krasher

  • -=RND Help Center=-
  • WaffleBBQrz
  • ******
  • Posts: 2764
  • Karma: +75/-47
  • Gender: Male
  • PM me if you have questions.
    • View Profile
    • Forum Page
Learning Simple E2 with Kräsher!
« on: April 10, 2010, 07:29:04 PM »



Prop/Player Raver

Lets begin by learning a SIMPLE color changing E2 that makes you change colors!

Open a NEW E2 and type this on the first line.
Code: [Select]
interval(10)This makes the E2 repeat itself every 10 milliseconds or so. (I am not sure what time increment it is.)

On line 2, type this out.
Code: [Select]
owner():setColor(random(255),random(255),random(255))The function 'owner' means that whatever the code after it says, it happens to the player who spawned it. The random(255) means it is randomlly picking a color from the RGB scale for each R, G, and B. RGB = Red, Green, Blue.

Simple Varition
If you want the PROP this is attached to to rave light up. Use this code..
Code: [Select]
@name Prop raver
Prop=entity():isWeldedTo()

interval(10)
 Prop:setColor(random(255),random(255),random(255))
Prop=entity():isWeldedTo() is a function that states that the prop that the E2 is attached to should have the code run on it, When the string 'Prop' is stated, followed by a code.

« Last Edit: May 18, 2010, 04:00:41 PM by Kräsh∑r »
-Admin Application-

Follow the rules or I will you.

Offline Krasher

  • -=RND Help Center=-
  • WaffleBBQrz
  • ******
  • Posts: 2764
  • Karma: +75/-47
  • Gender: Male
  • PM me if you have questions.
    • View Profile
    • Forum Page
Re: Learning Simple E2 with Kräsher!
« Reply #1 on: April 10, 2010, 07:56:41 PM »
User Materials
Lets follow up with an E2 that can change your material!

Full Code:
Code: [Select]
@name Tutorial E2 2
# This E2 changes your material #
owner():setMaterial("phoenix_storms/chrome")

Explanation:
Code: [Select]
owner():setMaterial("phoenix_storms/chrome")
owner is the player who spawned the E2, in other words. It's you.
setMaterial is the function that you know, states that you are setting the entity's (owner) material.
("phoenix_storms/chrome") is the part that goes after setMaterial. This is the part where you can type in any material you want!
-Admin Application-

Follow the rules or I will you.

Offline ƒąĢĢǿŧ™

  • -=RND Trolling Center=-
  • WaffleBBQrz
  • ******
  • Posts: 3334
  • Karma: +59/-76
  • Gender: Male
  • What's going on here?
    • View Profile
Re: Learning Simple E2 with Kräsher!
« Reply #2 on: April 10, 2010, 07:57:55 PM »
THX ! U R KEWL


Offline Krasher

  • -=RND Help Center=-
  • WaffleBBQrz
  • ******
  • Posts: 2764
  • Karma: +75/-47
  • Gender: Male
  • PM me if you have questions.
    • View Profile
    • Forum Page
Re: Learning Simple E2 with Kräsher!
« Reply #3 on: April 10, 2010, 08:17:07 PM »
Player Trails
Now lets do player trails! This will put a trail on you! Just like a prop trail! :D

Full Code:
Code: [Select]
@name Tutorial E2 3
# This E2 puts a trail on your player. #
 owner():setTrails(3,50,5,"trails/smoke",vec(255,0,0),200)
Explanation:
owner is the player who spawned the E2, in other words. It's you.
setTrails is the function that states that you are setting the entity's (owner) trail.
"trails/smoke" is the part that goes after setTrails. This is the part where you can type in any trail you want!
vec(255,0,0) is the vector color.  the 3 numbers after vec are the color in R, G, and B.
setTrails(3,50,5) the 3 numbers after setTrails are Start Size, End Size, and Length, in that order.
-Admin Application-

Follow the rules or I will you.

Offline Tomcat

  • Smartical
  • Übermensch
  • *****
  • Posts: 1694
  • Karma: +42/-13
  • Gender: Male
  • OMG IS DAT A CHEEZEBURGER
    • View Profile
    • Rnd Upload
Re: Learning Simple E2 with Kräsher!
« Reply #4 on: April 10, 2010, 08:54:23 PM »
lol
for forgot 2 main numb things


multiplying matrices by decimals


i could do that in ma sleep



jk

Quote
Andrew: your mom spazzes
.:RND`=- Tomcat: not me
Tomcat: andrew
Tomcat: dont go there
.:RND`=- Tomcat: i will rape you all they way back to 1980

Offline Krasher

  • -=RND Help Center=-
  • WaffleBBQrz
  • ******
  • Posts: 2764
  • Karma: +75/-47
  • Gender: Male
  • PM me if you have questions.
    • View Profile
    • Forum Page
Re: Learning Simple E2 with Kräsher!
« Reply #5 on: April 10, 2010, 09:22:08 PM »
Simple Hologram
This is a LITTLE bit more advanced, :P.

Full Code:
Code: [Select]
@name Tutorial E2 5
@persist Timer
# This E2 makes a cube holo that spins :D #
interval(0.5)
Me = owner()
Chip = entity()
T = Timer
Timer = Timer+1*1
if(first()) {holoCreate(1)}

holoModel(1,"cube")
holoAng(1,ang(T,T,T))
holoPos(1,Chip:pos()+vec(0,0,45))
holoColor(1,vec(255,200,0))
holoScale(1,vec(1,1,1))
Variation of Color:
Change:
Code: [Select]
holoColor(1,vec(255,200,0))To:
Code: [Select]
holoColor(1,vec(random(255),random(255),random(255)))This sets the holo to rave light.

Explanation:
Timer is a variable, that means it is a number that can mean anything depending on the string it is set in.
Timer = Timer+1*1 adds 1 to the variable every interval.
holoCreate states that we are creating a hologram.
holoModel(1,"cube") states that this hologram will be in the shape of a cube :D.
holoAng(1,ang(T,T,T)) sets the angle of the hologram (You can put any numbers in place of T,T,T.)
holoPos(1,Chip:pos()+vec(0,0,45)) states the position of the holo. (in X,Y,Z, format.)
holoColor(1,vec(255,200,0)) states the color of our holo. (in RGB format.)
holoScale(1,vec(1,1,1)) states the scale of the holo. (in length, width, depth, format.)

« Last Edit: April 10, 2010, 09:26:28 PM by Kräsher »
-Admin Application-

Follow the rules or I will you.

Offline Frank

  • No.
  • WaffleBBQrz
  • ******
  • Posts: 4058
  • Karma: +94/-45
  • Gender: Male
    • View Profile
Re: Learning Simple E2 with Kräsher!
« Reply #6 on: April 10, 2010, 09:42:59 PM »
Quote
@name Tutorial E2 2
# This E2 changes your material #
owner():setMaterial("phoenix_storms/chrome")

With the above one, you only change your skin ONCE.

BUT, by making some simple modifications, you can get it to switch between different materials by just typing a tiny chat command, see:

Quote
@name Tutorial E2 2
# This E2 changes your material #
interval(20)
if(owner():lastSaid()=="!chrome"){owner():setMaterial("phoenix_storms/chrome")}
if(owner():lastSaid()=="!blkchrome"){owner():setMaterial("phoenix_storms/black_chrome")}

We make an 'if' statement, where "if   'x=z'    'z=c' ".

That means, for example, that if 'x' equals to 'z', 'z' will equal to 'c'.


How to make it easier?
Quote
If I had U$S2000, I'd buy an awesome computer.

Now, let's make it E2!
Quote
If (I had U$S==2000) {Can buy an awesome computer}
Quote
if(Money==2000){AwesomePC==Affordable}

I hope you understand it.

You can also make statements shorter, I'll show you:
Quote
@name Tutorial E2 2
# This E2 changes your material #
interval(20)
if(owner():lastSaid()=="!chrome"){owner():setMaterial("phoenix_storms/chrome")}
if(owner():lastSaid()=="!blkchrome"){owner():setMaterial("phoenix_storms/black_chrome")}

Can be reduced to:

Quote
@name Tutorial E2 2
# This E2 changes your material #
interval(20)
LS = owner():lastSaid()
if(LS=="!chrome"){owner():setMaterial("phoenix_storms/chrome")}
if(LS=="!blkchrome"){owner():setMaterial("phoenix_storms/black_chrome")}



I hope it was useful.

Offline Krasher

  • -=RND Help Center=-
  • WaffleBBQrz
  • ******
  • Posts: 2764
  • Karma: +75/-47
  • Gender: Male
  • PM me if you have questions.
    • View Profile
    • Forum Page
Re: Learning Simple E2 with Kräsher!
« Reply #7 on: April 10, 2010, 10:20:13 PM »
I will go over commands later Frank...
-Admin Application-

Follow the rules or I will you.

Offline me4488

  • Sr. Member
  • ****
  • Posts: 361
  • Karma: +5/-4
  • Gender: Male
  • Bumper cars...
    • View Profile
Re: Learning Simple E2 with Kräsher!
« Reply #8 on: April 10, 2010, 10:23:28 PM »
nice stuffz here  ::)
I believe that it's my GODDAMN right,
To destroy everything in my sight...
                                                               The Offspring

Offline Krasher

  • -=RND Help Center=-
  • WaffleBBQrz
  • ******
  • Posts: 2764
  • Karma: +75/-47
  • Gender: Male
  • PM me if you have questions.
    • View Profile
    • Forum Page
Re: Learning Simple E2 with Kräsher!
« Reply #9 on: April 10, 2010, 10:52:09 PM »
-Admin Application-

Follow the rules or I will you.

Offline » Magic «

  • Who dares wins
  • WaffleBBQrz
  • ******
  • Posts: 4020
  • Karma: +101/-34
  • Gender: Male
  • Prepare for the worst :D
    • View Profile
Re: Learning Simple E2 with Kräsher!
« Reply #10 on: April 11, 2010, 05:35:00 AM »
this is wtf fail, for peeps who dont know go here, but me, stick to E2 itself :)
Copyright© .:~`=-rANdOm-=`~:. GameServer's Administration Team 2008/2009/2010


bubbly bubbly so darn bubbly

Offline Krasher

  • -=RND Help Center=-
  • WaffleBBQrz
  • ******
  • Posts: 2764
  • Karma: +75/-47
  • Gender: Male
  • PM me if you have questions.
    • View Profile
    • Forum Page
Re: Learning Simple E2 with Kräsher!
« Reply #11 on: April 11, 2010, 08:22:16 AM »
this is wtf fail, for peeps who dont know go here, but me, stick to E2 itself :)
Nah, its a win. Making use of the Programming Section.
-Admin Application-

Follow the rules or I will you.

Offline » Magic «

  • Who dares wins
  • WaffleBBQrz
  • ******
  • Posts: 4020
  • Karma: +101/-34
  • Gender: Male
  • Prepare for the worst :D
    • View Profile
Re: Learning Simple E2 with Kräsher!
« Reply #12 on: April 11, 2010, 10:11:20 AM »
Nah, its a win. Making use of the Programming Section.
i am and have been lol, im currently making soemthing for random since like, 2 dayss ago, gunna go strait in here
Copyright© .:~`=-rANdOm-=`~:. GameServer's Administration Team 2008/2009/2010


bubbly bubbly so darn bubbly

Offline philthethrill

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: Learning Simple E2 with Kräsher!
« Reply #13 on: April 11, 2010, 12:57:49 PM »
hey does anyone know how to make a e2 mine when a button is pressed it blows up

Offline Krasher

  • -=RND Help Center=-
  • WaffleBBQrz
  • ******
  • Posts: 2764
  • Karma: +75/-47
  • Gender: Male
  • PM me if you have questions.
    • View Profile
    • Forum Page
Re: Learning Simple E2 with Kräsher!
« Reply #14 on: April 11, 2010, 01:35:37 PM »
hey does anyone know how to make a e2 mine when a button is pressed it blows up

Use Dynamite
-Admin Application-

Follow the rules or I will you.