Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (vicknick, AndrewAMD), 1,292 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
how to code ..... #112491
02/17/07 17:48
02/17/07 17:48
Joined: Jul 2004
Posts: 311
Aaron Offline OP
Senior Member
Aaron  Offline OP
Senior Member

Joined: Jul 2004
Posts: 311
I need to know how to code sounds in footsteps of different sounds depending on texture, and also how to put music in main menu??

Re: how to code ..... [Re: Aaron] #112492
02/17/07 18:32
02/17/07 18:32
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Main menu:
use media_loop()

Code:

//Volume for media
define MenuVol, 100;
//Sound File
string sndMMBG = "Menu.mp3";
//
var BGSound;
Function StartMenu()
{
BGSound = media_loop(sndMMBG, null, MenuVol);
}
Function EndMenu()
{
media_stop(BGSound);
}




Texture for footsteps:
Use a trace from the player to the ground. You can either name your textures starting with a x digit code such as dirtblabla.tga or graswhatever.bmp. Then in your trace include the flag scan_texture.

then you'd use string comparisons to get the tex name, copy and clip it to 4 (or so) digits, then use IF statements to figure out which sound to use...

Code:

//volume for footsteps
define StepVol, 100;
//
string tstr;
function PlayFootstep(Texname)
{
str_cpy(tstr, Texname);
var i;
i = str_len(tstr);
if (i < 5)
{return(0);}
i -= 4;
str_trunc(tstr, i);
//
if (str_cmpi(tstr, "dirt"))
{ent_playsound(my, sndStepDirt, StepVol); return(1);}
if (str_cmpi(tstr, "gras"))
{ent_playsound(my, sndStepGrass, StepVol); return(1);}
if (str_cmpi(tstr, "metl"))
{ent_playsound(my, sndStepMetal, StepVol); return(1);}
return(2);
}



Use:
call PlayFootstep(tex_name); after using a trace with the scan_texture flag.

returns:
0: the input string had less than enough characters
1: function ran successfully
2: No matching sound could be found

Code:

Function Footstep()
{
vec_set(temp, my.x);
temp.z -= 500;
c_trace(my.x, temp, scan_texture);
PlayFootstep(tex_name);
}




xXxGuitar511
- Programmer
Re: how to code ..... [Re: xXxGuitar511] #112493
02/17/07 22:30
02/17/07 22:30
Joined: Jul 2004
Posts: 311
Aaron Offline OP
Senior Member
Aaron  Offline OP
Senior Member

Joined: Jul 2004
Posts: 311
Also How do you in the script use animation controls like I am making a window first I want if any ojbect with any speed more than 5 mph if it hits the window a spirit appers on the glass that makes it look as the window is about to smash into peices then if another object hits it again it then will play my glass shatter animation with sound of smashing glass. I don't fully under stand how you guy's know how to do certain things lol, I do understand programming but I can't understand programming in video games I dont' fully know commands that the engine provides ect and how it can be used.

if you know a place where their is a whole list of the commands and what they do please do tell.

Re: how to code ..... [Re: Aaron] #112494
02/18/07 00:56
02/18/07 00:56
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
HI Aaron!

Have you read all or part of the AUMS. That's where I found out how many things work.

Hope this helps

Ottawa

Re: how to code ..... [Re: Ottawa] #112495
02/18/07 03:32
02/18/07 03:32
Joined: Jul 2004
Posts: 311
Aaron Offline OP
Senior Member
Aaron  Offline OP
Senior Member

Joined: Jul 2004
Posts: 311
I went through them and also I could understand what their doing but can't seem to get how you guy's out of the air write code, I mean if I know what bmap is fully is I am guess it's a code in the engine that loads a pic file which after that's used then after would be some kind of code on how you want it to function like as a button or a panel or as skin on a model ect that's if I am correct, but I don't know the codes for any physic's and 3d animation control, I know how to animate skin meaning if I wanted the person model to talk I could use a cheap way by making multiple skins and then using bmap load them in and then make a function, but like I want to do is make a code for a gate and a broken lock for a door so like when your player model walks into the door the door swings when then object is kinda pushing it well running into it the door opens more same type of thing that was used in manhunt the video game by rockstar games.

but the thing is I don't know what codes do what the building blocks I understand programming it's not the basic's I am not getting it's the commands used in this game engine, I want to know or have a list of all commands used in script for the engine that runs it and what it does meaning what job it does.

But I am right now mostly interested in learning all animation related controls code for the game engine, becuse I want to make a window that when a object hits it a 3mph or greater with at least weaight of 20 pounds a spirit pop's up and attaches itself to the glass kinda like the bullet hole concept, but this should make the glass look as if it was hit and about to break then when another object hit's it which the same criteria then the glass shatters but the shatter is a 3d animatied model of the window glass, I would need to know commands to control when the shattering takes place and I need to know phycis commands.

But I am getting closer and closer understanding this commands but still more to cover.

Thanks for your time.

Re: how to code ..... [Re: Aaron] #112496
02/18/07 06:12
02/18/07 06:12
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
1st) It's called the MANUAL... You will hear this very often, lol. It contains (almost) everything you need to know.

