2 registered members (AndrewAMD, Quad),
595
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Convert .wdl to lite-c ... I will pay you
#471567
03/10/18 08:43
03/10/18 08:43
|
Joined: Feb 2005
Posts: 67 USA
June
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2005
Posts: 67
USA
|
I have a lot of old (but good) WDL code from the days of A5 but am having a hard time converting it to Lite-C.
Some of it is easy to convert but I don't know what the Lite-C equivalent is for some of these movement functions.
I have A7 Extra currently.
Is there anyone on here who has the time or desire to convert this code to lite-c? I will pay you $5 USD with paypal. Is that worthwhile for you?
This is a code to animate a flying gib:
function wood_gib_action() { my.passable = ON; // Initiate MY._SPEED_X = 5 * (RANDOM(10) - 5); MY._SPEED_Y = 5 * (RANDOM(10) - 5); MY._SPEED_Z = RANDOM(35) + 5;
MY._ASPEED_PAN = RANDOM(35) + 35; MY._ASPEED_TILT = RANDOM(35) + 35; MY._ASPEED_ROLL = RANDOM(35) + 35;
MY.ROLL = RANDOM(180); //Start with random orientation MY.PAN = RANDOM(180);
MY.PUSH = -1; // Allow player/enemies to pass through
// Animate gib realtime
MY.SKILL9 = RANDOM(50); while(MY.SKILL9 > -35) { abspeed[0] = MY._SPEED_X * TIME; abspeed[1] = MY._SPEED_Y * TIME; abspeed[2] = MY._SPEED_Z * TIME;
MY.PAN += MY._ASPEED_PAN * TIME; MY.TILT += MY._ASPEED_TILT * TIME; MY.ROLL += MY._ASPEED_ROLL * TIME;
vec_scale(absdist,1);
MOVE ME,NULLSKILL,abspeed;
IF(BOUNCE.Z) { MY._SPEED_Z = -(MY._SPEED_Z/2); if(MY._SPEED_Z < 0.25) { MY._SPEED_X = 0; MY._SPEED_Y = 0; MY._SPEED_Z = 0; MY._ASPEED_PAN = 0; MY._ASPEED_TILT = 0; MY._ASPEED_ROLL = 0; } }
MY._SPEED_Z -= 2; MY.SKILL9 -= 1;
wait(1); }
// Fade gib to nothingness MY.transparent = ON; MY.alpha = 100; while(1) { MY.alpha -= 5*time; if(MY.alpha <=0) { remove(ME); return; }
wait(1); } }
June smooth-3d.com
|
|
|
Re: Convert .wdl to lite-c ... I will pay you
[Re: June]
#471570
03/10/18 10:16
03/10/18 10:16
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Hi! Please use code tags for posting your code, so it's more readable. You can find them in 'Switch to Full Reply Screen' or type by yourself like [code*] your code goes here [/code*]. Just remove * after 'code' words. About your code, it's a rip off from somewhere and it's not 'ripped' correctly (also, it's doing some simple stuff pretty 'wrong/dirty'.. so it's not the best solution for your needs). Anyway, I've converted it for you, no money needed, here is a working demo (I've done some changes to code, so it works correctly now):
function wood_gib_action(){
VECTOR speed, abspeed;
vec_fill(speed, 0);
vec_fill(abspeed, 0);
ANGLE angle_speed;
vec_fill(angle_speed, 0);
set(my, FLAG2 |SHADOW);
c_setminmax(my);
// Initiate
speed.x = 5 * (random(10) - 5);
speed.y = 5 * (random(10) - 5);
speed.z = random(35) + 5;
angle_speed.pan = random(35) + 35;
angle_speed.tilt = random(35) + 35;
angle_speed.roll = random(35) + 35;
my.roll = random(180); //Start with random orientation
my.pan = random(180);
my.push = -1; // Allow player/enemies to pass through
// Animate gib realtime
my.skill9 = random(50);
while(my.skill9 > -35){
abspeed.x = speed.x * time_step;
abspeed.y = speed.y * time_step;
abspeed.z = speed.z * time_step;
my.pan += angle_speed.pan * time_step;
my.tilt += angle_speed.tilt * time_step;
my.roll += angle_speed.roll * time_step;
c_move(my, nullvector, abspeed, IGNORE_PASSABLE | IGNORE_FLAG2);
if(HIT_TARGET){
speed.z = -(speed.z / 2);
if(speed.z < 0.25){
vec_fill(speed, 0);
vec_fill(angle_speed, 0);
// fix rotation, to it looks lying correctly on the floor
my.tilt = 0;
my.roll = 0;
}
}
speed.z -= 2 * time_step;
my.skill9 -= 1 * time_step;
wait(1);
}
// Fade gib to nothingness
set(my, TRANSLUCENT);
my.alpha = 100;
while(my){
my.alpha -= 5 * time_step;
if(my.alpha <= 0){ break; }
wait(1);
}
safe_remove(my);
}
void main(){
shadow_stencil = 2;
warn_level = 6;
fps_max = 60;
level_load("");
wait(3);
camera.arc = 90;
vec_set(camera.x, vector(-439, 0, 323));
vec_set(camera.pan, vector(0, -36, 0));
level_ent = ent_create(CUBE_MDL, nullvector, NULL);
vec_set(level_ent.scale_x, vector(128, 128, 0.1));
c_setminmax(level_ent);
set(level_ent, POLYGON);
int i = 0;
var counter = 1;
while(!key_esc){
counter += time_frame / 16;
if(counter > 1){ // spawn each second
for(i = 0; i < 32; i++){
ent_create(CUBE_MDL, vector(0, 0, 32), wood_gib_action);
}
counter -= 3;
}
// slow down framerate for testing
if(key_e){ fps_max = 20; }
else{ fps_max = 60; }
DEBUG_VAR(fps_max, 0);
wait(1);
}
}
Edit: also I have A7 Extra currently. Stop using A7. Switch to A8 Free, it's much better (less bugs, more up to date etc). I have a lot of old (but good) WDL code from the days of A5 but am having a hard time converting it to Lite-C. Feel free to share them with me, I could convert some interesting stuff (but only with condition on sharing it all on the forum for free, for other users).
|
|
|
Re: Convert .wdl to lite-c ... I will pay you
[Re: 3run]
#471605
03/10/18 20:30
03/10/18 20:30
|
Joined: Feb 2005
Posts: 67 USA
June
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2005
Posts: 67
USA
|
Hello 3run, Thank you for your conversion, it looks like it works Seeing this will certainly help me learn Lite-C. I will work on posting correctly in the future. The code may be a rip off yes or perhaps something from an old AUM? Its not the whole code I have, just the gib action. I have a massive amount of .wdl from when I used A5 many years ago and I don't necessarily lay claim to it. Any code I post is free for anyone to use (I'm mostly doing this for fun). I'm sifting through my .wdl stash looking for code gems at the moment, if I find something interesting I will share it. I would prefer to use A8 but my computer can't handle it for some reason (running windows 10), it crashes frequently so I have to use A7 until I get a different OS. Okay, I'm going to test this bad boy out. Thanks 3run.
June smooth-3d.com
|
|
|
Re: Convert .wdl to lite-c ... I will pay you
[Re: June]
#471610
03/11/18 00:44
03/11/18 00:44
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
I'm glad to be helpful Cool screenshots! Best regards!
|
|
|
|