jkub Posted September 7, 2008 Author Posted September 7, 2008 i just got the object browser and i cant find the minigun id??
Gamesnert Posted September 7, 2008 Posted September 7, 2008 i just got the object browser and i cant find the minigun id?? Hmmm... I couldn't find it either with a quick look. (10 min) I guess it should be between "special" or "military", but I don't know... =/
Gamesnert Posted September 7, 2008 Posted September 7, 2008 Try this one 2985. Not listed in objBrowser... LOL
Ace_Gambit Posted September 7, 2008 Posted September 7, 2008 It was in the "Special Object" package posted a few months ago that was not included in the original MTA object list. Maybe that's why you couldn't find it.
Scarface Posted September 7, 2008 Posted September 7, 2008 Never used the object browser myself,i use the net, like the old times
Ace_Gambit Posted September 7, 2008 Posted September 7, 2008 I have MTA Race on my laptop to look up objects. I don't use any DM object browsers.
jkub Posted September 7, 2008 Author Posted September 7, 2008 now about the setcamera function is there a way i can set the camera to look at an element instead of typing in a specific location for it? platform = createObject ( 18452, -1265, 6.0160622596741, 15.529356002808 ) -- creates the object 1842 (petrol hub) at the specified location minigun = createObject ( 2985, 0, 0, 0 ) -- creates the object 2985 (minigun) at the specified location theMarker = createMarker ( 0, 0, 0, "cylinder", 10, 255, 0, 0, 100 ) visibleTo = getRootElement() attachElementToElement ( theMarker, minigun, 0, -1, 0, 0, 0, 0 ) --attaches the marker to the minigun attachElementToElement ( minigun, platform, 0, -1, -2, 0, 0, 0 ) function markerBlip ( sourcePlayer ) if source == sourcePlayer then setCameraMode ( sourcePlayer, "fixed" ) setCameraLookAt ( sourcePlayer, -1265, 6.0, 16.0 ) end end
jkub Posted September 7, 2008 Author Posted September 7, 2008 btw nothing happens when player hits marker ive went thru trying to use the onplayerhitmarker and it said somthin about nil value?
DefiniteIntegral Posted September 7, 2008 Posted September 7, 2008 Perhaps you mean onClientColShapeHit ? Of course you need to create a coltube or something and add the event handler for this to work. It is my understanding that markers themselves are just graphics with no collision data. Can someone confirm this?
Ace_Gambit Posted September 7, 2008 Posted September 7, 2008 Markers have their own server side call back events: http://development.mtasa.com/index.php? ... nMarkerHit http://development.mtasa.com/index.php? ... arkerLeave
DefiniteIntegral Posted September 7, 2008 Posted September 7, 2008 Markers have their own server side call back events:http://development.mtasa.com/index.php? ... nMarkerHit http://development.mtasa.com/index.php? ... arkerLeave Nice Does that mean creating col shapes for markers is basically a waste of time then? Unless.. is OnMarkerHit is a server-side only event? In which case clients would still need col shapes to detect the hit.. ?
Ace_Gambit Posted September 7, 2008 Posted September 7, 2008 Nice Does that mean creating col shapes for markers is basically a waste of time then? Unless.. is OnMarkerHit is a server-side only event? In which case clients would still need col shapes to detect the hit.. ? That is correct. DP3 does have a client side equivalent but in DP2 you will have to create an additional client sided collision shape.
Gamesnert Posted September 7, 2008 Posted September 7, 2008 Nice Does that mean creating col shapes for markers is basically a waste of time then? Unless.. is OnMarkerHit is a server-side only event? In which case clients would still need col shapes to detect the hit.. ? That is correct. DP3 does have a client side equivalent but in DP2 you will have to create an additional client sided collision shape. Or make your own client-side marker event that is being triggered by the server one!
jkub Posted September 7, 2008 Author Posted September 7, 2008 lol i guess i might try the col shape thing then
Gamesnert Posted September 7, 2008 Posted September 7, 2008 lol i guess i might try the col shape thing then I use the same method. Might be a bit simpler than events triggered by events... =/
50p Posted September 7, 2008 Posted September 7, 2008 There is an event: onMarkerHit and onPlayerMarkerHit.
DefiniteIntegral Posted September 8, 2008 Posted September 8, 2008 (edited) There is an event: onMarkerHit and onPlayerMarkerHit. There is this thing: Its called reading the thread Try scrolling up Edited September 8, 2008 by Guest
jkub Posted September 8, 2008 Author Posted September 8, 2008 here is a script that creates a platform like object and is supposed to move it up when player steps into the marker. at first i made it at position 0 0 5 as a test and it worked perfectly. but when i changed the posistions it stoppped working here it is elevator = createObject ( 5154, -1157.0510253906, 140.57569885254, -2.1713070869466 ) marker = createMarker ( -1157.0510253906, 140.57569885254, -1, "cylinder", 2, 0, 255, 0, 175 ) function MarkerHit ( hitPlayer, matchingDimension ) if getElementType(hitPlayer)=="player" then moveObject ( elevator, 10000, -1157.0510253906, 140.57569885254, 10 ) end end addEventHandler("onMarkerHit", getRootElement (), MarkerHit)
DefiniteIntegral Posted September 8, 2008 Posted September 8, 2008 "cylinder" types only seem to recognize the hit if your feet are touching the base of the cylinder. Because cylinders snap to terrain level, at those coordinates it snaps to ocean level. If you lowered the platform to -3.25, the top surface would be just barely under water. In that setting, the platform works. At all above ocean level, it doesnt work. One method is by changing the type to "checkpoint". However this has the problem that even once the platform raises, the checkpoint graphic still sticks through the platform, even though you cant interact with it. You can fix it if you change it to type "corona" and set the Z coord at 1.25 instead of -1. It seems to work totally fine that way. Coronas do not snap to terrain level, and detect all hits.
jkub Posted September 8, 2008 Author Posted September 8, 2008 Ok i got that strait now but got some probs... 1 i have made an outputchatbox message that says "going up" but it is server side. I tryed to make the message client only but couldent do it so here that is outputChatBox ( "Going up", 255, 255, 255 ) and next how would i make it go back down. would i have to use another moveobject thing or what...????
DefiniteIntegral Posted September 8, 2008 Posted September 8, 2008 (edited) Ok i got that strait now but got some probs...1 i have made an outputchatbox message that says "going up" but it is server side. I tryed to make the message client only but couldent do it so here that is outputChatBox ( "Going up", 255, 255, 255 ) and next how would i make it go back down. would i have to use another moveobject thing or what...???? The format of outputChatBox is (message, element, r, g, b, colorcoded) So you were trying to display the message to the element '255' which obviously isn't going to work. I normally just do outputChatBox("message") for server-wide notices, which sends the message to the root element. If you just wanted to tell the player who activated the lift, just use outputChatBox("Going up", hitPlayer) It will be in white text anyway I think, so no need to worry about the 255, 255, 255. If you wanted colorization, then use outputChatBox("Going up", hitPlayer, 255, 255, 255, true) As for a two way elevator.. try adding element data to both markers. eg upMarker = nil downMarker = nil platform = nil platformInUse = false -- elevator setup function. call this once. function setupElevator() if not platform and not upMarker and not downMarker then -- create platform platform = createObject( 5154, -1157.0510253906, 140.57569885254, -2.1713070869466 ) -- create markers upMarker = createMarker( -1157.0510253906, 140.57569885254, 1.25, "corona", 2, 0, 255, 0, 175 ) downMarker = createMarker( -1157.0510253906, 140.57569885254, 13.25, "corona", 2, 0, 255, 0, 175 ) -- set direction of marker mechanism with setElementData setElementData(upMarker, 'direction', 'up') setElementData(downMarker, 'direction', 'down') end end function MarkerHit ( hitPlayer, matchingDimension ) if getElementType(hitPlayer)=="player" then local direction = getElementData(source, "direction") -- only activate if platform is not currently in use if platformInUse == false and direction then if direction == 'up' then -- move platform up moveObject ( platform, 10000, -1157.0510253906, 140.57569885254, 10 ) -- set platorm in use status to true, and set timer to free the mechanism platformInUse = true setTimer(unlockPlatformMechanism, 10000, 1) -- inform the player outputChatBox("Going up", hitPlayer) elseif direction == 'down' then -- move platform down moveObject ( platform, 10000, -1157.0510253906, 140.57569885254, -2.1713070869466 ) platformInUse = true setTimer(unlockPlatformMechanism, 10000, 1) outputChatBox("Going down", hitPlayer) end end end end addEventHandler("onMarkerHit", getRootElement (), MarkerHit) function unlockPlatformMechanism() -- just set use flag platformInUse = false end function onResourceStart( resourcename ) setupElevator() -- do whatever other setup stuff for this map end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), onResourceStart ) I have tested this code, it works. Edited September 9, 2008 by Guest
50p Posted September 8, 2008 Posted September 8, 2008 There is an event: onMarkerHit and onPlayerMarkerHit. There is this thing: Its called reading the thread Try scrolling up It happens... I replied to the last page question and didn't notice this page exists.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now