Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (rki), 426 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[solve] Lite-c skill100 above #470269
01/06/18 06:57
01/06/18 06:57
Joined: Feb 2003
Posts: 146
RP China
2
20BN Offline OP
Member
20BN  Offline OP
Member
2

Joined: Feb 2003
Posts: 146
RP China
Hi, all
How to define EMTITY sub-functions over 100 skill? (skill[0]-skill[99])
I need more skills (7000 above).


Last edited by 20BN; 01/13/18 16:18.
Re: Lite-c skill100 above [Re: 20BN] #470278
01/06/18 11:53
01/06/18 11:53
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
you could create arrays or structs for each entity and save a pointer for them in one skill. This way you can have unlimited data for each entity.


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: Lite-c skill100 above [Re: painkiller] #470281
01/06/18 16:07
01/06/18 16:07
Joined: Feb 2003
Posts: 146
RP China
2
20BN Offline OP
Member
20BN  Offline OP
Member
2

Joined: Feb 2003
Posts: 146
RP China
@painkiller THANKS.

typedef struct MORESKILL
{
ENTITY* ent;
var custom_value[1000];
....

}MORESKILL

But, how to link ENTITY* ent ?

set
MORESKILL.ent = my;
and use
MORESKILL.custom_value[x]?

THANKS AGAIN.

Re: Lite-c skill100 above [Re: 20BN] #470282
01/06/18 18:53
01/06/18 18:53
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Something like this should do the trick:

Code:
#define entMoreSkill skill100

MORESKILL* moreSkillCreate()
{
	MORESKILL* more;
	
	more = (MORESKILL*)sys_malloc(sizeof(MORESKILL));
	
	return more;
}


void moreSkillDestroy(MORESKILL* more) // call this on_ent_remove if skill100 != 0
{
	sys_free(more);
}


...

MORESKILL* more = (MORESKILL*)my.entMoreSkill;
if(!more) my.entMoreSkill = more = moreSkillCreate();
more.custom_value[x] = 137.1;



"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Lite-c skill100 above [Re: Superku] #470287
01/07/18 12:21
01/07/18 12:21
Joined: Feb 2003
Posts: 146
RP China
2
20BN Offline OP
Member
20BN  Offline OP
Member
2

Joined: Feb 2003
Posts: 146
RP China
@Superku
Thank you so much. All entities was unlimited now.
But other void how to point entity custom skill?

Code:
void attack()
{
/*
    HOW TO POINT test_me'S more.custom_value[x] IN THIS FUNCTION?
*/
}

void movement(ENTITY* target_ent, var num......)
{
.....
}

action test_me()
{
MORESKILL* more = (MORESKILL*)my.entMoreSkill;
if(!more) my.entMoreSkill = more = moreSkillCreate();
more.custom_value[x] = 137.1;
......
    while(my)
    {
        .....
        movement(my, more.custom_value[x].....);
        wait(1);
    }

}


Last edited by 20BN; 01/07/18 12:24.
Re: Lite-c skill100 above [Re: 20BN] #470303
01/07/18 20:23
01/07/18 20:23
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Assuming I got you correctly you can give the following a try:

Code:
#define moreSkillGetForEnt(ent) ((MORESKILL*)ent.entMoreSkill)


void attack()
{
	MORESKILL* more = moreSkillGetForEnt(ent);
	... use more.custom_value[x] here
}

void movement(ENTITY* target_ent, var num......)
{
	MORESKILL* more = moreSkillGetForEnt(ent);
	.....
}

action test_me()
{
	MORESKILL* more = my.entMoreSkill = moreSkillCreate(); // create once at start of entity function
	more.custom_value[x] = 137.1;
	......
    while(my)
    {
        .....
        movement(my, more.custom_value[x].....);
        wait(1);
    }
}



"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Lite-c skill100 above [Re: Superku] #470327
01/08/18 15:12
01/08/18 15:12
Joined: Feb 2003
Posts: 146
RP China
2
20BN Offline OP
Member
20BN  Offline OP
Member
2

Joined: Feb 2003
Posts: 146
RP China
@Superku
Amazing!!! Big thanks!
I PM some message to you.

Last edited by 20BN; 01/08/18 15:13.

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

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