Author Topic: Support_EnterVehicleOnClickOnly  (Read 1190 times)

A short support script i wrote out for Daniel S. Turns out you need to package WheeledVehicleData::onCollision to do this properly with minimal code (no need to check %vehicle slots, etc). This means I had to rewrite the vehicle collision causing damage code - I'm not sure if that's correctly written, but it seems mostly correct.

Any feedback would be great and I'll publish any fixed/improved versions in the OP as they come.

raw: still buggy as forget, let me fix it up a bit more
« Last Edit: October 29, 2016, 05:33:51 PM by Conan »

I know it's impossible, but it would be amazing if it was able to create a mod that allows the player to walk inside a vehicle while it's moving, like you mount in the vehicle but you can walk around in it, having it's own gravitational box

I know it's impossible, but it would be amazing if it was able to create a mod that allows the player to walk inside a vehicle while it's moving, like you mount in the vehicle but you can walk around in it, having it's own gravitational box
That would be amazing, If only it were like GTA 5 with the plane and the boats.

All I made it do is walk around the boat when it's still

Really can't wait to see this add-on work with my boats!
« Last Edit: October 30, 2016, 06:22:42 AM by Daniel.S »

I remember creating a script like this a long time ago that would basically work by teleporting you above the vehicle for an instant, simulating a collision, then teleporting you back if you weren't mounted. Surprisingly seamless considering the weird workaround, and it meant any other checks for vehicle entry work the same. Seems you've taken the link down at the moment so I can't compare the two, though mine didn't block the traditional entry method. It'd be nice if there was an exposed method for this process.

I remember creating a script like this a long time ago that would basically work by teleporting you above the vehicle for an instant, simulating a collision, then teleporting you back if you weren't mounted. Surprisingly seamless considering the weird workaround, and it meant any other checks for vehicle entry work the same. Seems you've taken the link down at the moment so I can't compare the two, though mine didn't block the traditional entry method. It'd be nice if there was an exposed method for this process.
mine does the exact same; however, it only works on vehicles with datablocks that have isEnterOnClickOnly = true. since onCollision has been packaged, i had to rewrite the vehicle collision code, and that's whats preventing me from releasing.

i took down the link from the OP since I don't want modders copying the code/link and using the buggy version later, and I plan on releasing it as a standalone Support mod on Blockland Glass/Add-ons. You can take a look at it here: http://puu.sh/rZZ8e/fe5c67d664.cs

mine does the exact same; however, it only works on vehicles with datablocks that have isEnterOnClickOnly = true. since onCollision has been packaged, i had to rewrite the vehicle collision code, and that's whats preventing me from releasing.
Couldn't you just package the onCollision function to check for the case of if (%db.isEnterOnClickOnly && !%obj.isClickToEnter && %obj.getClassName() $= "Player"), and if so set a variable on the vehicle to the player's ID, call the parent, then clear that variable. Then package minigameCstar fishe, and check if you've got a player and a vehicle, and then if the vehicle has that variable set to the player. If so, set $lastError to 0 to prevent an error message, send your own error message, and return 0 to prevent mounting.

Basically when trying to jump on the vehicle, you'd be using the same onCollision, but sabotaging a critical function so they won't be able to get in. Then your click script tells it to skip the sabotage and carry out the onCollision naturally.

hm, that might work. however iirc the trace didn't show any use of minigameCanDamage to determine if the vehicle could hurt the player, but I'm only 50% sure.

i have the original/default on collison script though so i can use that to check if its that easy or not. just gotta reformat the mem dump to be readable

hm, that might work. however iirc the trace didn't show any use of minigameCanDamage to determine if the vehicle could hurt the player, but I'm only 50% sure.

i have the original/default on collison script though so i can use that to check if its that easy or not. just gotta reformat the mem dump to be readable
Vehicle damage can be a bit weird, but you probably don't have to worry about it if you just rely on the default collision method to handle everything, save for the minigameCstar fishe which you'd be overriding. Unless there's some other problem you've found you need to tackle?