Jump to content

BluHornet

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by BluHornet

  1. Here is how I made ADS in Leadwerks. Feel free to use this if you want. I would like feedback though. I have about 3 weeks of experience with scripting and would like so criticism from the more experienced scripters. Thanks
  2. That is something I never even knew could be done. That is a very nifty piece of script. I would have tried to do mob counts with global variables and then having spawning add to the count and death subtract. I will have to look at the GetNeighbors and see if I can learn anything there. Thanks for your reply
  3. Today I worked on trying to copy the weapons table, currentweaponindex variable, and weaponlowerangle variables to global variables using the trigger change map script. I think this isn't working due to I am not coping the table correctly. Will a line globalweapons = entity.script.weapons copy one complete table with all it's contents to another or do I need to follow the "for in pairs"? I am not sure how to use table iterations.
  4. I posted about this on the 7th. http://www.leadwerks.com/werkspace/topic/11562-map-change-and-fps-weapon-pack/ still working on it but I have it like 70% fixed.
  5. I just watched the video and now see the resolution is shot. The file I uploaded was fine... well anyway here is the code too. Script.healthpoints=15 --float "Health Points" Script.HealTimer = 0 function Script:Start() local sound = Sound:Load("Sound/Player/pickupammo.wav") self.source = Source:Create() self.source:SetSound(sound) end function Script:UpdateWorld() self.HealTimer = self.HealTimer + 1 System:Print(self.HealTimer) if self.HealTimer < 450 then self.entity:Hide() else self.entity:Show() end end function Script:Use(person) if person.entity.script.health>0 then if self.HealTimer > 500 then person.entity.script.health= person.entity.script.health + self.healthpoints self.source:Play() self.HealTimer = 0 end if person.entity.script.health>person.entity.script.maxHealth then person.entity.script.health=person.entity.script.maxHealth end end end
  6. I made a quick tutorial video on how to make the pickup timed here
  7. adding a line self.entity:Release() Removes the object the script is attachd to just be sure that you release it at a time you are done with it. If you do not like deleting it you can do the enable variable like I did and then hide it.
  8. Yeah I left the sound file because I want to mod it later to be health and/or ammo one script for both just change the type and sound. But after I got the code wrote I wrote a ammo pick up forgetting this planned feature. I am still new so I fly by the seat a little too much. what is cool Is we have 2 different codes to answer the same problem. It makes the game feel like mine, ya know. if you want it to be single use it is easy to fix. Script.healthpoints=15 --float "Health Points" function Script:Start() local sound = Sound:Load("Sound/Player/pickupammo.wav") self.source = Source:Create() self.source:SetSound(sound) end function Script:Use(person) if person.entity.script.health>0 then person.entity.script.health= person.entity.script.health + self.healthpoints self.source:Play() self.entity:Release() if person.entity.script.health>person.entity.script.maxHealth then person.entity.script.health=person.entity.script.maxHealth end end end
  9. Script.HealthEnabled = true Script.health = 25 --int "Health Value" Script.PickupSoundPath = "" --path "Sound" "Wav File (*wav):wav|Sound" Script.PickupSound = nil function Script:Start() self.PickupSound = Sound:Load(self.PickupSoundPath) end function Script:Collision(entity, position, normal, speed) if (entity:GetKeyValue("name") == "Player") then if self.HealthEnabled == true then if entity.script.health < entity.script.maxHealth then entity.script:ReceiveHealth(self.health) self.entity:EmitSound(self.PickupSound) self.HealthEnabled = false self.entity:Hide() end end end end This is my Health Pick up script. Don't forget once you add the script to your entity to add the sound file to the script in the editor.
  10. Ok so I changed the weapons table, currentweaponindex variable, and weaponlowerangle variables into global In the APP instead of being in the FPSPlayer script. I changed all references in the FPSPlayer, FPSGun, and Pickup Weapon scripts. I have a small HUD I tweaked from the Project Saturn tutorial. It shows player health and I added clipammo and total ammo for the currently held weapon. When I pick up weapons everything works well now. When I change maps using the TriggerMapChange I can see that my HUD shows I have those weapons and their total and clip ammo is correct and I have a crosshair in the proper spot on the screen. there is no model drawn though. If I cycle weapons my HUD updates the values properly but the only other thing I can see changing is the pick up models visibility is cycling as if they are being confused for the currently equipped weapons. nothing appears in my hands. if I try to reload nothing happens and if I try to fire the game freezes and the windows "Program has stopped working" happens. the window closes back to the editor and the error, debug, and warnings are blank, while other than loading textures and the process complete line the log is uneventful. I think the required models, animations, sounds and such are not loading. how do I know if that is the problem? how do I get them to load properly?
  11. Actually I have resolved the OpenAl error by commenting out ReleaseTableObjects(weapons). I can now load a level the next map without error but none of the vwep models are visible and if you fire the game crashes without an error reported.
  12. While continuing to work on this issue I have found one work around. If I use the base autopistol by giving it to the player at the start of each map and creating a global value in the app.lua for the number of magazines remaining. I allow the game to clear the player weapon table and then changed the reload script to check then reduce the mag counter. this is cool for a survival game but I want to make a zombie survival shooter. I paid $20 for the fps pack. I am learning a lot along the way. My most recent endeavor was to make the weapon table and curretweaponindex global instead of player.script. this works fine until the mapchange hits then it crashes and in the log it says OpenAL: AL_INVALID_OPERATION
  13. I did some more testing and found if I load the autopistol.pfb as a starting weapon the same error occurs. it has something to do with the weapon table not being empty when the map loads.
  14. I will start by saying I just started learning Lua and scripting in the last week when I got the steam indie edition. I have done the tutorials that are in the engine when I got it. I also read the tutoials on the Leadwerks site and the Project Saturn videos off YouTube. Ok on to the topic. When I load the 09-changemap.map everything works fine. If I drop a pistol pickup from the FPS Weapon pack and walk around it everything is still good. If I pick up the weapon everything is ok until I collide with the change map block. That is when I get a Lua stack overflow and the game crashes back to the editor. I found this after about 2 hours of messing around when my project did the same thing. I have looked into the stack error and it has something to do with Lua passing info to C. I have no idea, can someone at least point me in the right direction? Thanks!
×
×
  • Create New...