Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

2 + looped scripts in MP = 4 FPS!

Page: 1 of 1
 shukrallah
03-01-2004, 2:02 AM
#1
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!
 Mercenary
03-01-2004, 3:25 AM
#2
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.
 lassev
03-01-2004, 1:47 PM
#3
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.
 Leslie Judge
03-01-2004, 5:29 PM
#4
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
 lassev
03-01-2004, 6:24 PM
#5
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.
 shukrallah
03-01-2004, 8:30 PM
#6
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"
 lassev
03-01-2004, 9:32 PM
#7
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...
 WadeV1589
03-01-2004, 9:40 PM
#8
isn't there dowait(x) ?

But then would that actually wait for the animation to finish......

Maybe wait(x) is the best method :p
 shukrallah
03-01-2004, 10:05 PM
#9
Yeah, theres a dowait.

The whole thing worked fine in single player. :( Ill try it out lassev, and see what happens.
 shukrallah
03-01-2004, 10:21 PM
#10
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?
 WadeV1589
03-01-2004, 10:56 PM
#11
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.
 shukrallah
03-01-2004, 11:39 PM
#12
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)
 shukrallah
03-01-2004, 11:56 PM
#13
ok, I got it. But, its angle is messed up. Ill probably be able to rotate it, or something :) hmmm.. wonder why my angle key things are not working, unless I put in the wrong angle....
 shukrallah
03-02-2004, 12:19 AM
#14
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
 lassev
03-02-2004, 7:06 AM
#15
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...
 Leslie Judge
03-02-2004, 2:02 PM
#16
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:
 lassev
03-02-2004, 2:47 PM
#17
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
 Emon
03-02-2004, 3:22 PM
#18
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.
 rgoer
03-02-2004, 3:44 PM
#19
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...
 Emon
03-02-2004, 5:47 PM
#20
I thought he had to just stand at a console and type?
 shukrallah
03-02-2004, 7:57 PM
#21
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.... :(
 Emon
03-02-2004, 8:29 PM
#22
That TIE is just a func_train.
 lassev
03-02-2004, 9:23 PM
#23
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...).
 shukrallah
03-02-2004, 9:42 PM
#24
Heh, I just recently learned func_trains.... for this :D

Anyways, I got it, except... the model is backwards. I used the angle keys, but it wont work... I guess i should try a new angle and see if it works.
Page: 1 of 1