Tech Lounge > Programming

Learning Simple E2 with Kräsher!

(1/8) > >>

Krasher:



Prop/Player RaverLets 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: ---interval(10)
--- End code ---
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: ---owner():setColor(random(255),random(255),random(255))
--- End code ---
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 VaritionIf you want the PROP this is attached to to rave light up. Use this code..

--- Code: ---@name Prop raver
Prop=entity():isWeldedTo()

interval(10)
 Prop:setColor(random(255),random(255),random(255))

--- End code ---
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.

Krasher:
User MaterialsLets follow up with an E2 that can change your material!
Full Code:
--- Code: ---@name Tutorial E2 2
# This E2 changes your material #
owner():setMaterial("phoenix_storms/chrome")

--- End code ---
Explanation:
--- Code: ---owner():setMaterial("phoenix_storms/chrome")

--- End code ---
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!

ƒąĢĢǿŧ™:
THX ! U R KEWL

Krasher:
Player TrailsNow lets do player trails! This will put a trail on you! Just like a prop trail! :D
Full Code:
--- Code: ---@name Tutorial E2 3
# This E2 puts a trail on your player. #
 owner():setTrails(3,50,5,"trails/smoke",vec(255,0,0),200)

--- End code ---
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.

Tomcat:
lol
for forgot 2 main numb things


multiplying matrices by decimals


i could do that in ma sleep



jk

Navigation

[0] Message Index

[#] Next page

Go to full version