1 registered members (AndrewAMD),
1,089
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
random code
#214738
07/06/08 23:26
07/06/08 23:26
|
Joined: Aug 2006
Posts: 152 vector(200,45,338)
Marwan
OP
Member
|
OP
Member
Joined: Aug 2006
Posts: 152
vector(200,45,338)
|
wussup george , I copied a randomization code from your aum from the questions section , i dont remember which one , and i modified it and made it like this function bat_direction()
{
var index;
index = random(10);
var tempo = 0;
while (index > 0)
{
tempo = random (1);
if (tempo <= 0.2)
{
my.pan+=0*time_step;
}
if ((tempo > 0.2) && (random(1)<= 0.4))
{
my.pan+=10*time_step;
}
if ((tempo > 0.4) && (random(1) <= 0.6))
{
my.pan-=10*time_step;
}
if ((tempo > 0.6) && (random(1)<= 0.8))
{
my.tilt+=10*time_step;
}
if (tempo > 0.8)
{
my.tilt-=10*time_step;
}
index-=1;
}
} it was for saving quotes in a random way , i only changed the instructions the question is , whats the use of the index var , I replaced it with while loop , but it screwed it up the other question is that i cant see any randomization , because i watched the pan variable of the entity and it only keeps increasing , it dont decrease at all , and vice versa with the tilt variable , it only keeps decreasing and sorry for bothering you george
age:16
game design and
programming
experience:2 years
|
|
|
Re: random code
[Re: George]
#214848
07/07/08 18:22
07/07/08 18:22
|
Joined: Apr 2005
Posts: 3,076 Germany, NRW
rvL_eXile
3D Artist
|
3D Artist
Joined: Apr 2005
Posts: 3,076
Germany, NRW
|
I think hes confused about these Values (Pan/Tilt)... Add in the first line
my.pan%=360;
my.tilt%=360;
cYa Sebastian
Tutorials: [Blender]Terrain creation ENG/GER [Blender]Low Poly Tree Modeling [GIMP]Create a Texture for Terrains CLICK HERE
|
|
|
Re: random code
[Re: rvL_eXile]
#214935
07/08/08 09:53
07/08/08 09:53
|
Joined: Aug 2006
Posts: 152 vector(200,45,338)
Marwan
OP
Member
|
OP
Member
Joined: Aug 2006
Posts: 152
vector(200,45,338)
|
thanks george
I am trying to make some realistic movement for some flying bats , so I make them change their pan and tilt randomly and continously , as if they just flying around , and i made their moves look realistic , but i realized something wrong in their movement , so I watched the pan variable to see how does it change and i found it increasing only , it didnt decreasing even for a millisecond (assuming that the randomization changes every frame or sth like that ) so that means that there is no randomization at all I closed the engine and ran it again a couple of times , but it gives the same result , i forgot to tell you that the same thing happens to the tilt value
I want to know why is that happening ?
and thanks again
ps :thanks sebastian but that wasnt exactly my point
age:16
game design and
programming
experience:2 years
|
|
|
Re: random code
[Re: George]
#215435
07/11/08 07:46
07/11/08 07:46
|
Joined: Oct 2004
Posts: 1,655
testDummy
Serious User
|
Serious User
Joined: Oct 2004
Posts: 1,655
|
'I' would like a peek at that snippet, but there isn't time to look it up in an AUM index, at the moment.
// C-Script, 6.60
// use or ignore
// sample only
// untested
define _tm1, skill52; // time counter for entity
define _dir1, skill53; // dir = 1, or -1; pan
define _dir2, skill54; // dir = 1, or -1 ; tilt
var mo = 0; // time, time_step, synonym
var n1 = 0; // temp var
var n2 = 0; // temp var
var nStepPan = 5; // step for pan
var nStepTilt = 5; // step for tilt
function batty_f1() {
timef();
my.passable = ON;
my._tm1 = max(my._tm1 - mo, 0); // check that for inaccuracy
if (my._tm1 <= 0.002) {
my._tm1 = max(random(10), 1) * 16;
if2(random(1) > 0.5, n1, 1, -1);
if2(random(1) > 0.5, n2, 1, -1);
my._dir1 = n1;
my._dir2 = n2;
}
if (random(1) > 0.45) {
my.pan += my._dir1 * nStepPan * mo;
my.tilt += my._dir2 * nStepTilt * mo;
my.tilt = clamp(my.tilt, -45, 45);
}
temp.x = 5 * mo;
temp.y = 0;
temp.z = 0;
c_move(me, temp, nullvector, IGNORE_PASSABLE);
}
action batty_a1 {
while(me != NULL) {
batty_f1();
wait(1);
}
}
Tips hat at George. 'I' hope that 'you' are faring well.
|
|
|
Re: random code
[Re: George]
#215601
07/12/08 11:07
07/12/08 11:07
|
Joined: Aug 2006
Posts: 152 vector(200,45,338)
Marwan
OP
Member
|
OP
Member
Joined: Aug 2006
Posts: 152
vector(200,45,338)
|
well , that should do it , but still one more something I need to know , How does the index var help , I saw it too in the script of the booker from the aum 72 code , nd its still confusing me , of course its not a predefined var , is it?
Last edited by Marwan; 07/12/08 11:46.
age:16
game design and
programming
experience:2 years
|
|
|
|