Sauerworld Forum

Sauerbraten Content => Scripts => Topic started by: pix on January 30, 2015, 07:32:39 PM

Title: Script to fix playerstarts and flag after mirroring a CTF map you work on
Post by: pix on January 30, 2015, 07:32:39 PM
So this annoyed me enough to finally write a script that solves it for me:

After copy-n-pasting one half of the map over to the other side (and rotating the geometry accordingly), playerstarts and the flag will retain their direction and team attributes, meaning one team has neither a flag nor spawns, and the other team has two flags and spawns in both bases, facing the wrong direction.

Here it is:

Code: [Select]
// fixes team and direction of playerstart and flag after mirroring
alias fixctfents [
entcancel
entfindinsel playerstart
entfindinsel flag

entloop [
entattr 0 (mod (+ 180 (entattr 0)) 360)
entattr 1 (+ 1 (mod (entattr 1) 2))
]
]

Simply copy and paste this snippet into your autoexec.cfg. Note: this only works for 180° point-symmetrical maps (e.g. reissen and forge, but not l_ctf)!

Mirror one side using the following steps (looks harder than it is...):


I may add teleport and teledest fixing at some point when I need it.