Flying projectiles.

So i spawn many projectiles that flyes with random z velocity.

1)
in pshot Idle
Code:
	@script
		void self = getlocalvar("self");

			if(frame ==0){
		changeentityproperty(self,"velocity",60,rand()%4,0);
	    	}
	@end_script

In this way we have only 7 fly routs
3  2  1  0  -1  -2
what is looking in game rough.  :(

How to do float velocity  for increasing random results like
3.0    2.9    ..  0  ..  -3.0
?


2)And of course projectile must be destroyed when reached level z limits.
but i dont understand - is
PLAYER_MIN_Z and player_max_z
are same things from levels.txt
z 380 510 240
file data/levels/lv1.txt

They are showing different numbers
 
Thanks my friend - you're the only one who's kind to me  :)

1)rand()%40 / 10 i tryed this - but its rounded to int.
I tryed velocity = var = 40 and reduce it (-1) for every new projectile and its flying in same routs.

2)yeap! Your true. openborvariant("PLAYER_MIN_Z")
i used openborconstant("PLAYER_MIN_Z")
And they are showing different values  >:(
 
Bloodbane said:
1. Why not this:

rand()%40 / 10

2. Are you sure?

I usually acquire z limits with openborvariant("PLAYER_MIN_Z") and openborvariant("PLAYER_MAX_Z")


In C++ I remember something called randgen and you could determine the variable if would generate a random number and you could set the range like 1-12...or 1-20....it was a great piece of code to create d&d like RPG's since everything is usually determined by the roll of a dice in d&d. If a character had an armor class of 17 you could use the randgen code and set it to 1-20 so the attacker would have to generate a 17 just to hit the target  which made it a challenge to successfully attack unless the player had an attack bonus like  randgen +10....some things are coming back to me now and been reading my old C books lol
 
What about : rand()%40 * 0.1 ?

Uhhh, this openbor engine  ::)
I tryed before use float but its ended game with parsing error.And it gave me the confidence that float is not permited in velocity
I used .1, but not 0.1

And  * 0.1 working better than /10 - projectiles flying more randomly

"Thanks, Topper. I can kill again."
 
Back
Top Bottom