Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
0 registered members (), 631 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Requesting some scripts! (Player movement and...) #79802
06/27/06 21:16
06/27/06 21:16
Joined: Jun 2006
Posts: 14
P
Person99 Offline OP
Newbie
Person99  Offline OP
Newbie
P

Joined: Jun 2006
Posts: 14
I am requesting a script, and how to install the script to the character...

What I want to do:

- Control the player in third person view, and animate when key combos are pressed:
Example: You press up... The character does a walking forward animation... You press left... The character does a strafing left animation... You press right... The character does a strafing right animation... You press back... the character does a backward walking animation... You press back and left, the character does a walking backwards left diagonally animation... You press back and right, the character does a walking backwards right diagonally... You press uparrow and right, the character does a moving in a right forward diagonal direction...you press uparrow and left, the character does an animation of walking in a left forward animation... ECT.

-Add certian types of collision, like you can't walk through walls, and when you walk up to an item, you "Get on it".


Can anyone PLEASE help me with this?

Re: Requesting some scripts! (Player movement and...) [Re: Person99] #79803
06/27/06 22:16
06/27/06 22:16
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
Hi

Here you go
But it isn't tested, just wrote it right out of my mind
Code:
define speed,skill1;
define speed_x,skill1;
define speed_y,skill2;
define speed_z,skill3;

// Change these to fit your needs
define cam_dist,100; // Distance to camera
define cam_height,80; // Camera height
define movement_speed,10; // Movement speed
string stand_anim = "stand"; // Stand animation
string walk_anim = "walk"; // Walk/run animation

action thePlayer
{
// I'm the player ;)
player = me;

// Player main loop
while(my)
{
// Set speeds
my.speed_x = ((key_w | key_cur) - (key_s | key_cud)) * movement_speed;
my.speed_y = ((key_d | key_cur) - (key_a | key_cur)) * movement_speed;
my.speed_z = 0;

// Move me
c_move(my,vector(my.speed_x * time,my.speed_y * time,0),vector(0,0,my.speed_z * time),ignore_passable + glide);

// Animate
if(vec_dist(my.speed,nullvector) < 5)
{
ent_animate(my,stand_anim,my.skill46,ANM_CYCLE);
my.skill46 += 2 * time;
}
else
{
ent_animate(my,walk_anim,my.skill46,ANM_CYCLE);
my.skill46 += 8 * time;
}
my.skill46 %= 100; // Get the rest of a division by 100

// Set the camera position
camera.x = my.x + fcos(my.pan,cam_dist);
camera.y = my.y + fsin(my.pan,cam_dist);
camera.z = cam_height;

// Make the camera looking at the player
vec_set(temp,my.x);
vec_sub(temp,camera.x);
vec_to_angle(camera.pan,temp);

// Avoid endless loops
wait(1);
}
}



Re: Requesting some scripts! (Player movement and. [Re: Claus_N] #79804
06/28/06 02:23
06/28/06 02:23
Joined: Jun 2006
Posts: 14
P
Person99 Offline OP
Newbie
Person99  Offline OP
Newbie
P

Joined: Jun 2006
Posts: 14
THANKS!
This should work great if... I knew how to apply it.

How can I apply this to the level or character?

Re: Requesting some scripts! (Player movement and. [Re: Person99] #79805
06/28/06 08:08
06/28/06 08:08
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
Save it in a file, called e.g. "playerscript.wdl", and put it in your project's folder.
Open your level's WDL file (LEVELNAME.wdl), and find the "include" lines. Then add this:
include <playerscript.wdl>;


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