Jump to content

Home

2 + looped scripts in MP = 4 FPS!


lukeskywalker1

Recommended Posts

Heres what I was going for in my duel map for the levelsource contest:

 

The map will have 1 imperial walking between 2 navgoals. 1 imperial constantly typing at a console, and a Tie flying around.

 

The problem is, it dropped my FPS to about 4. Really. I think its because the scripts are looped. But... i dont know any other way to do this. (And the tie fighter script isnt even done yet!!) I need help... basically. Thanks!

Link to comment
Share on other sites

I've written a script with an animation I was trying to loop and it killed my fps. In fact it was a console typing animation. Once I corrected the script it fixed the problem. If you can't figure it out maybe post the script here so we can have a look at it.

Link to comment
Share on other sites

Originally posted by Leslie Judge

Do you really need to loop the script? I mean you can set the NPC to play a typing animation and ask it to repeat it endlessly (set ANIM_HOLDTIME_BOTH to -1) so your script has to run only once. Or something... :D

 

I wouldn't count on that. And why? Because each and every one of the animation commands I have ever used (well, 99% anyway) are set to holdtime -1. And as far as I can see, they aren't repeated endlessly. Rather, they just play through once, and that's it.

Link to comment
Share on other sites

Yes, the animation HAS to be looped, this one doesnt continue for ever. Leslie Judge, thats what I tried from the start, that command doesnt work in MP (as far as I know, my script might not have worked) The animation played once, and that was it :(

 

Hmm. Remember also that setting an animation to a character won't take any time at all. So, you must have some kind of delay in your loop, to wait for the animation to finish, before it's launched anew.

 

Hmmmm, not what I wanted, but if it will fix the FPS...

 

take a look at my script guys:

 

//(BHVD)

 

affect ( "imperial2", /*@AFFECT_TYPE*/ FLUSH )

{

 

task ( "type" )

{

set ( /*@SET_TYPES*/ "SET_ANIM_BOTH", /*@ANIM_NAMES*/ "BOTH_CONSOLE1" );

set ( /*@SET_TYPES*/ "SET_ANIM_HOLDTIME_BOTH", -1 );

}

 

 

loop ( -1 )

{

do ( "type" );

}

 

}

 

 

Since Mercenary had the same problem, maybe its a bug with that animation. How could I add a 1 second pause between the animation?

I mean... theres one "do"

Link to comment
Share on other sites

I think the console animation is longer than one second? Or is it?

 

Try adding wait(enough milliseconds) after the do ( "type" ); in your script. If memory serves, I once tried something like that. Although I have no memory if it worked or not...

Link to comment
Share on other sites

Well, lassev, it worked perfectly. No pause between animations too ;) And good FPS. Thanks :D

 

1 more thing please.. I got my tie to fly with a misc_model_breakable (like normal) but there is no misc_model_breakable in MP. Ive tried Misc_model_static, but... it doesnt work. If you play the new siege_destroyer map, you see if the rebels win, the falcon flies by in the end. So I know you can move MD3s in MP. I decompiled the map, but cannot find the model :( I guess I should keep looking, but even if I do, how do I know that the script isnt just different?

Link to comment
Share on other sites

You can either a) specify a model2 key on an entity and then in-game that model is loaded dynamically and drawn wherever the origin brush is on the entity that it's the model2 key of or b) target a misc_model at an entity and then that model effectively becomes that entity so for instance if you target a misc_model at a door then when that door opens and closes the model will move with the door, same applies to func_static's (which you can script to move).

 

The main difference between the two if the player can't get near them is the model2 method requires lightdiffuse in the shaders (they effectively become dynamic models in game like a player or weapon is) while the misc_model method prefers lightmapped models or vertex lit models.

Link to comment
Share on other sites

same applies to func_static's (which you can script to move).

 

Wait, I tried that:

 

//(BHVD)

rem ( "makes tie fly" );

 

affect ( "Tie_fighter", /*@AFFECT_TYPE*/ FLUSH )

{

 

task ( "go" )

{

move ( $tag( "tie", ORIGIN)$, < 0.000 0.000 0.000 >, 1000.000 );

}

 

do ( "go" );

}

 

 

