-
Posts
625 -
Joined
-
Last visited
Everything posted by Mr.Hankey
-
I just found out a strange bug... In my custom gamemode i use a function that creates a heatseeking rocket projectile which target is a player that is visible on your screen. So if I fire such a rocket on a rc raider or rc bandit everything works fine but if a baron is the target the rocket on the screen of the one who shot the rocket is 10 times faster then normal but i think thats just because the baron is a plane and normal planes would be faster then the rocket. Now the desync issue is that on the screen of the guy who is in the baron the rocket flies with normal speed so it looks like he has enough time to hide somewhere but in fact the explosion of the projectile is somehow synced so the baron will be hit before the rocket arrives at his position... Moreover sometimes the rocket at the shooter's screen will miss the baron because it is too fast and will fly into a wall behind the baron but on the baron's screen the rocket is still flying towards him and when it arrives there it just dissappears. I hope this can be fixed in later releases because it can be very confusing and if you don't know the bug you might wonder where the explosion came from.
-
you have to use: function Money( hitElement, matchingDimension) givePlayerMoney( hitElement, 10 ) timer = setTimer (Money, 1000, 0, hitElement) -- if you set the second Value (number of repetitions) to 0 the timer will loop through the function every second for ever until you kill the timer with the killTimer function end function money_stop () killTimer (timer) end addEventHandler ("onColShapeLeave", Col, money_stop) im not really sure if it works because i just hadn't enough time to test it but i hope so =)
-
oh i found out how the ghostmode works^^ I just found the function in the race mode and suddenly it seemed to be so obvious how it works =) You just set the collision of all vehicles except yours to false but because it's a client function it wont be synced so on the pc of another player all other cars dont have a collision. That's why it works so well in the race mode
-
and again a small update =)
-
sure it is possible Magus just use attachElementToElement ( gun_element, pirateship_element, xoffset, yoffset, zoffset ) but if you attach the gun to the ship you have to think how a single player should fire the projectiles... maybe stick him next to the gun or just set his camera to the gun =) many many ways to realise this i think
-
hm... if you want to attach weapons like in the interstate69 mode you have to write two different parts one for creating and attaching the minigun or rocket or whatever you want to the vehicle and one for binding a key for firing the projectile(s). I just made a quick example to show you how it works and i hope you dont just copy'n paste it but also look at the comments and try to understand it! The resource should consist out of 3 files: First the rocket_server.lua: function mount_rocket (player) local vehicle = getPlayerOccupiedVehicle (player) --get the Vehicle element of the player who entered the command if (vehicle) then -- check if there's a vehicle the player is in local object = createObject ( 3790, 0, 0, 0) --create a rocket object (id:3790) at the vehicle position (could also be any other position attachElementToElement (object, vehicle, 0, 0, 1, 0, 0, -90) --attach the rocket object to the vehicle with an z offset of 1 unit and -90° rotation along the z axis triggerClientEvent ("bind_key", getRootElement (), object) -- trigger the client event and pass the object element variable else end end addCommandHandler ("mount_rocket", mount_rocket) --add a Command that calls the function mount_rocket Second the rocket_client.lua: addEvent ("bind_key", true) -- add an Event and set enable remote triggering for it so we can trigger this event with the server script function fire_rocket () local x, y, z = getElementPosition (getPlayerOccupiedVehicle (getLocalPlayer()))-- get the position of the vehicle the player sits in createProjectile ( getLocalPlayer(), 19, x, y, z + 4, 4.0 )-- create a rocket 4 units above the position of the vehicle end function bind_key_function () bindKey ("vehicle_fire", "down", fire_rocket) --bind the vehicle_fire control to the fire_rocket function local attachedElements = getAttachedElements ( getPlayerOccupiedVehicle (getLocalPlayer()) ) --get all elements that are attached to the car for ElementKey, ElementValue in ipairs ( attachedElements ) do--loop through all attached elements... setElementCollisionsEnabled (ElementValue, false) -- ...and disable their collision end end addEventHandler ("bind_key", getLocalPlayer(), bind_key_function) --add an EventHandler to the "bind_key" event and attach the bind_key_function function to it --*NOTE i think you have to set the root element to the local player because otherwise it would be triggered on all clients if someone enters the command but im not sure and at last the meta.xml <meta> <info author="eXo|Mr.Hankey" version="1.0" type="script"/> <script src="rocket_server.lua" /> <script src="rocket_client.lua" type="client" /> </meta> I tried to comment every single line to make it as understandable as possible and i hope i could help you with this
-
you should make a new topic in the suggestions forum... I think the MTA Team was aware of it when they removed the bunny hop from the singleplayer so you could ask their to implement it in future releases. Btw: Maybe it's just a thing of the stats system where you have things like TAXI_MONEY_MADE but i couldn't find a stat that would define the taxi skill level or the completed taxi missions...
-
made a little update look at the starting post for more information
-
hm... in the singleplayer it just looks like the velocity along the z axis is set a bit higher or there's something like a force pushing it up. I think the "bug" that happens in singleplayer is that the game checks if at least one wheel is on the ground otherwise the boost wont work. So if you're doing something like a wallride the taxi will still touch the ground(now it's the wall) though the boost already happened. This causes that you can keep hitting the boost button all the time you're touching the wall. This is pure speculation but i think it would be a logic way that explains the bug =) I still believe that the setElementVelocity could work fine to reproduce this...
-
hm... i also got the idea of making the player invsible but i thought if i use the setElementAlpha function it would look as weird as it did in stealth mode in dp1. Made a quick update to 0.6.5 players shouldnt be visible now =)
-
Hi there, inspired by a little scene in the first christmas movie i decided to make a little gamemode that takes place in Zero's RC-Arena using RC Vehicles. The Gamemode is still far away from finishing but in the past week i put a lot of work into it and now i think the time has come to make a first release. Last day i tried to find and fix any bugs in it and i think this should be done by now. There's only one warning left that should only appear if a new player joins or the mode is started but as far as i know you can safely ignore that. At the start you will be automatically assigned to one of the two teams (CJ's Toys or Zero's Toys) so they're balanced and a little spawnscreen will appear where you can select 1 out of 6 different rc vehicles (Baron, Goblin, Tiger, Raider, Bandit, Cam). Each vehicle has its own weapon that is bound to the vehicle_fire key so it's compatible with custom keyboard settings. Here are some pics of the vehicles and their weapons: Baron (Airbomb): Goblin (Grenadelauncher): Tiger (Rocketlauncher): Things to do: add image and/or description of each vehicle to the spawnscreen [added description] add heatseeking rockets to the tiger [other solution found] balance reload times (acutally all weapons have 5 seconds reloadtime) [balanced a bit] add base defend turret so if you stay more then 5 seconds in the enemy base you will be shot with a hs rocket make score and round system working [score and round system should work now] fix some issues with vehicles not despawning after disconnecting while sitting in a vehicle [hopefully fixed now] add text items showing a few stats at the right side of the screen[added] add a respawn countdown[added] maybe i have to add something to prevent goblins blocking each other if too many players spawn with a goblin at the same time[seems not necessary] add all rc vehicles i left out (rc bandit, rc cam and rc raider) [added] By downloading you accept these rules: you mustn't say you are the creator of this resource you mustn't change the credits in the lua file or the author part in the meta.xml you are allowed to copy code pieces and use it for your own gamemode (only the whole code if you write a little comment with my credits next to it) Ah and before i forget here's the download link >>DOWNLOAD<< If you find any bugs or you have any suggestions feel free to post it here Edit: I recommend NOT to download the resource "killmessages" with my resource in a package as it is offered because this will cause some problems and you won't be able to play the gamemode! If you download both resources one by one and it should work perfectly... Changelog: v0.6.5: just a little update players shouldn't be visible any more v0.7.0: added 3 vehicles with new weapons (Raider:Molotov, Bandit:Suicidal Bomb and Cam:Heatseeking rocket) v0.7.0: hopefully some despawning issues are fixed now (couldn't really test it) v0.7.0: some fixes relating to the spawn screen v0.7.0: balanced the reload times a little bit v0.7.5: added respawn countdown of 5 seconds v0.7.5: added a description for every vehicle in the spawnscreen v0.7.5: some other small issues fixed v0.7.5: help.xml file updated v0.8.0: made scoure/round system working v0.8.0: added a little stats text in the bottom right corner v0.8.0: fixed some issues whith starting other resources and stopping rc-battle v0.8.0: fixed a bug where players with high ping wouldn't get in a team v0.8.0: added selection/countdown sounds v0.8.0: spawnscreen background changed =) Other things: First of all i have to give a credit to Lucif3r for making interstate69 that included a solution to get targets for the heatseeking rocket projctile from the screen. I hope you don't mind that i used some pieces of your code. I even wrote it all by hand because i was afraid you could mind if i just copy it^^
-
hm... sorry for my bad english but first it's not my native language and second i just wanted to make a quick reply =) I just tested something that seems to disable the collision of the car you are in but i think you shouldnt use this because i got a really weird bug where i floated to the sky like the gravity was to -0.003 Here's what i got so far: function disableCollision2 () outputChatBox ("test") local vehicle = getPlayerOccupiedVehicle (getLocalPlayer()) if (vehicle) then setElementCollisionsEnabled (vehicle, false) killTimer (timer) end end function disableCollision () outputChatBox ("test2") timer = setTimer (disableCollision2, 1000, 0) end addEventHandler ("onClientPlayerSpawn", getLocalPlayer (), disableCollision ) This bug appaers everytime i set the Collision of the vehicle you are in to false and i also tested it with the /crun command of the runcode resource and everytime it's the same. Edit: I think we have to wait for dp3 -.-
-
just add a function that is called when someone spawnes or so get the vehicle element and do: setElementCollisionsEnabled ( theCar, false ) but remember this is a client-only function here's the link to the wiki http://development.mtasa.com/index.php?title=SetElementCollisionsEnabled
-
I would recommend to simply create the xml file in the resource folder by hand because i still cant get the xmlCreateFile function work dunno why... If you do so just create a new text file save it as playname.xml so it becomes an xml file and then write the root node in it like this: <info> </info> and save the file. Also i noticed that you tried to create a sub note with xmlNodeSetAttribute but you have to use xmlCreateSubNode. I edited your code so it should work but i neither know if i understood everything you said in the comments right nor i know if this would work because i havent got the time to test it. Edited code: function createBankAccount ( player, commandName ) local cash = getPlayerMoney ( player ) playname = xmlLoadFile("playname.xml") local banknode = xmlCreateSubNode ( playname, "user" ) -- add a subnode <user>, now we got "<info><user></info>" xmlNodeSetAttribute(banknode, "bank", tostring(cash)) -- change the value, "<info><user bank="(playerMoney)"></info>" --do not use xmlSaveFile ( playname ) -- save the file xmlUnloadFile( playname ) -- unload it after use outputChatBox ("Banking...") end addCommandHandler ("bank", createBankAccount) i tested it and it seems to work pretty good. Here's the result <info> <user bank="50"/> </info>
-
frank you dont have to check if the source is the button because if you set the root element of the eventhandler to the button element the function wont be called if you click for example on another button so it can only be true and the source element will never be another then the button you defined as the root element
-
try something like this: function checkHeight (bomb) local x, y, z = getElementPosition (bomb) z2 = getGroundPosition (x, y, z) if z <= z2 + 10 then -- check the z points and becaus of the little delay triggering server events causes you have to set the point a bit higher than he actually is z = z2 - 10 -- subsctract the 10 units to create the explosion at the right position and not 10 units above the ground triggerServerEvent ( "createexplosion", getRootElement () , x, y, z) --trigger the event the function is attached to that creates the explosion and pass the arguments x, y, z killTimer (timer) else -- nothing to do here end end function dropbomb () --in the function you create the bomb just add this --bomb = the "bomb" object timer = setTimer (checkHeight, 100, 0, bomb) end i havent tested it yet and i hope you understand what the functions are supposed to do^^ also you might have to mess a little bit around with the number that defines how many untis the checking point for the z axis is over the ground to prevent the explosion beeing created under the ground due to delay I hope i have made it all right and could help you with that though it might look a bit confusing at first
-
omg thx norby i always forgot about the target argument because i thought with the other projectiles i dont have to define it so i never set it to nil... gonna test it right now =) Great it works very well =) Here's the code szlend: local usedVehicle = getPlayerOccupiedVehicle (getLocalPlayer()) local x, y, z = getElementPosition(getLocalPlayer()) local velx, vely, velz = getElementVelocity (usedVehicle) createProjectile (getLocalPlayer(), 21, x, y, z - 0.1, 10, nil, 90, 0, 0, velx, vely, -0.1) For the Z Axis i think a higher value for the hydra is better i use this for bombing with a baron =)
-
ah ok that's why nothing happens when i change the velocity optional arguments in the createProjectile function^^
-
nice script! I made something similar for the baron for my upcoming gamemode and i also tried to add a velocity on the x and y axis to the projectile by getting the velocity of the vehicle but it didnt work for me... maybe you can make it work
-
the function works very well but a blur level of 255 just looks weird you should try soemthing between 50 and 100
-
nice script and a great idea for rpg i think =) and norby , yeah that would definetly be funny just like in flat out
-
np XetaQuake Now i went on with scripting and it lead me to new problems with triggerEvents but i think i can find solutions for that on my own =) Thx for everyone else who helped us with this problem!
-
hm.. maybe it's because you use local variables. In the scripting wiki examples it's always something like joinInfos = guiCreateWindow ( 0.30, 0.25, 0.4, 0.5, "Welcome", true ) --instead of local joinInfos = guiCreateWindow ( 0.30, 0.25, 0.4, 0.5, "Welcome", true ) Another thing is the end you're using at line 24 because. For what is it?! looks like a piece of code you forgot to erase^^ But because i create all those guiElement in a function that is called onPlayerJoin or onResourceStart i dont really know if it works then.
-
hm... well if i dont make the window the parent it works well but the thing is that if i assign the window as a parent and create the button AFTER all the other gui elements it works also until you click on the gridlist or the window... then the button switches to the background. So now i just made an event onClientGUIClick for the Window and everytime you click on something in the window it will bring the button back to the front using guiBringToFront (OKButton). Looks a bit buggy but it works and that's all i wanted =) Anyway thanks for the help xeta
