I need help with a script I am making
Author |
Message |
Benpasko
Joined: Sun Aug 09, 2009 9:26 am Posts: 1633
|
Re: I need help with a script I am making
Holy crap, that's a lot of explosions. You'll have to work on a way to avoid damage to the Punisher holding the gun. Maybe use a Lua script that detects who fired the original emitter, and get their aim angle for the rounds? I don't know any Lua though, so not sure if this is possible.
|
Tue Jan 19, 2010 2:26 am |
|
|
Duh102
happy carebear mom
Joined: Tue Mar 04, 2008 1:40 am Posts: 7096 Location: b8bbd5
|
Re: I need help with a script I am making
PhantomAGN wrote: This is THE best fail ever. Lua gone ABSOLUTELY RIGHT.
|
Tue Jan 19, 2010 4:34 am |
|
|
mail2345
Joined: Tue Nov 06, 2007 6:58 am Posts: 2054
|
Re: I need help with a script I am making
Keep the code, make a suicide tool. Maybe toss in a Code: self:SetWhichMOToNotHit(parent,-1)
somewhere.
|
Tue Jan 19, 2010 4:35 am |
|
|
PhantomAGN
Joined: Mon Jun 29, 2009 2:40 am Posts: 610 Location: Deep below The Map of Mars
|
Re: I need help with a script I am making
Benpasko wrote: Maybe use a Lua script that detects who fired the original emitter, and get their aim angle for the rounds? I don't know any Lua though, so not sure if this is possible. That's exactly what I coded it to do, but it fails. Still not sure why it's not working. I'm sending my revisions back in now, I'll return to this later tonight.
|
Tue Jan 19, 2010 5:31 am |
|
|
Benpasko
Joined: Sun Aug 09, 2009 9:26 am Posts: 1633
|
Re: I need help with a script I am making
Do the subsequent laser blasts also track parent aim angle? Like, maybe the first one is going in the direction you aim, but the rest just switch to horizontal?
|
Tue Jan 19, 2010 5:38 am |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: I need help with a script I am making
This should do the trick. Edit: Made it better. Code: function Create(self) self.mapwrapx = SceneMan.SceneWrapsX; self.maxlazerlength = 500; self.weaponname = "LAZER GUN PRESETNAME";
local curdist = 50; for i = 1,MovableMan:GetMOIDCount()-1 do gun = MovableMan:GetMOFromID(i); if gun.PresetName == self.weaponname and gun.ClassName == "HDFirearm" and (gun.Pos-self.Pos).Magnitude < curdist then actor = MovableMan:GetMOFromID(gun.RootID); if MovableMan:IsActor(actor) then self.parent = ToActor(actor); self.parentgun = ToHDFirearm(gun);
local terrcheck = Vector(0,0); local terrainray = SceneMan:CastStrengthRay(self.parentgun.MuzzlePos,Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)),0,terrcheck,4,0,true) if terrainray == true then local lazerlength = math.floor(SceneMan:ShortestDistance(self.parentgun.MuzzlePos,terrcheck,self.mapwrapx).Magnitude/10) else local lazerlength = math.floor(self.maxlazerlength/10); end
for i = 1, lazerlength do self.lazerpar = CreateMOPixel(self.lazerparname,self.modulename); -- CHANGE THIS TO YOUR PARTICLE self.lazerpar.Pos = self.parentgun.MuzzlePos + Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)); MovableMan:AddParticle(self.lazerpar); end
end end end
end
|
Tue Jan 19, 2010 12:34 pm |
|
|
Foogooman
Joined: Sat Nov 18, 2006 8:11 pm Posts: 267
|
Re: I need help with a script I am making
CaveCricket48 wrote: This should do the trick. Edit: Made it better. Code: function Create(self) self.mapwrapx = SceneMan.SceneWrapsX; self.maxlazerlength = 500; self.weaponname = "LAZER GUN PRESETNAME";
local curdist = 50; for i = 1,MovableMan:GetMOIDCount()-1 do gun = MovableMan:GetMOFromID(i); if gun.PresetName == self.weaponname and gun.ClassName == "HDFirearm" and (gun.Pos-self.Pos).Magnitude < curdist then actor = MovableMan:GetMOFromID(gun.RootID); if MovableMan:IsActor(actor) then self.parent = ToActor(actor); self.parentgun = ToHDFirearm(gun);
local terrcheck = Vector(0,0); local terrainray = SceneMan:CastStrengthRay(self.parentgun.MuzzlePos,Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)),0,terrcheck,4,0,true) if terrainray == true then local lazerlength = math.floor(SceneMan:ShortestDistance(self.parentgun.MuzzlePos,terrcheck,self.mapwrapx).Magnitude/10) else local lazerlength = math.floor(self.maxlazerlength/10); end
for i = 1, lazerlength do self.lazerpar = CreateMOPixel(self.lazerparname,self.modulename); -- CHANGE THIS TO YOUR PARTICLE self.lazerpar.Pos = self.parentgun.MuzzlePos + Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)); MovableMan:AddParticle(self.lazerpar); end
end end end
end I can't get it to work :/ Error on line 24 near 'shot' Code: function Create(self) self.mapwrapx = SceneMan.SceneWrapsX; self.maxlazerlength = 500; self.weaponname = "Justice";
local curdist = 50; for i = 1,MovableMan:GetMOIDCount()-1 do gun = MovableMan:GetMOFromID(i); if gun.PresetName == self.weaponname and gun.ClassName == "HDFirearm" and (gun.Pos-self.Pos).Magnitude < curdist then actor = MovableMan:GetMOFromID(gun.RootID); if MovableMan:IsActor(actor) then self.parent = ToActor(actor); self.parentgun = ToHDFirearm(gun);
local terrcheck = Vector(0,0); local terrainray = SceneMan:CastStrengthRay(self.parentgun.MuzzlePos,Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)),0,terrcheck,4,0,true) if terrainray == true then local lazerlength = math.floor(SceneMan:ShortestDistance(self.parentgun.MuzzlePos,terrcheck,self.mapwrapx).Magnitude/10) else local lazerlength = math.floor(self.maxlazerlength/10); end
for i = 1, lazerlength do self.lazerpar = CreateMOPixel(Justice Shot); -- CHANGE THIS TO YOUR PARTICLE self.lazerpar.Pos = self.parentgun.MuzzlePos + Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)); MovableMan:AddParticle(self.lazerpar); end
end end end
end
|
Tue Jan 19, 2010 9:37 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: I need help with a script I am making
That would be "Justice Shot", with the quotation marks. I forgot to change the example name.
|
Tue Jan 19, 2010 9:43 pm |
|
|
Foogooman
Joined: Sat Nov 18, 2006 8:11 pm Posts: 267
|
Re: I need help with a script I am making
CaveCricket48 wrote: That would be "Justice Shot", with the quotation marks. I forgot to change the example name. Well now it gives me "Justice.lua:23: 'for' limit must be a number"
|
Tue Jan 19, 2010 9:46 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: I need help with a script I am making
Bleh. Try this: Code: function Create(self) self.mapwrapx = SceneMan.SceneWrapsX; self.maxlazerlength = 500; self.weaponname = "Justice";
local curdist = 50; for i = 1,MovableMan:GetMOIDCount()-1 do gun = MovableMan:GetMOFromID(i); if gun.PresetName == self.weaponname and gun.ClassName == "HDFirearm" and (gun.Pos-self.Pos).Magnitude < curdist then actor = MovableMan:GetMOFromID(gun.RootID); if MovableMan:IsActor(actor) then self.parent = ToActor(actor); self.parentgun = ToHDFirearm(gun);
local terrcheck = Vector(0,0); local terrainray = SceneMan:CastStrengthRay(self.parentgun.MuzzlePos,Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)),0,terrcheck,4,0,true) if terrainray == true then local self.lazerlength = math.floor(SceneMan:ShortestDistance(self.parentgun.MuzzlePos,terrcheck,self.mapwrapx).Magnitude/10) else local self.lazerlength = math.floor(self.maxlazerlength/10); end
for i = 1, self.lazerlength do self.lazerpar = CreateMOPixel("Justice Shot"); -- CHANGE THIS TO YOUR PARTICLE self.lazerpar.Pos = self.parentgun.MuzzlePos + Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)); MovableMan:AddParticle(self.lazerpar); end
end end end
end
|
Tue Jan 19, 2010 9:50 pm |
|
|
Foogooman
Joined: Sat Nov 18, 2006 8:11 pm Posts: 267
|
Re: I need help with a script I am making
CaveCricket48 wrote: Bleh. Try this: Code: function Create(self) self.mapwrapx = SceneMan.SceneWrapsX; self.maxlazerlength = 500; self.weaponname = "Justice";
local curdist = 50; for i = 1,MovableMan:GetMOIDCount()-1 do gun = MovableMan:GetMOFromID(i); if gun.PresetName == self.weaponname and gun.ClassName == "HDFirearm" and (gun.Pos-self.Pos).Magnitude < curdist then actor = MovableMan:GetMOFromID(gun.RootID); if MovableMan:IsActor(actor) then self.parent = ToActor(actor); self.parentgun = ToHDFirearm(gun);
local terrcheck = Vector(0,0); local terrainray = SceneMan:CastStrengthRay(self.parentgun.MuzzlePos,Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)),0,terrcheck,4,0,true) if terrainray == true then local self.lazerlength = math.floor(SceneMan:ShortestDistance(self.parentgun.MuzzlePos,terrcheck,self.mapwrapx).Magnitude/10) else local self.lazerlength = math.floor(self.maxlazerlength/10); end
for i = 1, self.lazerlength do self.lazerpar = CreateMOPixel("Justice Shot"); -- CHANGE THIS TO YOUR PARTICLE self.lazerpar.Pos = self.parentgun.MuzzlePos + Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)); MovableMan:AddParticle(self.lazerpar); end
end end end
end Line 18: unexpected symbol near "."
|
Tue Jan 19, 2010 9:54 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: I need help with a script I am making
I'm so silly. Code: function Create(self) self.mapwrapx = SceneMan.SceneWrapsX; self.maxlazerlength = 500; self.weaponname = "Justice";
local curdist = 50; for i = 1,MovableMan:GetMOIDCount()-1 do gun = MovableMan:GetMOFromID(i); if gun.PresetName == self.weaponname and gun.ClassName == "HDFirearm" and (gun.Pos-self.Pos).Magnitude < curdist then actor = MovableMan:GetMOFromID(gun.RootID); if MovableMan:IsActor(actor) then self.parent = ToActor(actor); self.parentgun = ToHDFirearm(gun);
local terrcheck = Vector(0,0); local terrainray = SceneMan:CastStrengthRay(self.parentgun.MuzzlePos,Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)),0,terrcheck,4,0,true) if terrainray == true then self.lazerlength = math.floor(SceneMan:ShortestDistance(self.parentgun.MuzzlePos,terrcheck,self.mapwrapx).Magnitude/10) else self.lazerlength = math.floor(self.maxlazerlength/10); end
for i = 1, self.lazerlength do self.lazerpar = CreateMOPixel("Justice Shot"); -- CHANGE THIS TO YOUR PARTICLE self.lazerpar.Pos = self.parentgun.MuzzlePos + Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)); MovableMan:AddParticle(self.lazerpar); end
end end end
end
|
Tue Jan 19, 2010 10:32 pm |
|
|
Foogooman
Joined: Sat Nov 18, 2006 8:11 pm Posts: 267
|
Re: I need help with a script I am making
Awesome, it works perfectly However, could you add a variable to determine how fast they are moving? I want them to be moving forward when fired as well as appearing that distance out.
|
Tue Jan 19, 2010 10:42 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: I need help with a script I am making
Here. Code: function Create(self) self.mapwrapx = SceneMan.SceneWrapsX; self.maxlazerlength = 500; self.parspeed = 10 -- SPEED OF PARTICLE HERE self.weaponname = "Justice";
local curdist = 50; for i = 1,MovableMan:GetMOIDCount()-1 do gun = MovableMan:GetMOFromID(i); if gun.PresetName == self.weaponname and gun.ClassName == "HDFirearm" and (gun.Pos-self.Pos).Magnitude < curdist then actor = MovableMan:GetMOFromID(gun.RootID); if MovableMan:IsActor(actor) then self.parent = ToActor(actor); self.parentgun = ToHDFirearm(gun);
local terrcheck = Vector(0,0); local terrainray = SceneMan:CastStrengthRay(self.parentgun.MuzzlePos,Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)),0,terrcheck,4,0,true) if terrainray == true then self.lazerlength = math.floor(SceneMan:ShortestDistance(self.parentgun.MuzzlePos,terrcheck,self.mapwrapx).Magnitude/10) else self.lazerlength = math.floor(self.maxlazerlength/10); end
for i = 1, self.lazerlength do self.lazerpar = CreateMOPixel("Justice Shot"); -- CHANGE THIS TO YOUR PARTICLE self.lazerpar.Pos = self.parentgun.MuzzlePos + Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)); self.lazerpar.Vel = Vector(self.parspeed,0):RadRotate(self.parent:GetAimAngle(true)); MovableMan:AddParticle(self.lazerpar); end
end end end
end
|
Tue Jan 19, 2010 10:49 pm |
|
|
Foogooman
Joined: Sat Nov 18, 2006 8:11 pm Posts: 267
|
Re: I need help with a script I am making
Awesome, thanks Now I just have to wait for some sprites back from Maxim and I will be ready to release soon One question though, what part of the script determines how many objects spawn?
|
Tue Jan 19, 2010 10:57 pm |
|
|
|
Who is online |
Users browsing this forum: No registered users |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|