Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 7th_zorro), 923 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Amazing weather script, translation to Lite-C needed! #341764
09/20/10 04:03
09/20/10 04:03
Joined: Sep 2010
Posts: 67
FutureRaptor Offline OP
Junior Member
FutureRaptor  Offline OP
Junior Member

Joined: Sep 2010
Posts: 67
I am making a car game and have been looking for good weather systems in Lite-C. Mystymood isnt really good enough for me but I have found weather script that does. The problem is that it is .wdl and I need somebody to translate it to lite-c for me if possible. Would be very nice thx.
The tutorial for it can be found here http://www.coniserver.net/coni_users/web_users/pirvu/aum/aumonline_e/ it is tutorial Aum65, Workshops, Weather Effects. Will give credit in my game to the person who translates if somebody is keen enough to do so.

Re: Amazing weather script, translation to Lite-C needed! [Re: FutureRaptor] #341869
09/21/10 07:20
09/21/10 07:20
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
Hello,
This is the Lite-C weather script you needed, translated from George's C-Script weather code :

#include <acknex.h>
#include <default.c>

#define CONTENT_SOLID 3

/////////////////////////////////////////////////////////////////////////////////////////////

var rain_on = 0;
var snow_on = 0;
var fog1_on = 0;
var fog2_on = 0;
var fog3_on = 0;
var fog4_on = 0;

var rain_handle; // handle for the rain.wav sound
var snow_handle; // handle for the snow.wav sound

var day = 0;

/////////////////////////////////////////////////////////////////////////////////////////////

BMAP *snow_tga = "snow.tga";

/////////////////////////////////////////////////////////////////////////////////////////////

STRING *work40_wmb = "work40.wmb";

STRING *rain_tga = "rain.tga";

/////////////////////////////////////////////////////////////////////////////////////////////

SOUND *rain_wav = "rain.wav";
SOUND *snow_wav = "snow.wav";

/////////////////////////////////////////////////////////////////////////////////////////////

function fade_snow(PARTICLE *p);
function snow_particles(PARTICLE *p);
function toggle_snow();
function snow_sound();

function rain_sprites();
function toggle_rain();
function rain_sound();

function toggle_fog();

function toggle_daynight();

/////////////////////////////////////////////////////////////////////////////////////////////

function main()
{
video_mode = 7; // 800x600 pixels
video_depth = 32; // 32 bit mode
video_screen = 1; // start in full screen mode
d3d_lightres = 128;

fps_max = 60;
max_entities = 30000;

level_load (work40_wmb);

on_s = toggle_snow;
on_r = toggle_rain;
on_f = toggle_fog;
on_d = toggle_daynight;
}

action players_code () // simple player and 1st person camera code
{
player = my; // I'm the player
set( my, INVISIBLE ) ; // no need to see player's model in 1st person mode
while (1)
{
// move the player using the "W", "S", "A" and "D" keys; "10" = movement speed, "6" = strafing speed
c_move (my, vector(6 * (key_cuu - key_cud) * time_step, 4 * (key_cul - key_cur) * time_step, 0), nullvector, IGNORE_PASSABLE | GLIDE);
vec_set (camera.x, player.x); // use player's x and y for the camera as well
camera.z += 30; // place the camera 30 quants above the player on the z axis (approximate eye level)
camera.pan -= 5 * mouse_force.x * time_step; // rotate the camera around by moving the mouse
camera.tilt += 3 * mouse_force.y * time_step; // on its x and y axis
player.pan = camera.pan; // the camera and the player have the same pan angle
wait (1);
}
}

/////////////////////////////////////////////////////////////////////////////////////////////

function toggle_snow()
{
snow_on += 1;
snow_on %= 2;
VECTOR snow_origin;
var i;
while (!player) {wait (1);}
snow_sound();
while (snow_on)
{
i = 0;
while (i < 50) // that's a "while without wait" loop
{
snow_origin.x = player.x + 1000 - random(2000);
snow_origin.y = player.y + 1000 - random(2000);
snow_origin.z = player.z + 300;
effect(snow_particles, 1, &snow_origin, normal);
i += 1;
}
if(random(1) > 0.7)
{
c_move (player, nullvector, vector((-1 + random(1)) * time_step, 0, 0), IGNORE_PASSABLE | GLIDE);
}
wait (1);
}
}

function snow_particles(PARTICLE *p)
{
VECTOR particle_direction;
particle_direction.x = random(5) - 15;
particle_direction.y = (1 - random(2)) / 10;
particle_direction.z = -5 - random(7);

vec_add(p.vel_x, &particle_direction);
p.alpha = 30 + random(65);
p.bmap = snow_tga;
p.size = 3;
set(p,BRIGHT | MOVE) ;
p.event = fade_snow;
}

function fade_snow(PARTICLE *p)
{
p.alpha -= 1.2 * time_step;
if (p.alpha < 0) {p.lifespan = 0;}
}

function snow_sound()
{
if (snow_on)
{
snow_handle = snd_loop(snow_wav, 50, 0);
}
else
{
snd_stop(snow_handle);
}
}

/////////////////////////////////////////////////////////////////////////////////////////////

function toggle_rain()
{
rain_on += 1;
rain_on %= 2;
VECTOR rain_origin;
var i;
while (!player) {wait (1);}
rain_sound();
while (rain_on)
{
i = 0;
while (i < 30) // that's a "while without wait" loop
{
rain_origin.x = player.x + 500 - random(1000);
rain_origin.y = player.y + 500 - random(1000);
rain_origin.z = player.z + 300;
ent_create(rain_tga, &rain_origin, rain_sprites);
i += 1;
}
rain_origin.x = player.x + 100 - random(200);
rain_origin.y = player.y + 100 - random(200);
rain_origin.z = player.z + 500;
ent_create(rain_tga, &rain_origin, rain_sprites);
wait (1);
}
}

