Poison/Camera Effect WDL

Posted By: Davetheave

Poison/Camera Effect WDL - 01/14/05 07:28

Well after much time spent on the fourms i found that people need codes that involved the cameras. So i looked around more and found how easy it was to make some camera code. Any feedback will be great i don't care if it's bad. Also i will take ideas. Note: I belive the camera.alpha code needs pro edition to run currectly.

Code:
/* Poison/Camera effect      Coded by David Branco a.k.a DaveTheAve

Note: This code was made for use with the templates.
To use:
Include this .WDL last in the main script
Call the function of the effect you want.
To shutoff:
Camera effects: Call the function "normal_camera"
Other Effects: Call the function "shutdown_effects" */

bmap poison_pan = "poison.bmp"; //Fullscreen poison bmp file
bmap pain_pan = "pain.bmp"; //Fullscreen pain bmp file
var poison_stat, 0; //Keep at 0 Needed to reset effect is more poison is taken
var poison_speed, 1; //Speed the poison effect decreases by
var pain_stat, 0; //Keep at 0 Needed to reset effect is more poison is taken
var pain_speed, 1; //Speed the poison effect decreases by
var drugged_working, 0; //Keep at 0 Needed for the drug camera

panel poison_panel
{
alpha = 0;
bmap = poison_pan;
flags = transparent, refresh, d3d;
}

panel pain_panel
{
alpha = 0;
bmap = pain_pan;
flags = transparent, refresh, d3d;
}

function poison_effect()
{
poison_panel.alpha = 80;
poison_stat = 1;
poison_panel.visible = on;
while(poison_panel.alpha > 0)
{
poison_panel.alpha -= poison_speed * time;
wait(1);
}
poison_panel.alpha = 0;
poison_panel.visible = off;
poison_stat = 0;
}

function pain_effect()
{
pain_panel.alpha = 80;
pain_stat = 1;
pain_panel.visible = on;
while(pain_panel.alpha > 0)
{
pain_panel.alpha -= pain_speed * time;
wait(1);
}
pain_panel.alpha = 0;
pain_panel.visible = off;
pain_stat = 0;
}

function pain_remain_on_screen_effect()
{
pain_stat = 1;
pain_panel.visible = on;
wait(5);
while(pain_stat == 1)
{
pain_panel.alpha = 100 - player._HEALTH;
wait(1);
}
pain_panel.alpha = 0;
pain_panel.visible = off;
pain_stat = 0;
}

function shutdown_effects()
{
pain_stat = 0;
poison_stat = 0;
}

function normal_camera()
{
camera.alpha = 50;
camera.transparent = off;
drugged_working = 0;
}

function slowmo_camera()
{
camera.transparent = on;
camera.alpha = 30;
}

function drugged_camera()
{
camera.transparent = on;
camera.alpha = 8;
drugged_working = 1;
while (drugged_working == 1)
{
camera.x += 10 * time;
wait(1);
camera.x -= 10 * time;
wait(1);
}
}

function nos_camera()
{
camera.transparent = on;
camera.alpha = 20;
}



Edit: I belive i had used the alpha values wrong so i just fixed them. Also so small improvments on the poison code and the pain code.

Edit: Thank you Snake67 for the "* time" help.
Posted By: snake67

Re: Poison/Camera Effect WDL - 01/14/05 19:41

I just wanted to mention: you forgot to tine correct the "*_speed" variables.

while(poison_panel.alpha > 0)
{
poison_panel.alpha -= poison_speed *time ;
wait(1);
}
Posted By: Davetheave

Re: Poison/Camera Effect WDL - 01/14/05 20:30

Well thank you for posting and i did at the "* time". I don't know what that does so thats why i never added it. If you can plz tell what how that affects my code.
Posted By: snake67

Re: Poison/Camera Effect WDL - 01/15/05 03:10

Since the time "wait(1);" will wait depends on the hardware, you must time correct your counter. Otherwise the effect does depend on system speed too.
I encountered two more bugs in your code. It should be:

while(pain_stat == 1)
{
pain_panel.alpha = 100 - player._HEALTH * time;
wait(1);
}

and

while (drugged_working == 1)
{
camera.x += 10;
sleep(0.1);
camera.x -= 10;
sleep(0.1);
}

or

while (drugged_working == 1)
{
camera.x += 10*time;
wait(1);
camera.x -= 10*time;
wait(1);
}


Posted By: ShoreVietam

Re: Poison/Camera Effect WDL - 01/15/05 04:32

I really like the idea, I didn't knew the camera.transparent = on stuff is possible, thanks!
Posted By: Davetheave

Re: Poison/Camera Effect WDL - 01/15/05 04:40

Snake67 i have updated the code thank you for your help. Everyone else plz leave your feedback, vote on the poll, and any ideas are much needed.
Posted By: Braxton

Re: Poison/Camera Effect WDL - 01/15/05 10:03

So what does this do exactly???
Posted By: Davetheave

Re: Poison/Camera Effect WDL - 01/15/05 10:46

Well this code basicly will blur the screen givin it a Drug effect (or whatever the fuction effect is called), also i added some fuctions that you can call get your player gets shot that will make the screen flash red, or get darker with every shot. Then theres a poison code that will flash the screen green when the player is poisoned (script must call it).
Posted By: kmangwing

Re: Poison/Camera Effect WDL - 01/20/06 18:08

sweet. Did you change it so it can work in the lower editions?
Posted By: broozar

Re: Poison/Camera Effect WDL - 01/20/06 18:46

Quote:

Note: I belive the camera.alpha code needs pro edition to run currectly.





no, it doesnīt. "camera.transparent=on; camera.alpha=xyz;" works very well for me (commercial). strange, however. i looked it up in the manual, and itīs a "pro" feature. dunno why it works ^^
© 2024 lite-C Forums