Adding Splines (Fueldump)


(Moanraker) #1

Hi!
I’ve ‘just’ gotten into mapscripting (for my Jaymod servers, mainly the No Download server) and did some basic stuff like adding func_fakebrushes, using phiserman’s and nUllSkillZ’s trigger to prevent walljumping (radar, battery, etc.) and messed around with some spawning and command post.

My most recent ‘project’ involves having the tank in Fueldump park in the garage after blowing the side wall. It has some advantages as Allies won’t have a MG on half of the fuel depot, Axis can’t hide behind it anymore but mainly it is just a fun experiment for me to mess with the tank route.

[table=“width: 800”]

So far I’ve gotten the tank to follow the last 12 splines backwards again (spln2_39 to spln2_27) using the direction argument (1) in followspline. At first I wanted to have him drive back a little further using my own splines (spln3) by attaching spln3_1 to spln2_27 and have the tank followspline spln3_1 backwards.

Testing yielded a glitchy tank that at some points disappeared completely from the map (it didn’t go to 0,0,0 as far as I know) including the player seated in the MG, ping 999, only to return a few seconds later. This didn’t happen at the splines I added, but after having turned around in front of the fueldump already and repeated sometimes along the way to the side wall.
Expert paint image to visualise idea:

[/table]

[table=“width: 800”]

Another expert paint image:

I figured maybe the splines were for some reason not meant to be targeted by two other splines so I removed the splines I added (spln3). I then made the tank turn on the spot to return alongside the garage using faceangles (same in front of fueldump) and added another group of splines (spln3 again), the first one being exactly at the same spot spln2_27 is. Testing however resulted in the same problem… tank turns glitchy and disappears completely.

[/table]

Commenting out the create block for the spln3 splines from the spawn in game_manager (and limiting accum 3 etc etc to make sure the tank won’t try to run the splines I added) makes the tank run smoothly again. Furthermore the tank already starts to glitch before it reaches any part I touched. That makes me believe there is no problem with the script running the tank (hence not posting the script), but with creating ‘custom splines’.

TLDR: Aren’t ‘custom’ splines meant to be added via mapscript?
Answer: No, use Gotomarker in combination with path_corner instead

Thanks in advance,

Moanraker.


(phisherman) #2

Hey there

What you describe sounds very familiar to me, I too have gone through this exact painful process of trying to figure this out. What I found out is that it seems splines aren’t real entities: If you do /entitylist, they won’t show up. Also if you try to access them with lua, you will fail. This made me think that maybe, the developers used a hack to prevent splines from counting against the entity limit of 1024 (as claimed by chruker here). If they hadn’t done this, then you might run out of entites if you use a lot of (well, not that many actually) splines in a map. Two vehicles, 100 splines each and you have used up a lot of entities that cannot be used for anything else.

So my guess is that you cannot add splines through a mapscript. You claimed that the script was buggy even before it reached the section where you changed anything. However, you add the splines on mapstart through create{} . And if splines are entities that aren’t supposed to be added that way, unforeseen behaviour might be the consequence.

This is an unbelievably thrilling subject, countless years can be spend investigating.


(Mateos) #3

Nice analysis :slight_smile:


(Micha) #4

I can agree on that you can’t let a vehicle move through editing mapscript. PerlO_oung?! and me tested on radar. He added a custom truck and we wanted it to move throught the map. No can do


(phisherman) #5

You can, actually, by using path_corners instead of splines and followpath/gotomarker instead of followspline. The big fat downside to this method is that you can’t smoothen out the tracks using control entities like you can with splines. You might be able to use the faceangles command as a half-assed replacement, but the result will still be ugly. Additionally, each path_corner will count against the entity limit, as stated above. This makes this method only useful for moving objects in straight lines, without many corners.


(Mateos) #6

FD is already used as a “limit” by other mappers because it has a lot already, adding more entities (which hit the network I think?) isn’t a good idea, is it ?


(Moanraker) #7

Thanks a lot for the responses!
I had considered using followpath before but it turns out that (contrary to what the name might let you believe) it is only used for splines. Gotomarker did work however. I could use ‘turntotarget’ to smoothen out the tracks a little, but in the end I decided to go with a path without many corners.

Actually, I can confirm that it is possible to smoothen tracks out in a ‘control’-like manner. For that you can use the formula for the Bezièr Curve to determine where the replacing path_corners will have to be. In combinations with ‘turntotarget’ it should resemble splines up to a certain level at least. I’ve worked it out completely in VBA, but it does take a lot of entities.

Attached the (sloppy) tank parking script in zip.


(Moanraker) #8

Thanks a lot for the responses!
I had considered using followpath before but it turns out that (contrary to what the name might let you believe) it is only used for splines. Gotomarker did work however.

It might actually be possible to smoothen tracks out in a ‘control’-like manner. For that you could use the formula for the Bezièr Curve to determine where the replacing path_corners will have to be. In combinations with ‘turntotarget’ it should resemble splines up to a certain level at least. I’ve worked it out completely in VBA, but it does take a lot of entities in the end.

Attached the (sloppy) tank parking script in zip.
Thanks again.

Moanraker