function rain_sprites()
{
set ( my, PASSABLE | TRANSLUCENT | BRIGHT /*| UNLIT*/ ) ; // remove the comment to increase the brightness of the rain sprites
my.alpha = 20 + random(75);
my.ambient = 40 + random(60);

while (my.alpha > 0)
{
if (c_content(my.x, 0) == CONTENT_SOLID)
{
my.alpha = 0;
}
my.z -= (25 + random(30)) * time_step;
wait (1);
}
ent_remove(my);
}

function rain_sound()
{
if (rain_on)
{
rain_handle = snd_loop(rain_wav, 50, 0);
}
else
{
snd_stop(rain_handle);
}
}

/////////////////////////////////////////////////////////////////////////////////////////////

function toggle_fog()
{
fog1_on += 1;
fog1_on %= 2;
if (fog1_on)
{
camera.fog_start = 10;
d3d_fogcolor1.red = 55;
d3d_fogcolor1.green = 55;
d3d_fogcolor1.blue = 55;
fog_color = 1;
while (fog1_on)
{
camera.fog_end = 1000 + 400 * sin(0.05 * total_frames * time_step);
wait (1);
}
}
else
{
fog_color = 0;
}
}

/////////////////////////////////////////////////////////////////////////////////////////////

ENTITY *fading_ent =
{
type = "fader.mdl";
layer = 10;
alpha = 0;
pan = 90;
flags = TRANSLUCENT | SHOW;
view = camera;
x = 250; // 250 quants ahead of the view
y = 0;
z = 0;
}

function toggle_daynight()
{
day += 1;
day %= 2;
if (day)
{
while (day)
{
camera.ambient = minv(100, camera.ambient + 1 * time_step);
fading_ent.alpha = maxv(0, fading_ent.alpha - 1 * time_step);
wait (1);
}
}
else // night
{
while (!day)
{
camera.ambient = maxv(-100, camera.ambient - 1 * time_step);
fading_ent.alpha = minv(70, fading_ent.alpha + 1 * time_step);
wait (1);
}
}
}

/////////////////////////////////////////////////////////////////////////////////////////////


Regards.

Re: Amazing weather script, translation to Lite-C needed! [Re: 3dgs_snake] #341898
09/21/10 14:50
09/21/10 14:50
Joined: Sep 2007
Posts: 62
Germany
B
bodden Offline
Junior Member
bodden  Offline
Junior Member
B

Joined: Sep 2007
Posts: 62
Germany
Good translation, thanks 3dgs_snake.

Day is a little bit dark, so you can play with the fading_ent.alpha and the camera.ambient. But this is a matter of taste (actually you don't have much rainy days, that are bright as hell)

Re: Amazing weather script, translation to Lite-C needed! [Re: bodden] #341938
09/22/10 03:00
09/22/10 03:00
Joined: Sep 2010
Posts: 67
FutureRaptor Offline OP
Junior Member
FutureRaptor  Offline OP
Junior Member

Joined: Sep 2010
Posts: 67
There are some errors, in the script. Can you fix it pls?
thx

Re: Amazing weather script, translation to Lite-C needed! [Re: FutureRaptor] #341939
09/22/10 03:38
09/22/10 03:38
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
what errors are you getting?

Re: Amazing weather script, translation to Lite-C needed! [Re: badapple] #341940
09/22/10 04:34
09/22/10 04:34
Joined: Sep 2010
Posts: 67
FutureRaptor Offline OP
Junior Member
FutureRaptor  Offline OP
Junior Member

Joined: Sep 2010
Posts: 67
error in 'main' line 241: 'show' undeclared indentifier.
<flags = translucent / show; >
And btw if it makes any difference I am using A7 Pro.
oh yah and I tried fixing that with
flags = translucent / visible: and I am pretty sure it worked but then more errors come up...

Last edited by FutureRaptor; 09/22/10 04:40.
Re: Amazing weather script, translation to Lite-C needed! [Re: FutureRaptor] #341941
09/22/10 05:05
09/22/10 05:05
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
What version of 3dgs are you using? Because normally my translation works just fine (except the dark day blush ). Some of the flags were replaced in earlier version :
- VISIBLE by SHOW
- TRANSPARENT by TRANSLUCENT

I Use A7 7.86 Com

Re: Amazing weather script, translation to Lite-C needed! [Re: 3dgs_snake] #341945
09/22/10 06:59
09/22/10 06:59
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
flags = translucent / show;

well for one thing

/ should be |

but im geussing thats just the way you wrote it here and not in your script

try this ... change flags to flags2 = TRANSLUCENT | SHOW;

and see what happens

Re: Amazing weather script, translation to Lite-C needed! [Re: badapple] #341948
09/22/10 07:25
09/22/10 07:25
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
If TRANSLUCENT is combined with SHOW, it is not working (Il will be really black because entity alpha will not work); try this instead :

ENTITY *fading_ent =
{
type = "fader.mdl";
layer = 10;
alpha = 0;
pan = 90;
flags = TRANSLUCENT;
flags2 = SHOW;
view = camera;
x = 250; // 250 quants ahead of the view
y = 0;
z = 0;
}

But I really think that the problem is with the A7 version (the SHOW flag).

Re: Amazing weather script, translation to Lite-C needed! [Re: badapple] #341949
09/22/10 07:26
09/22/10 07:26
Joined: Sep 2007
Posts: 62
Germany
B
bodden Offline
Junior Member
bodden  Offline
Junior Member
B

Joined: Sep 2007
Posts: 62
Germany
I tried it with A8.02, works fine.

FutureRaptor, did you save the file as *.c? Otherwise it will not be interpreted as liteC.

Page 1 of 3 1 2 3

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1