Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,435 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
[algorithm] A_REPLICATOR - My little contribution #132678
05/30/07 12:07
05/30/07 12:07
Joined: Mar 2007
Posts: 18
A
ato Offline OP
Newbie
ato  Offline OP
Newbie
A

Joined: Mar 2007
Posts: 18
Hello!
There is my little contribution for the community of GameStudio
It's a simple action that replicate one or two objects. The code is below:

Code:

/*
A_REPLICATOR - A replicator entity utility :-)
Any kind of use is allowed but no warranty, use at your own risk!

STRINGS

string1 = first object to load
string2 = second object to load (leave blank for none)

SKILLS

1 = area width
2 = area depth
3 = area height
4 = number of objects to replicate
5 = scale axis X
6 = scale axis Y
7 = scale axis Z
8 = pan
9 = tilt
10 = roll
11 = random for pan
12 = random for tilt
13 = random for roll

14 = random % for scale X
15 = random % for scale Y
16 = random % for scale Z

17 = offset position X
18 = offset position Y
19 = offset position Z


FLAGS

1 = passable
*/

function f_replicated(){

if(you.flag1) {
my.passable = on;
}

var percent_x;
var percent_y;
var percent_z;

percent_x = you.SKILL5/100 * you.SKILL14;
percent_y = you.SKILL6/100 * you.SKILL15;
percent_z = you.SKILL7/100 * you.SKILL16;

my.scale_x = you.SKILL5 + random(percent_x);
my.scale_y = you.SKILL6 + random(percent_y);
my.scale_z = you.SKILL7 + random(percent_z);

my.x += you.skill17 * my.scale_x;
my.y += you.skill18 * my.scale_y;
my.z += you.skill19 * my.scale_z;

my.pan = - you.SKILL8/2 + random(you.SKILL11);
my.tilt = - you.SKILL9/2 + random(you.SKILL12);
my.roll = - you.SKILL10/2 + random(you.SKILL13);
}

function f_replica_objects() {
var width;
var depth;
var height;
var objects;
var scelta;

width = my.SKILL1;
depth = my.SKILL2;
height = my.SKILL3;
objects = my.SKILL4;

var conta = 0;
randomize();
while(conta<objects) {
conta +=1;
temp.x = my.x - width/2 + random(width);
temp.y = my.y - depth/2 + random(depth);
temp.z = my.z - height/2 + random(height);
if (my.string2 != NULL) {
scelta = int(random(2));
if(scelta==1){
ent_create(my.string1,temp,f_replicated);
}
else {
ent_create(my.string2,temp,f_replicated);
}
}
else {
ent_create(my.string1,temp,f_replicated);
}
}
}

action a_replicator {
f_replica_objects();
}



And this is an example result



*INSTRUCTIONS (VERY SIMPLE) *

Place the action a_replicator to any entity in your level. Use string1 and (if you want) string2 to store the filename of the entity to replicate.
See the code for skills and flags reference.

Have a nice coding and feedbacks are welcome!

Please note that this don't want to be a professional coding and don't want to replace the particle system too. It's only my discovering the gamestudio. Thank You!

Last edited by ato; 05/30/07 12:11.
Re: [algorithm] A_REPLICATOR - My little contribution [Re: ato] #132679
06/27/07 19:08
06/27/07 19:08
Joined: Jan 2006
Posts: 13
Kishinev, Moldova
Maxim Offline
Newbie
Maxim  Offline
Newbie

Joined: Jan 2006
Posts: 13
Kishinev, Moldova
Looks really nice

Re: [algorithm] A_REPLICATOR - My little contribut [Re: ato] #132680
06/27/07 19:22
06/27/07 19:22
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
Nice contribution, but it looks very much like C-Script and not Lite-C. Maybe put this script in User Contributions or C-Script forum section? You can update this script a little to make it work in Lite-C though.


smile

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

Gamestudio download | 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