Open RowanSkie opened 2 years ago
Here's a full detailed article about it by the same guy: https://www.gian-cursio.net/2021/03/stargate-dialing/
In cap there is stargate movie what have this features, so i'm not sure what exactly you asking then.
Okay, uh, so after watching the guy's Youtube video (and reading his notes on why his Movie Stargate animation has the encoded chevron on top instead of underneath each activating chevron like what the animation is right now), I kinda wanted to see if CAP has a functionality to make it run like so.
Then I realized I have to create a new animation script or a new Stargate entirely that requires its own dialing script because the Stargate movie version on the mod doesn't have a way to do that.
Basically, the animation I was hoping to find (which I didn't and then tried to create*) is basically SG1 Stargate (where the chevron encoded is on top) but the skin and model is the Movie Stargate.
Does that make sense or something?
There is tons of extra options what you can change using gmod C tool menu (hold C button and right click on movie gate). It have cheveron light up feature too as well as many others. Just check those, there even was video on gmod somewhere but can't find it right now.
Ah wait, if you want to have chevron encoded at top then its not possible using cap, it will be bit harder to get those possible, since top chevron model can't be used on sg1 model - different colors... So its not just script but models too.
The latter comment is mostly correct, and so far what I had in mind was editing the script so the ring always points to the seventh chevron, even if it's just the first eight chevrons being encoded.
Models I can deal with other times since I know how to do it (except for exporting it to Valve games, that always breaks but I can find a way).
If I were to do this, what files do I need to replace?
Tehnically you can use git version cap code, then copy paste cap\lua\entities\stargate_sg1 to something like stargate_sg1_movie or so, then edit its init.lua and find this part:
ENT.Models = {
Base="models/Madman07/Stargate/base.mdl",
Ring="models/Madman07/Stargate/ring_sg1.mdl",
Chevron="models/Madman07/Stargate/chevron.mdl",
}
Replace with
ENT.Models = {
Base="models/Madman07/Stargate/base_movie.mdl",
Ring="models/Madman07/Stargate/ring_sg1.mdl",
Chevron="models/Madman07/Stargate/chevron.mdl",
ChevronMovie="models/Madman07/Stargate/chevron_movie.mdl",
}
And then replace whole function "function ENT:AddChevron()" to movie one:
--################# Adds all chevrons @aVoN
function ENT:AddChevron()
self.Chevron={};
local pos = self.Entity:GetPos();
local angForw = self.Entity:GetAngles():Up();
local ang = self.Entity:GetAngles();
for i=1,9 do
local e = ents.Create("prop_dynamic_override");
if (i==9) then e:SetModel(self.Models.ChevronMovie);
else e:SetModel(self.Models.Chevron); end
e:SetParent(self.Entity);
e:SetDerive(self.Entity); -- Derive Material/Color from "Parent"
e:DrawShadow(false);
e:SetPos(pos);
local a = angForw*i*40;
e:SetAngles(ang-Angle(a[1],a[2],a[3]));
e:Spawn();
e:Activate();
if (i >= 6) then self.Chevron[i-2] = e;
elseif (i <= 3) then self.Chevron[i] = e;
elseif (i == 4) or (i == 5) then self.Chevron[i+4] = e;
end
e:SetDerive(self.Entity); -- Derive Material/Color from "Parent"
if (i==9) then
e:Fire("skin",2);
else
e:Fire("skin",6);
end
end
end
And do same with "function ENT:ActivateChevronLight(chev,b)" using movie gate code.
Teoretically you should get sg1 gate based on movie chevron/model/skins so will be some sort of hybrid. Hopefully this is what you want, of course i might forgot something else so can't be sure everything will work as expected.
Oh, looks like I was on the right path when I duplicated stargate_movie into stargate_movie_sg1, though with the wrong source.
By the way, here's what I mean on the dialing look, this is an image from the Youtube video where it was dialing the first chevron:
Second chevron:
Apparently, in the movie's official novelization, it's described that way, the glyph is always on the seventh chevron.
Well, if you need to make chevron animations not at top but glyph at top then is even more harder task, you need to change function ENT:Chevron7Animation(nodelay, inbound)
function and then modules\dialling.lua to pass cheveron number in slow dial mode. There is no simple way to change as you want, making changes to movie gate will be even more harder since there is pretty hard formula for stop right rotation in function ENT:StopFormula(y,x,n,n2)
+ function ENT:RingTickMovie()
, not sure what happens if use sg1 code on movie gate for this formulas. But maybe you can try this (using sg1 code for this 2 functions).
So use stargate_movie's modules\dialling, edit ENT:Chevron7Animation
and the other two functions?
After a few editing things, the gate can be used as incoming and but doing an outcoming gate gives this error:
[cap] addons/cap/lua/entities/stargate_base/modules/lib.lua:924: attempt to index field 'EventHorizonData' (a nil value)
1. CalcDelaySlow - addons/cap/lua/entities/stargate_base/modules/lib.lua:924
2. Dial - addons/cap/lua/entities/stargate_movie/modules/dialling.lua:62
3. ActivateStargate - addons/cap/lua/entities/stargate_base/modules/events.lua:318
4. ActivateStargate - addons/cap/lua/entities/stargate_base/modules/events.lua:305
5. StartDialling - addons/cap/lua/entities/stargate_base/modules/events.lua:593
6. DialGate - addons/cap/lua/entities/stargate_base/modules/lib.lua:1494
7. unknown - addons/cap/lua/entities/stargate_base/modules/lib.lua:1328
8. unknown - lua/includes/modules/concommand.lua:54```
Interesting thought upon this dialing method, about the error you forgot to close or define the proper array that's attempting to propagate the array perhaps?
The error basically shows up as it's unable to form a stable wormhole. I might have to re-configure the whole script since after I tried fixing it, not even outcoming works anymore.
I had a silly thought after going back here to see this. Basically, I hijack ENT:ActivateChevronLight to actually do a chevron animation instead of lights on and off.
Anyway, I've almost finished what is effectively my custom dialing sequence. All it needs now is for me to find a way to make the chevrons actually enter the lock state when the final chevron is locked, like the movie and normal movie dialing sequence.
Basically stuck for that one... I went to edit Stargate SG1 version and placed in the Movie details and trimmed some code for the classic sounds so I can do it. I probably would've stopped altogether back in February with this.
It's actually much more cleaner to do that, it seems.
Here's the code snippet for what I changed alongside mentioned above... and hopefully I can find a way to make the final part of the anims. That, and make the 7th chevron to stop bloody moving...
--################# Activates or deactivates a chevron @aVoN
function ENT:ActivateChevron(chev,b)
if(not (self and self.Chevron)) then return end;
if self.Chev9Special then
chev = self:Chev9Spec(chev)
end
if(self.Chevron[chev]) then
if(b) then -- and self.Chevron[chev]:GetNetworkedString("ChevAnim") != "chevlocked"
if (IsValid(self.Chevron[chev])) then
self.Chevron[chev]:Fire("SetAnimation","Lock",0);
-- self.Chevron[chev]:SetNetworkedString("ChevAnim","chevlocked");
-- self.Chevron[chev]:Fire("skin",1);
-- self.Entity:SetNetworkedBool("chevron"..chev,true); -- Dynamic light of the chevron
else
self.Entity:Sparks(chev);
timer.Simple(0.1, function()
self.SparkEnt:Fire("StopSpark", "", 0);
end);
end
else
self.Chevron[chev]:Fire("SetAnimation","UnLock",0);
self.Entity:ChevronSound(chev,true,false,true);
-- self.Chevron[chev]:SetNWString("ChevAnim","chevunlocked");
-- self.Chevron[chev]:Fire("skin",0);
-- self.Entity:SetNWBool("chevron"..chev,false); -- Dynamic light of the chevron
end
end
end
--################# Chevron locking sound? @aVoN
function ENT:ChevronSound(chev,fast,inbound,b)
if (not IsValid(self.Chevron[chev])) then return end
local snd = self.Sounds.Chevron[1]; -- Fast dial with DHD
-- Manual slowdial
if(not fast) then
snd = self.Sounds.Lock;
end
-- Inbound dial
if (b == true) then
snd = self.Sounds.Chevron[2];
end
self.Entity:EmitSound(snd,90,math.random(97,104));
end
Anyway, I watched this video of how the Stargate Film version was actually described to do so.
https://www.youtube.com/watch?v=ctvs2KjS308
Is there a way for me to create a script that does this? Or a new entity?
Is there a tutorial on how to create a new Stargate?