Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
2 registered members (steyr, alibaba), 534 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
defining entities #339043
08/24/10 04:40
08/24/10 04:40
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
Ok so is there an easy way to pre define entities? Something like...

entity* weapon1 = "gun.mdl";

would be awesome! Sadly, I have tried many methods and none of them even boot! I am using the newest version of 3dgs btw...

Re: defining entities [Re: exile] #339048
08/24/10 06:28
08/24/10 06:28
Joined: Aug 2008
Posts: 482
B
bart_the_13th Offline
Senior Member
bart_the_13th  Offline
Senior Member
B

Joined: Aug 2008
Posts: 482

Re: defining entities [Re: bart_the_13th] #339054
08/24/10 08:40
08/24/10 08:40
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
Roel Offline
Senior Member
Roel  Offline
Senior Member

Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
pre define?

you can try this:
STRING* weapon1 = "gun.mdl";
and then use:
ent_create(weapon1,.....,.....);
I don't know if this is what you mean,
but maybe it helps.


Check out the throwing game here: The throwing game
Re: defining entities [Re: exile] #339061
08/24/10 09:30
08/24/10 09:30
Joined: Sep 2009
Posts: 987
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 987
Budapest
For example:
Code:
STRING* entname;
ENTITY* gun1;
...
function my_ent_create(ENTITY* myent, STRING* myentname) {
	STRING* myname;
	str_cpy(myname,myentname);
	myent=ent_create(myname);
}
...
function main() {
...
str_cpy(entname,"gun.mdl");
my_ent_create(gun1, entname);
...
}



It maybe seems to too complicated, but it has a lot of potential place in the code, to extend, to make it general and so on...
(not tested)

Last edited by Aku_Aku; 08/24/10 09:34.
Re: defining entities [Re: Aku_Aku] #339081
08/24/10 14:12
08/24/10 14:12
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Originally Posted By: Aku_Aku
For example:
Code:
STRING* entname;
ENTITY* gun1;
...
function my_ent_create(ENTITY* myent, STRING* myentname) {
	STRING* myname;
	str_cpy(myname,myentname);
	myent=ent_create(myname);
}
...
function main() {
...
str_cpy(entname,"gun.mdl");
my_ent_create(gun1, entname);
...
}



It maybe seems to too complicated, but it has a lot of potential place in the code, to extend, to make it general and so on...
(not tested)
Nice idea, but most of this wouldn't work and the rest of it's unneeded

Code:
STRING* entname; //unneeded
ENTITY* gun1;
...
function my_ent_create(ENTITY* myent, STRING* myentname) { //passed entity won't be set
	STRING* myname; //unneeded
	str_cpy(myname,myentname); //unneeded
	myent=ent_create(myname); //just use ent_create(myentname, NULL, NULL)
}
...
function main() {
...
str_cpy(entname,"gun.mdl"); //unneeded
my_ent_create(gun1, entname); //as above, won't set entity
...
}



try something like
Code:
ENTITY* gun1;

function my_ent_create(STRING* myentname) {
	you=ent_create(myentname, NULL, NULL);
	vec_fill(your.scale_x, 1);
	return(you);
}

function main() {
	gun1 = my_ent_create("gun.mdl");
}


although this isn't a way to 'predefine' entities

Re: defining entities [Re: MrGuest] #339176
08/25/10 04:24
08/25/10 04:24
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline OP
User
exile  Offline OP
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
Well the reason I am trying to pre-define entities is because I want to be able to have a bit more range in my pointers. I tried to use ent_morph, but the new entity still had the old function. Is there a way to change the function? For example...

entity* m4a1 = "ar15.mdl";
entity* g36 = "g36.mdl";
entity* m249 = "saw249.mdl";
entity* weapon_slot_1;

var weapon_ID;

function weapon_equip;
{
if(weapon_ID == 1)
{
weapon_slot_1 = m4a1;
weapon_slot_1.function = m4_assault_rifle;
}
if(weapon_ID == 2)
{
weapon_slot_1 = g36;
weapon_slot_1.function = g36_assault_rifle;
}
if(weapon_ID == 3)
{
weapon_slot_1 = m249;
weapon_slot_1.function = m249_hmg;
}
}

action player
{
ent_create(weapon_slot_1,my.x,weapon_equip);

rest of player code...
}


Hopefully my (terrible) code can give you an idea of what I am trying to achieve.

Re: defining entities [Re: exile] #339184
08/25/10 08:08
08/25/10 08:08
Joined: Aug 2008
Posts: 482
B
bart_the_13th Offline
Senior Member
bart_the_13th  Offline
Senior Member
B

Joined: Aug 2008
Posts: 482
Why would you go through all that?
IMHO, the difference of the weapons(except shotgun I think) is only in calibre(damage), rate of fire, mag size, and you can have only 1 single action for that, only the skills need to be changed, at least that what I did with Hi:breed


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