Script not working

A secret forum for people who preorder Overgrowth!
Post Reply
User avatar
Krabman318
Posts: 225
Joined: Wed Nov 03, 2010 5:34 am
Location: Planet Decapod 10

Script not working

Post by Krabman318 » Fri Aug 19, 2011 3:37 am

I was trying to create a custom material that kills anyone stepping on it(like in ZramuliZ´s Linear Level Kit), so I created a material with friction 1.0001337, edited box.xml (<MaterialPath>Data/Materials/kill.xml</MaterialPath>), and edited aschar.as:

Code: Select all

(...)
if(on_ground){
        new_slide_vel = this_mo.velocity;
        float new_friction = this_mo.GetFriction(this_mo.position + vec3(0.0f,_leg_sphere_size * -0.4f,0.0f));
        friction = max(0.01f, friction);
        friction = pow(mix(pow(friction,0.01), pow(new_friction,0.01), 0.05f),100);
        this_mo.velocity = mix(this_mo.velocity, old_slide_vel, pow(1.0f-friction, num_frames));
        old_slide_vel = this_mo.velocity;
        if(friction == 1.0001337f && knocked_out = _awake){
        permanent_health = 0.0f;
        knocked_out = _dead; 
}
}
}

ZramuliZ
Posts: 108
Joined: Wed Jan 06, 2010 3:56 pm
Location: Finland

Re: Script not working

Post by ZramuliZ » Fri Aug 19, 2011 6:29 am

You should use new_friction to check for the script where it checks if the friction is a certain number.

Code: Select all

...
 if(new_friction == 1.0001337f && knocked_out = _awake)
...

User avatar
Krabman318
Posts: 225
Joined: Wed Nov 03, 2010 5:34 am
Location: Planet Decapod 10

Re: Script not working

Post by Krabman318 » Sat Aug 20, 2011 4:23 am

Thank you!
I didn´t remember you used new_friction in your mod.

Post Reply