Movement / weapon

Posted By: NL_3DGS_n00b

Movement / weapon - 01/06/08 21:14

Hello, I have been experimenting with Lite-C since yesterday, and made this small script:


ENTITY* weap_uzi;
action speler_act()
{
weap_uzi = ent_create("mac10.mdl",vector(10,10,10),NULL);
wait(2);
weap_uzi.pan = -80;
weap_uzi.tilt = -5;
while(1)
{
camera.x = me.x;
camera.y = me.y;`
camera.z = 90;
camera.pan = me.pan;
weap_uzi.x = camera.x + 75;
weap_uzi.y = camera.y + 175;
weap_uzi.z = camera.z - 40;
if(key_w == 1)
c_move(me,vector(15*time_step,0,0),nullvector,GLIDE);
if(key_s)
c_move(me,vector(-15*time_step,0,0),nullvector,GLIDE);
if(key_d)
me.pan -= 10*time_step;
if(key_a)
me.pan += 10*time_step;
wait(1);
}
}


I have a few questions about it:

1. How can I make my mouse make the camera look up, down, left and right? (Like in shooters)
2. How can I make the player invisible (where the camera is attached to)?
3. How can I attach a weapon to the player? I have used the script like this, the weapon shows in camera just fine, but when I turn around, the gun is staying at the same position, it only floats when the player moves.

Also, I tried to make a script which enables it to pick up a gun, but I dont know what MY.EMASK value I have to use to make the player touch the gun, so the gun action runs a predifined function with is defined before...

Already have tried this:

Code:
function uzifunc(){
ent_remove(me);
weap_uzi = ent_create("mac10.mdl",vector(10,10,10),NULL);
wait(2);
weap_uzi.pan = -80;
weap_uzi.tilt = -5;
while(1){
weap_uzi.x = camera.x + 75;
weap_uzi.y = camera.y + 175;
weap_uzi.z = camera.z - 40;
}
}
action uzi(){
my.emask |= ENABLE_IMPACT;
my.event = uzifunc;
}


(Offcourse I took out the UZI script out of the main player script.)
But it looks like the function is never called...
Posted By: Trooper119

Re: Movement / weapon - 01/06/08 23:37

I'd suggest looking in your \liteC\work\earthball.c file, it has a number of things, at the bottom is the code for moving the camera, lots of other examples exist in the AUM's you should check out too. I don't have the numbers with me but several of them do what you are trying to do.
Posted By: NL_3DGS_n00b

Re: Movement / weapon - 01/07/08 04:22

Thank you for your reply.
I will look into it.
© 2023 lite-C Forums