Jump to content
Sign in to follow this  
Macser_old

OFP:Calling animation from script

Recommended Posts

Hey man,how ye doin?

I may have to accept defeat on this

and move on.As it is,I've tried all of your

suggestions myself before,but no luck.

It seems in code terms the "driver" stays the driver,

until another unit hops in.I thought the Eh might

have something to do with it,so I tried taking it out of the .Cpp,

and running the script from a trigger.Again, no luck.

The "dead body" of the ejected unit suddenly jumps to the

"footDown" anim,as soon as the bike comes to a halt.

I might have to try just keeping the driver on the bike.

As for the getpos command,I've tried that on both the

Vehicle and the driver with no result.It's mind boggling.

It works perfectly in a trigger,but not in script form.

You thought I was workin on arma?Yes?

It's gettin confusing isn't it?

Maybe with Arma pickin up momentum,a new forum would

be a good idea.That or kill off the old OFP die hards like meself.

wink_o.gif

Still, if I can't resolve an Ofp issue then I won't have much

luck with arma.Besides,atm I can't afford a new rig to run it.

Running a game on a machine that can't handle it,ruins

the enjoyment for me.

Anyway,thanks Unicorn.

Macser smile_o.gif

Share this post


Link to post
Share on other sites

Just to confirm... you tried something like this?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_veh = _this select 0

#CHKSPEED

_unit = driver _veh

~1

?!(alive _veh):exit

?!(alive _unit):exit

?(IsNull _unit):exit

?speed _veh >=3:_unit Switchmove "ReconBikerFtUp"

#STATICLOOP

?speed _veh >=3:goto "staticLoop"

?speed _veh <10:_unit Switchmove "ReconBikerFtDwn"

#STATICLOOP2

?speed _veh <10:goto "staticLoop2"

goto "CHKSPEED"

I can't see why this wouldn't work... _unit will be set to the driver of the bike each time the script runs...

Try to add:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(crew _veh == 0):exit as well.

Who knows - maybe I'll see you in arma in a few year's time?

Share this post


Link to post
Share on other sites

Ye never know,I might get there before I qualify for

a pension. biggrin_o.gif

Anyway,I've tried all of the above,with no luck.

And the crew command gave an error.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

Error == : type array, expected number,string.object,side,group.

Well,I guess that tears it.

I'll have to make do with what I have. crazy_o.gif

Can't say we didn't try.

Thanks for the help Unicorn.

Macser smile_o.gif

Share this post


Link to post
Share on other sites

LOL, didn't think before typing that crew thing...

Use:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(count (crew _veh) == 0):exit

Share this post


Link to post
Share on other sites

That's ok,It didn't work anyway.

It doesn't look like there's a way

of releasin the "driver" from the vehicle.

It's a very unusual situation.It's proof,I

think,that the driver does indeed "become"

the vehicle.It's the only explanation.The script

continues to run after the "driver" dies,but while

the vehicle's still functional.Despite the exits,which

I verified with the hint command.

Only when the vehicle gets wasted,does the script

stop affecting the driver,and quit out.

Well,stumped again.

I wonder if the same exists in Arma?

Thanks again Unicorn.

Macser smile_o.gif

Share this post


Link to post
Share on other sites

Hi planck,

Just so I'm not confusing people,this is

primarily an Ofp issue I'm dealing with.

I was referring to the way the "occupant" of a vehicle seems to

become an "extension" of the vehicle.Only,it seems, being

released from it when another "driver" assumes control.

As it relates to my script,the script will exit

after the vehicle is destroyed.But continues to run

while the vehicle functions,but the "driver" is dead.

Here's what I have so far:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_veh = _this select 0

#CHKSPEED

_unit = driver _veh

~1

?!(alive _veh) : exit ------------

I used hint to

?!(alive _unit):exit -------------- verify these lines

actually exit.

?(IsNull _unit):exit --------------I know they're not all needed.

?(count (crew _veh) == 0):exit --

?speed _veh >=5 : _unit switchmove "ReconBikerFtUp"

#STATICLOOP

?speed _veh >=5 :goto "staticloop"

?speed _veh <5 : _unit switchmove "ReconBikerFtDwn"

#STATICLOOP2

?speed _Veh <5 : goto "StaticLoop2"

goto "CHKSPEED"

It's as if some element of the driver is "left behind",in the vehicle.

So regardless of the driver being in a deadstate,

the script still affects him.So basically, I don't know how

to separate them.Or, if it's possible with scripting.

Although I'm still In Flashpoint,I was curious to see if

the same is true of Arma.

Share this post


Link to post
Share on other sites

There are a few things you can try:

unassign your unit from the vehicle when he is dead, you can probably do this via a 'killed' eventhandler attached to the unit.

This will run a line to unassign and possibly also delete/eject him from the vehicle.

Hope it helps a bit.

Planck

Share this post


Link to post
Share on other sites

Thanks Planck,

I know that'll pretty much render the animations unavailable to

any "unit" types,other than my own.But in the

interests of curiosity,I'm gonna give it a try anyway.

As well as that,I'll gain a little more experience.

Much appreciated.

Macser smile_o.gif

Share this post


Link to post
Share on other sites

Well,after much searching and pulling out of hair, banghead.gif

then more experiments and more pulling out of hair.

I finally got what I was after. biggrin_o.gif

The really annoying thing is,it was again somethin

very simple.Ye see,I'd been looking for the most

complicated solution to my problem.And looking

in the wrong direction as well.

After some small but important edits:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_veh = _this select 0

#CHKSPEED

_unit = driver _veh

~1

?!(alive _veh) : exit

?speed _veh >=5 : _unit switchmove "ReconBikerFtUp"

#STATICLOOP

~.05

?!(alive _unit) :exit

?speed _veh >=5 :goto "staticloop"

?speed _veh <5 : _unit switchmove "ReconBikerFtDwn"

#STATICLOOP2

?speed _Veh <5 : goto "StaticLoop2"

goto "CHKSPEED"

Spot the difference.

In the previous version,the script checks the status of "_veh".

Then the status of "_unit".

Next, the first switchmove command is issued(reconBikerFtUp)

then the script moves into the first loop,where it cycles until

the speed drops below 5.

That was the problem.

While the script is in this loop,the status of "_unit"

won't be checked again,until the speed drops.

But the switchmove command will still be issued.

Ye see switchmove will work even if the driver's dead.

But with the status check in the first loop,it can exit before

the switchmove command can be executed.Which is precisely

what I wanted.Or rather gives me the visual effect I wanted.

Now,I also put a small "wait" in there,

just too slow down the loop a little.

I'm not sure how efficient this little script is.

So any ideas on optimizing it would be welcome.

But,in any case,the script performs the task I assigned it,ie;

calling custom animations based on a vehicle's speed.

Macser wink_o.gif

Share this post


Link to post
Share on other sites

Should've spotted it meself.

It was so simple,I overlooked it.

Good learnin experience.I'm kinda glad I found

it without too much prompting.

It was a long haul though. biggrin_o.gif

Thanks for all your help.

Macser smile_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×