2nd) It's SPRITE (like the soda), not SPIRIT (like a ghost). sprites are simply images. The problem is, what you are trying to do (shattering on the window) requires decals, and A6 currently does NOT support this. However, it is an upcomming feature. However, you may also position a sprite along the window, but you'd have to carefully place your window so that the sprite does not show up anywhere past the window.

3rd) Writing code "from the air". Well, I wish it were simply in the air to grab, but it's not . In truth, I still use the manual, but rarely. After you've been writing it for >3 years, you start to remember basic concepts of how things work. However, sometimes you have to look up the syntax of a function (which parameters to use), like i do.


finally) I've seem to be helpin you out alot lately, so why stop now . First off, the gate code. Now, physics gates (like in Manhunt) are a little harder to make, so I'm just gonna give you one that opens when the player is close to it. You will need to put the origin of the model on one of the sides of the gate (where the hinges would be).

Code:

ACTION GATE
{
// Distance from center...
my.skill1 = 500;
//
// Gate Speed...
my.skill2 = 5;
//
// Gate Angle to swing to
my.skill3 = 130;
//
// Set center of gate...
var MCenter[3];
vec_set(MCenter, my.x);
vec_add(MCenter, my.max_x);
MCenter.x -= ((my.max_x - my.min_x) / 2);
MCenter.y -= ((my.max_y - my.min_y) / 2);
MCenter.z -= ((my.max_z - my.min_z) / 2);
//
// Wait until close enough...
while(vec_dist(MCenter, player.x) < my.skill1)
{wait(1);}
//
// Remember original pan angle...
my.skill11 = my.pan;
//
// contains angle to add to original angle
my.skill10 = 0;
//
// Wait until gate reaches angle
while(my.skill10 < my.skill3)
{
// increase gates angle by speed, but don't go too far!
my.skill10 = min(my.skill10 + (my.skill2 * time), my.skill3);
//
// Set pan to original pan + new angle
my.pan = my.skill11 + my.skill10;
wait(1);
}
//
// Done!
}



This is the most work I've ever put into a post, so I hope it's helpful. You're lucky you caught me in a good mood . As for animating, here's a short example...

Code:

// The name of the scene in MED (default: Frame)
string SceneGlassBreak = "Break";
//
// Speed to animate
var AnimSpeed = 10;
//
...
// variable for holding animate position (in percent)
var i = 0;
//
// cycle until animation is done
while(i < 100)
{
// increase i by AnimSpeed, but not past 100%
i = min(i + (AnimSpeed * time), 100);
//
// Animate entity (non cycling animation)...
ent_animate(my, SceneGlassBreak, i, null);
//
wait(1);
}
// Done!
...




Good luck!


xXxGuitar511
- Programmer
Re: how to code ..... [Re: xXxGuitar511] #112497
02/18/07 12:17
02/18/07 12:17
Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Nidhogg Offline
Serious User
Nidhogg  Offline
Serious User

Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Hey Guitar, Sorry to correct you, But isn't time succeded by time_step now.
Forget from what version though, 6.3 I think..

Also not a correction but info:- You must have a wait() in a while loop otherwise the engine crashes...


Windows XP SP3
Intel Dual Core CPU: E5200 @ 2.5GHz
4.00GB DDR3 Ram
ASUS P5G41T-M LX
PCIE x16 GeForce GTS 450 1Gb
SB Audigy 4
Spyware Doctor with AntiVirus
Re: how to code ..... [Re: Nidhogg] #112498
02/18/07 15:06
02/18/07 15:06
Joined: Jul 2004
Posts: 311
Aaron Offline OP
Senior Member
Aaron  Offline OP
Senior Member

Joined: Jul 2004
Posts: 311
thanks I am going to take a look at my manual but I check their one time in the beginning and I never found a list of commands used in the game engine, and I do know programming c++ and python, and I do know c coding, but it's the syntex for every project that's diffenent but I know programming basics.
the code is helpfull I am going to read it again when read to script I might now use your script becuse I feel cheap lol and plus I got to learn to code myself.

Re: how to code ..... [Re: Aaron] #112499
02/18/07 17:06
02/18/07 17:06
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
@Nidhogg: I didn't forget any wait(); statements... & time/time_step are the same. time hasn't been removed yet. But you are correct, I should start using time_step more... time is just a habit...


xXxGuitar511
- Programmer
Re: how to code ..... [Re: xXxGuitar511] #112500
02/18/07 19:08
02/18/07 19:08
Joined: Jul 2004
Posts: 311
Aaron Offline OP
Senior Member
Aaron  Offline OP
Senior Member

Joined: Jul 2004
Posts: 311
by the way I have A6 Pro v 6.1 and I don't use a6 temp's I use a5 temps becuse I try using a6 temps and I get script errors and the engine locks up, like I have to add scripts right?? and when I add pre-made scripts that come with the engine like plbip01 somthing likethat I the build of the level is ok but then I run it I get the a6 splash screen then a beep and then nothing happens after a while it then takes me back to wed. I would like to use the a6 temps someday, any ideas??? and is the latest v 6.50?? lol I am way out of date lol.

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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