what

Non-platform specific questions.

what

Postby Agusstosus15 » Sun Oct 16, 2011 3:57 pm

what is the way to get animation name from getAllActorsInCollision? is this possible?
Agusstosus15
 
Posts: 59
Joined: Sun Oct 09, 2011 7:59 pm
Score: 0 Give a positive score

Re: what

Postby EvanBlack » Sun Oct 16, 2011 5:43 pm

Why would you want to do that?

I don't know about getting the animation name, but you can get the animation index or the animation position. Both are just as useful if not more.

That function returns an array of actor pointers, you just have to iterate through the array with a for loop.
(\__/) ( Soon... The world)
(O.o )< will be mine!____)
(> < )
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bunny Overlord 2012!
EvanBlack
 
Posts: 202
Joined: Fri Sep 30, 2011 10:17 am
Score: 19 Give a positive score

Re: what

Postby Agusstosus15 » Sun Oct 16, 2011 6:17 pm

to find animation name allow me to create actor i found that's why It would be very useful
Agusstosus15
 
Posts: 59
Joined: Sun Oct 09, 2011 7:59 pm
Score: 0 Give a positive score

Re: what

Postby EvanBlack » Sun Oct 16, 2011 7:21 pm

Make an array of all the animation names of the actor, then use the animation index to get the name from the array. You could do the same with all the actor names so you can just do this:

CreateActor(ActorNames[i], ActorAnimations[animationindex], ...)
(\__/) ( Soon... The world)
(O.o )< will be mine!____)
(> < )
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bunny Overlord 2012!
EvanBlack
 
Posts: 202
Joined: Fri Sep 30, 2011 10:17 am
Score: 19 Give a positive score

Re: what

Postby Agusstosus15 » Sun Oct 16, 2011 7:39 pm

i know that, but I have to got information about the actors inside the filled region actor
without that kind information i can't recognize the actor colliding with the filled region actor, so i can't created that specific actor, I'm not sure I'm make myself clear :(
Agusstosus15
 
Posts: 59
Joined: Sun Oct 09, 2011 7:59 pm
Score: 0 Give a positive score

Re: what

Postby EvanBlack » Sun Oct 16, 2011 7:55 pm

Make a char array holding all the animation names of a single actor

Get the actor's animation index from the colliding actor

Use the animation index to get the animation name from an Array


That is how you get the animation name from a colliding actor. But I still don't understand why you need the name when you can just use the index number. The index number is unique to the animation and is just as good as the name.

Ill make an example
(\__/) ( Soon... The world)
(O.o )< will be mine!____)
(> < )
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bunny Overlord 2012!
EvanBlack
 
Posts: 202
Joined: Fri Sep 30, 2011 10:17 am
Score: 19 Give a positive score

Re: what

Postby Agusstosus15 » Sun Oct 16, 2011 8:13 pm

and so, how to create actor using index of animation?
Agusstosus15
 
Posts: 59
Joined: Sun Oct 09, 2011 7:59 pm
Score: 0 Give a positive score

Re: what

Postby EvanBlack » Sun Oct 16, 2011 8:31 pm

char *getAnimName(int animIndex)

That function only get the animation name of the event actor.

That lets you get the animation name from the index, to get the index use: myActor.animindex




getAnimName: Get the name of an animation in Event Actor.
Return animation name if success, "" on error.

char *getAnimName(int animIndex)

animIndex: an animation index in the Event Actor.

Script Editor Syntax:
strcpy(text, getAnimName(0));
Attachments
CollidewithRegion.rar
(30.01 KiB) Downloaded 74 times
(\__/) ( Soon... The world)
(O.o )< will be mine!____)
(> < )
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bunny Overlord 2012!
EvanBlack
 
Posts: 202
Joined: Fri Sep 30, 2011 10:17 am
Score: 19 Give a positive score

Re: what

Postby Agusstosus15 » Sun Oct 16, 2011 10:12 pm

i want to get information of animname of all actors colliding with another filled region actor
Agusstosus15
 
Posts: 59
Joined: Sun Oct 09, 2011 7:59 pm
Score: 0 Give a positive score

