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
1 registered members (TipmyPip), 18,631 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
passing perimeters to actions #282807
08/03/09 20:41
08/03/09 20:41
Joined: Apr 2009
Posts: 141
dakilla Offline OP
Member
dakilla  Offline OP
Member

Joined: Apr 2009
Posts: 141
is it possible to pass perimeters to actions because i am having some trouble with a game i have been making.

i am trying to make a script so that to create an "enemy" i just have to call a function and set a few perimeters. for instance:

create_enemy(ENTITY* ent, var health, var attack, var defence);

this way i was hoping that i could create multiple enemys without having to insert another "chunk" of code.

so overall i am asking:

is there a way to pass parimeters to actions?
and if not:
which way should i tackle this problem?

thanks.


One day there will be an unfixable bug,
That day is not today.
Re: passing perimeters to actions [Re: dakilla] #282815
08/03/09 21:52
08/03/09 21:52
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
Is something like this what you're looking for? smile

Code:
ENTITY* create_enemy(STRING* _mesh,VECTOR* _pos,var _health, var _attack, var _defense)
{
	you = ent_create(_mesh,_pos,enemy_action);
	you.health = _health;
	you.attack = _attack;
	you.defense = _defense;
	
	return you;
}



Edit: I don't know whether you can use "ENTITY*" as a return type (though I don't see why not), but otherwise you could always just return a handle then.

Last edited by Claus_N; 08/03/09 21:54.

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