Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (7th_zorro), 793 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Ents Animating at the same time #131002
05/21/07 22:55
05/21/07 22:55
Joined: Aug 2005
Posts: 155
USA San Diego CA
Scramasax Offline OP
Member
Scramasax  Offline OP
Member

Joined: Aug 2005
Posts: 155
USA San Diego CA
I'm not sure were to post this, but when I add entites that share the same model, they animate at the same time. So if I tell one entity to animate it animates them all.

Code:
 

function anim_plantidle()
{
var percent =0;
var animRate =60;
var animThresh =99.5;
if(my.flag1==1)
{
animRate =plantAnimRate;
}
while(1)
{
percent +=GetSeconds()*animRate;
if(percent>=animThresh)
{
percent =0;
}
ent_animate(my,"idle",percent,0);
if(plantMode!=kPlantIdle)
{
return;
}
wait(1);
}
}




www.moxiefish.com George Lancaster
Re: Ents Animating at the same time [Re: Scramasax] #131003
05/22/07 02:18
05/22/07 02:18
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
what you need to do is call a global variable, for example, ent_number and in the action for it, add these two lines:

ent_number += 1;
my.skill67 = ent_number;

you can use whatever skill you want, as long as you're not using it already in the current action/function. adding those few lines of code, will keep each entity with the same action from conflicting

Code:

var ent_number;

function anim_plantidle()
{
ent_number += 1;
my.skill67 = ent_number;
var percent =0;
var animRate =60;
var animThresh =99.5;
if(my.flag1==1)
{
animRate =plantAnimRate;
}
while(1)
{
percent +=GetSeconds()*animRate;
if(percent>=animThresh)
{
percent =0;
}
ent_animate(my,"idle",percent,0);
if(plantMode!=kPlantIdle)
{
return;
}
wait(1);
}
}




- aka Manslayer101
Re: Ents Animating at the same time [Re: mpdeveloper_B] #131004
05/22/07 17:23
05/22/07 17:23
Joined: Aug 2005
Posts: 155
USA San Diego CA
Scramasax Offline OP
Member
Scramasax  Offline OP
Member

Joined: Aug 2005
Posts: 155
USA San Diego CA
Thanx, it helped some, but when if I set my.cast=ON it goes back to thinking it's the same entity.

Also if I set my.shadow=ON and leave my.cast=OFF, it animates the shadow of the first entity of the same type.

I have shadow_stencil=on if that matters.

It would be nice to have shadows if possible.

Thanx for any help.

Code:

////////////////////////////
//plant.wdl
/////////////////
//a quazi dynamic plant that reacts do dinos
/////////////////

DEFINE kPlantNada 0;
DEFINE kPlantIdle 1;
DEFINE kPlantN 2;
DEFINE kPlantS 3;

DEFINE plantAnimRate my.skill1;
DEFINE plantMode my.skill40;
DEFINE plantWasMode my.skill41;
DEFINE plantNum my.skill42;

var gNumPlants;

function update_dinoplant()
{
while(1)
{
if(dinomgr_dinoHit(40)==1)
{
var dinoDir;
var plantDir;
var dot;
vec_for_angle(dinoDir,dinoTmp.pan);
vec_for_angle(plantDir,my.pan);
dot =vec_dot(plantDir,dinoDir);
//dotProduct =vec_dot(dinoDir,plantDir);

if(dot<0)
{
plantMode =kPlantN;
}
else
{
plantMode =kPlantS;
}

return;
}
wait(1);
}
}

function anim_plantidle()
{
my.skill67 =random(10000);
var percent =0;
var animRate =60;
var animThresh =99.5;
if(my.flag1==1)
{
animRate =plantAnimRate;
}
while(1)
{
percent +=GetSeconds()*animRate;
if(percent>=animThresh)
{
percent =0;
}
ent_animate(my,"idle",percent,0);
if(plantMode!=kPlantIdle)
{
return;
}
wait(1);
}
}

function anim_plantN()
{
my.skill67 =random(10000);
var percent =0;
var animRate =90;
var animThresh =99.5;
ent_animate(me,NULL,0,0);
if(my.flag1==1)
{
animRate =plantAnimRate;
}
while(1)
{
percent +=GetSeconds()*animRate;
if(percent>=animThresh)
{
percent =0;
plantMode =kPlantIdle;
return;
}
ent_animate(my,"north",percent,0);

wait(1);
}
}

function anim_plantS()
{
my.skill67 =random(10000);
var percent =0;
var animRate =90;
var animThresh =99.5;
ent_animate(me,NULL,0,0);
if(my.flag1==1)
{
animRate =plantAnimRate;
}
while(1)
{
percent +=GetSeconds()*animRate;
if(percent>=animThresh)
{
percent =0;
plantMode =kPlantIdle;
return;
}
ent_animate(my,"south",percent,0);

wait(1);
}
}

function update_plant()
{
plantNum =gNumPlants;
gNumPlants+=1;
plantWasMode =kPlantNada;
plantMode =kPlantIdle;
// my.shadow =ON;
// my.cast =ON;
while(1)
{
//start-up
if(plantMode==kPlantIdle && plantWasMode==kPlantNada)
{
anim_plantidle();
update_dinoplant();
}

if(plantMode==kPlantIdle && (plantWasMode==kPlantN || plantWasMode==kPlantS))
{
anim_plantidle();
update_dinoplant();
}

//idle to plant getting bent forward
if(plantMode==kPlantN && plantWasMode==kPlantIdle)
{
anim_plantN();
}

//idle to plant getting bent forward
if(plantMode==kPlantS && plantWasMode==kPlantIdle)
{
anim_plantS();
}

plantWasMode =plantMode;

wait(1);
}
}

action plant_action
{
update_plant();
}

action plant_action2
{
update_plant();
}

action plant_action3
{
update_plant();
}





www.moxiefish.com George Lancaster
Re: Ents Animating at the same time [Re: Scramasax] #131005
05/22/07 18:12
05/22/07 18:12
Joined: Aug 2005
Posts: 155
USA San Diego CA
Scramasax Offline OP
Member
Scramasax  Offline OP
Member

Joined: Aug 2005
Posts: 155
USA San Diego CA
Testing it some more I found that turning off:
shadow_stencil =0;
Makes it so the entities don't animate at the same time. I've seen a similar post about a year ago, but none responded. Is this a know bug?


www.moxiefish.com George Lancaster
Re: Ents Animating at the same time [Re: Scramasax] #131006
05/22/07 21:53
05/22/07 21:53
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
Concerning the code posted by you, if I were qualified to offer recommendations, I would strongly recommend that you do not try to do THAT in THAT manner.
You might try to look up "DirectX Mesh Animation Problem" in the bugs section of a later version of the 3DGS manual.
But that is only a type of 'guess'.

Re: Ents Animating at the same time [Re: testDummy] #131007
05/23/07 17:22
05/23/07 17:22
Joined: Aug 2005
Posts: 155
USA San Diego CA
Scramasax Offline OP
Member
Scramasax  Offline OP
Member

Joined: Aug 2005
Posts: 155
USA San Diego CA
Well thanx. I turned off shadow_stencil and it works great. Had to put in a bsp block for the ground to see shadows.

I guess the engine to save rendering time stencils out one shadow for all the same models?

PS(Thanx Manslayer for your help. I never knew about the entity and how you differentiate it as an individual.)


www.moxiefish.com George Lancaster

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