KillaMarci Posted October 23, 2010 Posted October 23, 2010 HeyDoes anyone of you know if it's possible to create an explosion at a certain point in the map? I want it to be at the race start, like 3 ... 2... 1... BOOM! (it needs to be pretty accurate aswell)Why? Well I want to implement something like this in a map: http://www.youtube.com/watch?v=6S1hidemGwUI know that it's not always 100% accurate but it works fine most of the time. So maybe theres a script for explosion or something? Could be a barrel or an exploding car or anything... Quote
BinSlayer Posted October 23, 2010 Posted October 23, 2010 Go here:http://www.xoti.net/stuff/uploads/explosion_c94e.luaSave everything as explosion.luaPut explosion.lua in your map archive.Open meta.xml and add this before the </meta> : <script src="explosion.lua" />Make sure you read the script.. I added some information thereHave fun mapping Quote
KillaMarci Posted October 23, 2010 Author Posted October 23, 2010 (edited) Thanks a lot Bin I'll try and see how it turns out.Oh and I think I also need a script to make the player invulnerable?EDIT: Nvm, I read up. I suppose I can just use the damaging = false in that line then. Edited October 23, 2010 by KillaMarci Quote
BinSlayer Posted October 23, 2010 Posted October 23, 2010 (edited) Nop, you can't use that line..because the script I gave you is server-sideyou'd need a client-side one for that argument to work..so do you actually die/explode when this script runs? Edited October 23, 2010 by BinSlayer Quote
KillaMarci Posted October 24, 2010 Author Posted October 24, 2010 (edited) Nop, you can't use that line..because the script I gave you is server-sideyou'd need a client-side one for that argument to work..so do you actually die/explode when this script runs?Alright. Well then I will need an additional script for invulnerable players -.I just tried it out and yes it works exactly as it should I only tested the grenade explosion so far and it's not powerfull enough right now (not getting satisfying height) I will test the other forms of explosion aswell and hope for the best now Otherwise I might just try to use multiple explosion for one catapult. I don't know if I will make multiple catapults or if I just do one for all players so we will seeEDIT: Yay guys I got it!! It works and it's so fun, here's a demo.http://www.youtube.com/watch?v=W4NHPrfdZR0I haven't actually experimented with anything else yet, only added more grenade explosions. I uploaded my testmap and script so you guys can experiment with different explosion types, different vehicles (how about a bus? LOL) and so on. Best of all is that the landing place is always verrry accurate, I land on exactly the same spot all the time. Now I just have to find a good way to implement this into a good map, oh and btw. I won't need a invulnerable script of anything, it actually works fine with the MTB. You may need it for other vehicles. (someone try it with a sweeper pls lol)cata.rar Edited October 24, 2010 by KillaMarci Quote
BinSlayer Posted October 24, 2010 Posted October 24, 2010 (edited) edit: do you want to actually make an explosion for each spawn? Edited October 24, 2010 by BinSlayer Quote
KillaMarci Posted October 24, 2010 Author Posted October 24, 2010 Nah I now decided not to do that. Would be too much work to sync all the cars so the players all fly to the same destination from different places. Would be too much of a hassle IMO. One spawnpoint for everyone is fine right? Might cause more lag for some people but I dunno... Quote
BinSlayer Posted October 24, 2010 Posted October 24, 2010 (edited) try this:addEvent('onRaceStateChanging', true)addEventHandler('onRaceStateChanging', getRootElement(),function(newstate, oldstate) if newstate == 'Running' then for i,j in ipairs(getElementsByType('player')) do x,y,z = getElementLocation(j) createExplosion( x, y, z, 0) end endend)DO NOT change x,y,z this time Just use this script exactly as it is.. And note something: Make 40 spawnpoints! otherwise there will be 2 or more explosions created in the same place and this could be big enough to kill the playersWhat this should do is create an explosion for each player I think the explosion is now created exactly in the vehicle.. so i'm not sure how that will work out. If you don't like it, change a bit the 'y' and make it y+1 or something like that Edited October 24, 2010 by BinSlayer Quote
KillaMarci Posted October 24, 2010 Author Posted October 24, 2010 try this:addEvent('onRaceStateChanging', true)addEventHandler('onRaceStateChanging', getRootElement(),function(newstate, oldstate) if newstate == 'Running' then for i,j in ipairs(getElementsByType('player')) do x,y,z = getElementLocation(j) createExplosion( x, y, z, 0) end endend)DO NOT change x,y,z this time Just use this script exactly as it is.. And note something: Make 40 spawnpoints! otherwise there will be 2 or more explosions created in the same place and this could be big enough to kill the playersWhat this should do is create an explosion for each player I think the explosion is now created exactly in the vehicle.. so i'm not sure how that will work out. If you don't like it, change a bit the 'y' and make it y+1 or something like thatYup sounds plausible. Is there a way to copy whole parts of a map? Like the MTB spawnpoint standing on the wrecked car? Because it's pretty hard to set that up to work fine, especially if I have to do it 40 times! I doubt the explosion is going to be hard enough to kill the player actually. Right now I use 10 helicopter explosions which are at exactly the same location for each catapult.Will theese explosions be for each player individually then? Like 20 player = 20*10explosions = 200explosions at one place. Is that what you meant? Quote
BinSlayer Posted October 24, 2010 Posted October 24, 2010 (edited) Yeah that's what I meant..If you want to copy the wrecked car for all players use this:(dont use the other scripts, delete them and use this one!)http://pastebin.com/raw.php?i=Tj0dWa8schange the explosion type to whatever you want. (the '0' you know)and when you see this line: obj[k]=createObject(10831,xx,yy,zz-1)change 10831 to the ID of the wrecked car (i dont know it)'zz-1' is the position height of the wrecked car.. so change it like zz+1 or zz or anything like that if u wanna change a bit the height where the wrecked car spawns Edited October 24, 2010 by BinSlayer Quote
KillaMarci Posted October 24, 2010 Author Posted October 24, 2010 Wow that's a little much for now Still pretty new to this but I guess I will actually figure it out when I test it.Another question: How do I test different spawnpoints? When I "test" the race it always gives me the same spawnpoint... Quote
BinSlayer Posted October 24, 2010 Posted October 24, 2010 (edited) Wow that's a little much for now Still pretty new to this but I guess I will actually figure it out when I test it.Another question: How do I test different spawnpoints? When I "test" the race it always gives me the same spawnpoint...You dontbtw all you have to do is copy-paste the script and change what you like that is explosion type and id of wrecked carAny questions? Just ask Edited October 24, 2010 by BinSlayer Quote
KillaMarci Posted October 24, 2010 Author Posted October 24, 2010 (edited) Well I feel like understanding the code is a better way of learning what is going on so:addEvent('onRaceStateChanging', true)addEventHandler('onRaceStateChanging', getRootElement(),function(newstate, oldstate) if newstate == 'Running' then for i,j in ipairs(getElementsByType('player')) do x,y,z = getElementPosition(j) createExplosion( x, y, z, 0) end endend)--I think I do understand this part.You get the players position and create an explosion exactly where he stands...right? (I'll have to edit the value's slightly in order to get the explosion infront of the car then)obj = { } k = 1addEventHandler('onResourceStart', getResourceRootElement(getThisResource()),function() for i,j in ipairs(getElementsByType('spawnpoint')) do xx,yy,zz = getElementPosition(j) obj[k]=createObject(10831,xx,yy,zz-1) k = k + 1 endend--Here you get the players spawnpoint and create the wrecked car under it (UNDER because of the zz(-1) I suppose?)addEventHandler('onResourceStop', getResourceRootElement(getThisResource()),function() number = #obj for i=1,number do destroyElement(obj[i]) endend)-- I don't really get this part, but I suppose this is nothing I actually need to understand.Did I get everything right? So I should basically just add a spawnpoint, and it should automatically add the wrecked car under it and create the explosion at the players position right? Thx for you help!EDIT: The problem with the spawnpoints is also something I will have to overcome, because I need to see where the player goes because I want them all to go to one definite place. I think I will just add a spawnpoint, test it, and if it works I'll save the coordinates and go on to the next one. Long long process but I have no better option right now. Edited October 24, 2010 by KillaMarci Quote
BinSlayer Posted October 24, 2010 Posted October 24, 2010 (edited) Put the spawnpoints in a nice order on the map.. and just test for 1 spawn because the explosion must throw everybody in a certain area as wide as the spawn area actuallyThe part you said you dont understand, objects created via scripts stay forever in the server (even if map restarts or changes) so destroyElement would destroy the object when the map has ended.You will NOT see the wrecked car in the map editor overview. You will only see it if you 'test' the mapand if zz-1 is too much in the ground.. you can try zz-0.5 or any other float numberto get the explosion in front of the car you need to alter "y" like y+1 or so Edited October 24, 2010 by BinSlayer Quote
KillaMarci Posted October 24, 2010 Author Posted October 24, 2010 Yea I get what you mean with the spawnpoints, I first wanted to place some all around the map but now I realize that its too much of a hassle. I'll start with the map in a second, anyone got any ideas how to continue the map? I guess it shouldnt be that long, since the catapult is the main attraction of the map. I guess I'll just make it something 40-50second-ish Quote
FOTL.Emanuel Posted October 24, 2010 Posted October 24, 2010 What about that first part plus a slide?Check it out:Map starts, you get launched to a CP that changes you into a harvester and you land on the slide fences thing Im suggesting this because you said the landing position seems to be very accurate.The map should be around 1m maybe and be all about crazy stuff like that and prolly something else if you can come up with it lol. Quote
KillaMarci Posted October 25, 2010 Author Posted October 25, 2010 Uh yeh it's accurate but no THAT accurate really Landing space is always about +/-10ft. And if the player comes sideways the slide doesn't work and so on. In my slide map I tried to make the entering space real small so they had do slide down no matter what. What you suggested would probably be better for the SGA Skillserver xD Quote
BinSlayer Posted October 25, 2010 Posted October 25, 2010 btw.. my script doesn't cover late joiners :/So if you join after the race has started, you won't get an explosionis this a problem for your map?if it is, I may try to find a better way or to fix it somehow, but maybe you don't need, so thats why i am asking Quote
KillaMarci Posted October 25, 2010 Author Posted October 25, 2010 Well yea it sucks but I guess since the map is going to be pretty short it's not going to be a big problem. Would still be cool if you could solve it somehow (if it's not too much of a hassle, otherwise don't) Quote
BinSlayer Posted October 25, 2010 Posted October 25, 2010 yeah well it's kinda hard to adjust it :Sjust make sure that whereever the players will be thrown at, it will be accessible via road too (and not just by the explode jump) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.