Re: what

Postby EvanBlack » Sun Oct 16, 2011 10:34 pm

Code: Select all

Actor *ActorArray;
int NumOfColActors;
int i;
ActorArray = getAllActorsInCollision("Event Actor", &NumOfColActors);


for(i = 0; i < NumOfColActors; ++i)
{
    GlobalIndexArray[ActorArray[i].cloneindex] = ActorArray[i].animindex;
}


This code gets the animindex of all the colliding actors but doesn't store it. You would need to create a global array to store the animation names or indexs for later use. To get the names you would either have set an event inside each actor so when they collide with the region they send their Animation Name to a Global Variable or Array for each Actor. If you are using clones then you only need to do this for the main actor and each clone will have the event. Otherwise you need a function that does something and send the animation name to it. But right now you haven't given enough information to tell you how to do what you need to do.


If you are using clones the event would look like this:

MyActor->Collision (Any side of Region) -> Script Editor:
Code: Select all
GlobalAnimNameArray[cloneindex] = getAnimName(GlobalIndexArray[cloneindex]);


But even this code probably won't work because it has to happen in a specific order.
(\__/) ( Soon... The world)
(O.o )< will be mine!____)
(> < )
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bunny Overlord 2012!
EvanBlack
 
Posts: 202
Joined: Fri Sep 30, 2011 10:17 am
Score: 19 Give a positive score

Re: what

Postby Agusstosus15 » Sun Oct 16, 2011 11:35 pm

int n;
Actor *actors;

actors = getAllActorsInCollision("Event Actor", &n);



int i;
for(i = 0; i < n; i++)
{
createActor(actor[i].clonename, getAnimName(getAnimIndex(actor[i].clonename)), ....position i want
}
}
will crteate me all actors in collision at position i want?
Agusstosus15
 
Posts: 59
Joined: Sun Oct 09, 2011 7:59 pm
Score: 0 Give a positive score

Re: what

Postby EvanBlack » Sun Oct 16, 2011 11:54 pm

No.

you can't use a clone name to create an actor.

You also can't use getAnimName() like that, it will only get the animation name of the event actor, in this case the region. You need a global char array that would hold all the animation names of all your clones based on the clone index. Which means a 2D character array.

Example: if clone one has animation name of Anim1

GlobalAnimNameArray[1] == "Anim1"

You can initalize a Global Character Array for your animations as such:
Code: Select all
int NumOfClones = 3;

GlobalAnimNameArray[NumOfClones][32];

GlobalAnimNameArray[0] = "Anim0";

GlobalAnimNameArray[1] = "Anim1";

GlobalAnimNameArray[2] = "Anim2";


You also need a parent actor. This one uses the colliding actor as the parent.
Code: Select all
CreateActor(actors[i].name, GlobalAnimNameArray[actors[i].cloneindex], actors[i].clonename, "no Path", 0, 0, false);
(\__/) ( Soon... The world)
(O.o )< will be mine!____)
(> < )
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bunny Overlord 2012!
EvanBlack
 
Posts: 202
Joined: Fri Sep 30, 2011 10:17 am
Score: 19 Give a positive score

Re: what

Postby Agusstosus15 » Mon Oct 17, 2011 12:56 am

when I initiate Global the array still be exist when the event is over?
Agusstosus15
 
Posts: 59
Joined: Sun Oct 09, 2011 7:59 pm
Score: 0 Give a positive score

Re: what

Postby EvanBlack » Mon Oct 17, 2011 1:16 am

Use global script and initiate the global array there.

The button at the top Script

then go to Global Code

Type in your array.

Name your script and click Add.
(\__/) ( Soon... The world)
(O.o )< will be mine!____)
(> < )
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bunny Overlord 2012!
EvanBlack
 
Posts: 202
Joined: Fri Sep 30, 2011 10:17 am
Score: 19 Give a positive score

Re: what

Postby Agusstosus15 » Mon Oct 17, 2011 1:44 am

why you didn't place a second dimension of array?
Agusstosus15
 
Posts: 59
Joined: Sun Oct 09, 2011 7:59 pm
Score: 0 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest