Page 1 of 1

Scale problems....

Posted: Mon Aug 02, 2004 9:41 pm
by G3mInI
I have this script that I found... its the multiplayer jeep and tank script. Well I am trying to modify it for a server side only mod. I can scale the tank with ease, but the turret stays the normal size. I have tried a few things but always get the error in console:

"Script Error: There are 0 entities with targetname "vehicles/kingcannon.tik". You are using a command that requires exactly one."

Here is the beginning of the script which initializes the tank variables...

Code: Select all

local.ent = spawn vehicles/kingtank.tik
local.ent.origin = local.origin
local.ent.angle = local.angle
local.ent.scale = 0.5 // this works great for the tank body
local.ent.gun = local.ent QueryTurretSlotEntity 0
local.ent.gun2 = local.ent QueryTurretSlotEntity 1
local.ent.projectile = "models/projectiles/tigercannonshell.tik"
local.ent.turret1 = "vehicles/kingcannon.tik"
//local.ent.turret1.scale = .5  // this does not work and creates the above error
local.ent.damagemdl = "vehicles/kingtank_d.tik"

I am also getting the same error when I try to scale the 'local.ent.damagemdl' variable. Console replies with the same error as stated above.

Now I have managed to actually scale the turret model in its tiki file, but that would not allow for a server side only mod. Is there a way I can scale the turret and the damaged model with server side only scripting ?

G3mInI

Posted: Mon Aug 02, 2004 10:13 pm
by lizardkid
well give it a tragetname like turret, and do

$turret.scale = xx.x

it's default targetname is it's modelname or a t1t2t4 thingie... give it a unique targetname and try it again.

Posted: Mon Aug 02, 2004 10:15 pm
by bdbodger
The turret is spawned from the tik the thing you must scale is local.ent.gun and you can't change the scale of the damaged model until after it has been spawned .

Posted: Mon Aug 02, 2004 10:22 pm
by lizardkid
a question about script spawning here...

why is it such a good thing to do this...

Code: Select all

local.what = spawn models/bla/bla_bl_a.tik
local.property = 123
local.targetname = thing
instead of

Code: Select all

spawn models/bla/bla_bl_a.tik "targetname" "thing" "property" "123"
wouldn;t using up a trillion variables to spawn junk into a map cause a lot of excessive code and be a memory hog? variables take up memory.

Posted: Tue Aug 03, 2004 5:14 am
by G3mInI
Ok got the damaged model scaling just fine now... however the turret is being quite stubborn. No matter where I try and scale it in the script, I either get 'there are 0 entities with targetname "vehicles/kingcannon.tik" or 'scale applied to null listener'.

Here is the script in its entirety. The tanks spawn and they are driveable, but I cannot scale the turret. I will add in //comments where I have tried to scale. I also seem to occasionally have an error with exiting the tank. For some reason every so often just your arm will exit and the body is fixed inside the tank still :( Although funny looking it is quite irritating. This script is used on Destroyed Village. If willing to help to just copy the code and name it mohdm2.scr. Put in main/maps/dm folder and have at it. I am stuck as it is. And this tank script really needs some refining. There is also a bounding box issue when the tank is scaled and when the damage tank spawns. The effect aren't right when the tank explodes. Reason for small tanks is I was attempting a server side only tank battle. 32 man server. Lots of tanks. 24 each side at least. I wanted a battle where last tank alive wins for that team. A lot to ask but I think it would be cool. The kingtiger tank as is, is way too big for destroyed village. So I am trying to make miniatures.

Code: Select all

Edited*  I removed the code while I work on it some more.
I  would not be too happy if someone just copied it, fixed the 
problems, and ran it on a server without letting me know how
also. So I am going to continue to work with this and do more
research. Someday I may get it working.

Peace,

G3mInI
If anyone wants to help me then great, if not, fully understand, its quite a task! Arrays and vectors confuse me and the numbers needed to make them work right. Will be taking a c++ course starting in 2 weeks. Maybe then I can get a better handle on things...

Peace out,
G3mInI

Posted: Tue Aug 03, 2004 6:39 am
by bdbodger
self spawnturret 0 self.turret1
self.gun = self queryturretslotentity 0

self.gun scale ?

Posted: Tue Aug 03, 2004 7:14 am
by jv_map
lizardkid wrote:wouldn;t using up a trillion variables to spawn junk into a map cause a lot of excessive code and be a memory hog? variables take up memory.
Do you have any idea how many variables fit in a MB :wink:

Well me neither because it depends on the type of variable used... but it would be a load I'm pretty sure :)

Posted: Tue Aug 03, 2004 3:10 pm
by lizardkid
well ya but my point was couldn't it be simpler and nicer to codewise (lines and al that) jsut use the spawn command? this has occured to me for a long time, and it always seemed to me you'd be making things more complex by having a trillion variables...

btw, i noticed Gemini that you have spawn points, n this same note can't you simply have the origins in the script without messing around with script_origins? jsut one line

Code: Select all

level.place1 = ( -1534.05 -227.15 -23.76 )
instead of

Code: Select all

level.place1 = spawn script_origin 
  level.place1.targetname = shermantank_location1 
  level.place1.origin = ( -1534.05 -227.15 -23.76 )
?? :?

maybe i'm being a prick but this is something i've always wondered, why do we add three lines of code instead of one? :wink:

Posted: Tue Aug 03, 2004 3:47 pm
by G3mInI
I had no idea that could be done. Since the code is randomly moving the obj to either location, I thought a script origin was needed for the tank to move to. In the original Hunt map, its the way the developers moved the flak88 to one of four locations. They have script_origins in each location. I will see if they are not needed though. Thanks.

Oh and btw...

self.gun scale 0.104

and

self.gun.scale = 0.104

both return the 0 entities with targetname 'vehicles/kingcannon.tik' error in the console.

I'm beginning to think it cannot be done by scripting alone. Like I said when I scaled the model itself in the tiki file... works like a charm. But that ruins my server-side only mod.

Peace,
G3mInI

Posted: Sat Mar 19, 2005 2:19 am
by Green Beret
i know this is an old thread but i didnt know if this was resovled yet cause i was trying to do the same thing and figured it out.

i was able to scale down the turret and damagemdl of the tank.

you have to change the self.gun scale in more than one place :wink:
that was the key to gettin it to work.i doubt Gemini still needs this but maybe there is someone out there like me that was tryin to do the same thing.

if you need me to post the script i will be glad too :P
Image