2 registered members (AndrewAMD, 7th_zorro),
1,285
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
OP
Junior Member
|
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
Senior Member
|
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: badapple]
#341940
09/22/10 04:34
09/22/10 04:34
|
Joined: Sep 2010
Posts: 67
FutureRaptor
OP
Junior Member
|
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
Senior Member
|
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 ). Some of the flags were replaced in earlier version : - VISIBLE by SHOW - TRANSPARENT by TRANSLUCENT I Use A7 7.86 Com
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|