Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SCRIPT / MDL ED] Replace an entity / Creating a lamp
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: [SCRIPT / MDL ED] Replace an entity / Creating a lamp

There might be a way to replace the entity. I'd rather not type it all out, so I'll try out some ideas I've had.
Got it working. Here's what you do.


In the model editor, create your entity with a light attached to its body. Make sure this light's name is "PointLight_1". In your map script, add these two following two lines to OnStart().

PHP Code: (Select All)
// in this script, your sword is named "sword_light_1"
void OnStart()
{
    
FadeLightTo("sword_light_1_PointLight_1"0001, -11.5f);
    
SetEntityPlayerInteractCallback("sword_light_1""PickSword"false);


Next, add this function to the main body of your script

PHP Code: (Select All)
void PickSword(string &in entity)
{
    
FadeLightTo(entity+"_PointLight_1"1111, -11.5f); 
    
SwordPickLoop(entity);
}
void SwordPickLoop(string &in timer)
{
    if(!
GetPropIsInteractedWith(timer))    
    {
        
FadeLightTo(timer+"_PointLight_1"0001, -11.5f);
           return;
     }
     
AddTimer(timer0.0166f"SwordPickLoop");


Then, you're good to go! The sword's light will fade in/out over 1.5 seconds when the player picks it up or drops it. Enjoy.

(This post was last modified: 03-06-2012, 11:47 PM by palistov.)
03-06-2012, 11:17 PM
Find


Messages In This Thread
RE: [SCRIPT / MDL ED] Replace an entity / Creating a lamp - by palistov - 03-06-2012, 11:17 PM



Users browsing this thread: 1 Guest(s)