Gamestudio Links
Zorro Links
Newest Posts
Using ":L" & ":S" causes 2 possible bug(s) or is it bad coding?
by AndrewAMD
8 minutes 26 seconds ago
Help with Data import to T1
by OptimusPrime
Today at 19:44
How to ensamble multiple algos with advise calls?
by laz
Today at 18:53
Correlation -1.#IND00
by AndrewAMD
01/21/19 17:37
Basic thread safety question
by Superku
01/20/19 18:15
Blog Post: Get Historical Data from Darwinex REST API w/ Zorro
by AndrewAMD
01/19/19 22:19
Reseting a static variable - the next day
by OptimusPrime
01/19/19 19:48
AUM Magazine
Latest Screens
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Evonet Beta v1.0 : Online Project Development Template
Lake scene
Who's Online
12 registered (OptimusPrime, AndrewAMD, jacek, Dalla, kvm, Quad, Iglarion, ibne, misiek, 3 invisible), 489 Guests and 7 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
jthbln, laz, ramonne, SibJac, Evael
18157 Registered Users
Topic Options
Rate This Topic
#470269 - 01/06/18 07:57 [solve] Lite-c skill100 above
20BN Offline
Member

Registered: 02/08/03
Posts: 118
Loc: RP China
Hi, all
How to define EMTITY sub-functions over 100 skill? (skill[0]-skill[99])
I need more skills (7000 above).



Edited by 20BN (01/13/18 17:18)

Top
#470278 - 01/06/18 12:53 Re: Lite-c skill100 above [Re: 20BN]
painkiller Offline
Serious User

Registered: 08/23/09
Posts: 1438
Loc: 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

Top
#470281 - 01/06/18 17:07 Re: Lite-c skill100 above [Re: painkiller]
20BN Offline
Member

Registered: 02/08/03
Posts: 118
Loc: 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.

Top
#470282 - 01/06/18 19:53 Re: Lite-c skill100 above [Re: 20BN]
Superku Offline
Senior Expert

Registered: 09/13/03
Posts: 6795
Loc: 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

Superku The Game

Severely outdated footage: http://store.steampowered.com/app/407570

Top
#470287 - 01/07/18 13:21 Re: Lite-c skill100 above [Re: Superku]
20BN Offline
Member

Registered: 02/08/03
Posts: 118
Loc: 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);
    }

}



Edited by 20BN (01/07/18 13:24)

Top
#470303 - 01/07/18 21:23 Re: Lite-c skill100 above [Re: 20BN]
Superku Offline
Senior Expert

Registered: 09/13/03
Posts: 6795
Loc: 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

Superku The Game

Severely outdated footage: http://store.steampowered.com/app/407570

Top
#470327 - 01/08/18 16:12 Re: Lite-c skill100 above [Re: Superku]
20BN Offline
Member

Registered: 02/08/03
Posts: 118
Loc: RP China
@Superku
Amazing!!! Big thanks!
I PM some message to you.


Edited by 20BN (01/08/18 16:13)

Top


Moderator:  HeelX, Lukas, Rei_Ayanami, 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