Whats wrong with it? The misc_model_static model shows up in game, and I gave it a script_targetname Tie_fighter. I put a ref_tag where I wanted the model to move to. I gave it a targetname tie. :( I dont understand, since it worked fine with a misc_model_breakable (Same exact script)

Link to comment
Share on other sites

hmmm... was working :(

 

Is this even possible:

 

//(BHVD)

rem ( "makes tie fly" );

 

affect ( "Tie_fighter", /*@AFFECT_TYPE*/ FLUSH )

{

 

task ( "go" )

{

move ( $tag( "fly1", ORIGIN)$, < 0.000 0.000 0.000 >, 2000.000 );

}

 

 

task ( "go2" )

{

move ( $tag( "fly2", ORIGIN)$, < 0.000 0.000 0.000 >, 0.000 );

}

 

 

loop ( -1 )

{

dowait ( "go" );

dowait ( "go2" );

wait ( 30000.000 );

}

 

}

 

 

Thanks... BTW, look for your names in my readme, because... well.. scripting in MP is new to me... I got SP down, but MP is like a whole new arena. Thanks :D

Link to comment
Share on other sites

Looks like a sensible script to me. Although I will make two remarks:

 

1) Why do your move commands look like this:

move ( $tag( "fly1", ORIGIN)$, < 0.000 0.000 0.000 >, 2000.000 );

 

When I use move commands, they look like this:

move ( $tag( "elevaattori_up", ORIGIN)$, 10000.000 );

 

So, I don't have those numbers for absolute values at all in my commands...

 

2) If you want to maximize the probability of your scripts working, don't use the wait("task") command (or dowait("task")) at all, rather, just do and then wait milliseconds. If this is critical at all, I cannot say, but after my Team Corellia problems and what Jesterspaz said at LevelForge.Teamhuh forums, I wouldn't count too much on those waiting("task") commands...

Link to comment
Share on other sites

Originally posted by Leslie Judge

Soo.... we can say ICARUS II not equals to ICARUS II. :) Interesting and good to know.

 

It is clear now for everybody that I've spent years with JA MP scripting. :mrgreen:

 

Yeah. Sure, you can put it that way. It's tricky business.

 

(And I'm positively sure I have no idea what-so-ever what you actually meant with that comment of yours, LJ). :p

Link to comment
Share on other sites

Use a func_train (there may be other entities that are capable, I have not checked) and use a model2 or whatever and have it point to the Imperial GLM, then tell it the frames for the animation you want to loop (frames out of the total 17K or whatever, look in ModView), and check the spawnflag or set the key (don't remember which) to make it loop. The func_train itself should just be origin and no draw, have two path_corners that target each other (like if you wanted something to move back and forth) then put them on top of each other.

Link to comment
Share on other sites

A one-corner func_train works great for that application when you've got an NPC standing still, but using a moving func_train to simulate a moving NPC would look awful... walk forwards to one corner, walk backwards back to the beginning, rinse, repeat...

Link to comment
Share on other sites

Heres what I have done:

 

I got the NPC to walk back and forth, no problem

I got the NPC to type, forver, no problem

I got the MD3 to move, 1 time, but I want it looped. :(

 

Anyways, since redfella posted the results, I figured he is going to be putting the map pack together soon (for the contest thingy, if mine is even going to be included) so i just kep what i had, and took the tie out, and sent it to him.

 

But anyways, I still plan on making an FFA map.

 

Use a func_train (there may be other entities that are capable, I have not checked) and use a model2 or whatever and have it point to the Imperial GLM, then tell it the frames for the animation you want to loop (frames out of the total 17K or whatever, look in ModView), and check the spawnflag or set the key (don't remember which) to make it loop. The func_train itself should just be origin and no draw, have two path_corners that target each other (like if you wanted something to move back and forth) then put them on top of each other.

 

I could use a MD3 right? well.. then again, it would look bad, because the tie cant turn..... :(

 

Maybe its just simply not possible. But then again, even in JK2 MP, they got a ship to fly through Nar Shaddaa (spelling?) And scripting, wasnt, or shouldnt have been possible back then ;)

 

Ill decompile that map and see how they did it.

 

When I use move commands, they look like this:

move ( $tag( "elevaattori_up", ORIGIN)$, 10000.000 );

 

So, I don't have those numbers for absolute values at all in my commands...

 

I used to do that, thats what I was using for my movie... but now, I dont seem to be able to figure out how I did it. :( I cant remember where I learned to make scripts like that either.... :(

Link to comment
Share on other sites

Yeah, I would also do it with a func_train (although I normally always promote func_statics just for the fun of scripting). There's a really nice selection of flags for func_trains in the path_corner entity. You can control the speed between any path_corner and the next one individually, you can make the func_train to automatically turn to face the next path_corner. If I remember correctly, you can make the func_train invisible between any predefined connected path_corners.

 

Yeah, and for smooth movement, you can just add any number of path_corners, and it won't mean any more work to you (even the targeting is bloody easy).

 

Well, I guess you knew that all already (well, damn it, I only learnt it so recently for Team Corellia...).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...