• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Medium Priority Preventing walktrough buildings

Levis

Find(Rum) = false;
Staff member
Administrator
Creative Support
Programmer
Storm Modder
So I was looking trough some of the things and I got an idea. maybe @Jack Rackham and/or @Bartolomeu o Portugues could help me with this.

We all know the bouding box of an character is different when its fighting vs when its normal.
From what I can tell this has something to do with the animation. Do people agree with me on this?

This is probably because the highest distance of an points in the model is further away from the center. So I think the bounding box for characters is somehow defined there.
I noticed we do have other animation files created in the past for example for Tia Dalma so we have people who can edit those. And I noticed tool has a functionality for this too.
From what I understand the BuildMod buildings are made by having a character and giving him a wrong model so you actually see a building. Now my idea was, would it be possible to have different animations for different radiusses or bouding boxes which could be very simpel if needed. And assign a certain animation to the building depending on how large it is?

I haven't done a proof of concept yet because I'm not really familiar with this. Could someone tell me if this is tried before (@Pieter Boelen maybe)? Or if there is a flaw in my logic?
 
If I recall, I once did try something but didn't get very far and it didn't work. Think it was to convert the buildings INTO characters, hoping that the bounding box would help.
There is also this thread: Feature Request - A thought about the walk-through player buildings... | PiratesAhoy!

I noticed we do have other animation files created in the past for example for Tia Dalma so we have people who can edit those.
HAD! Those people are no longer around.

From what I understand the BuildMod buildings are made by having a character and giving him a wrong model so you actually see a building.
Character that is either invisible or doesn't move. The buildings themselves are actually swords and pistols.
 
The buildings themselves are actually swords and pistols.
Yes, so I don't know
what it would/can be if the character's animation is changed.

SetModel(Pchar, pchar.model, "fast_man", "man", 1.8, true); this is how the standard animation is changed
to another one.

And assign a certain animation to the building depending on how large it is?
Sorry have no idea.

I have never done anything with animations in the TOOL except "cycle anmiations" which my young buddy likes.
 
okay did some more looking around.
Animation will indeed be very tricky. So hear me out on this one.

When an building is made an event is started. This event calls this FindNearCharacters now and then.
When an character is within the radius which is define for the building the character will be teleported back.
The teleportation happens by first determening the vector between the character and the object. then the character is moved back on this vector for a very small bit. If the vector is exactly 0, 0.5pi, pi or 1,5pi it will take a little offset so characters bouncing agains something will eventually walk past by it. Maybe even keep count on how often he bounced and having the change be larger if this is more.

What do you guys think. Could this work? I think it could and I wanna try it :p.
 
Wouldn't that require a lot of extra loops and events and checks and such?
Any chance of leaving this one until after Beta 4 is released just in case it won't be all that simple?

As much as this has always been most definitely weird, it never bothered me so much as you can just choose to not walk through those buildings.
And it might get tricky for those where you DO need to.
Consider the jungle trees and the ones that abuse the "waking through the wall" feature to allow you to visit their interior.
 
Wouldn't that require a lot of extra loops and events and checks and such?
Any chance of leaving this one until after Beta 4 is released just in case it won't be all that simple?

As much as this has always been most definitely weird, it never bothered me so much as you can just choose to not walk through those buildings.
And it might get tricky for those where you DO need to.
Consider the jungle trees and the ones that abuse the "waking through the wall" feature to allow you to visit their interior.
I know. if and when I implement it there will be a toggle to disable the whole feature, so I can work on it in stages but we can disable it for releases and only people who want to chose to enable it untill we know for sure it works.
I think the amount of extra loops wouldn't be that much, they are engine calls so the engine handles them better.
Besides I was thinking about adding an attribute to a building specifying if you could walk trough it or not.
 
The should already be a toggle on the BuildingSet mod itself.
So players who are bothered by the weirdness can at least get rid of them already.
 
oh hey it's working :p I now have an windmill which you can't walk trough anymore without any noticable loss in fps.
:aar

There's a toggle which you can use to disable it.
Find a windmill somewhere and try to walk trough it. I sugest going to hispaniola, there is one in the jungle and one just outside a town which has always npc's around so you can see they wont go trough it either.
 

Attachments

  • Levis_Fixes_colliders.zip
    677.8 KB · Views: 130
Interesting way to solve it, nice work mate! walking through walls, or bulkheads for the matter, has always really annoyed me.
 
Interesting way to solve it, nice work mate! walking through walls, or bulkheads for the matter, has always really annoyed me.
me too.
For now the system only works for round things. I think i will keep it this way in the next full release and probably disable the feature when released. after that I'm going to expand it more. maybe if I got some time left I will add rectangles also. In that case you should be able to define the boundries for most types of buildings. its just a matter of gettings the right coords then.
 
oh hey it's working :p I now have an windmill which you can't walk trough anymore without any noticable loss in fps.
And when you do try to walk through it, the FPS drops so much that you'll think better of it and turn back! :rofl

Only joking here.... haven't actually tested it yet. :razz

One building that is probably the most annoying as far as "walking through it" is concerned would be the WIC Office in Willemstad port.
 
This is great! :xmas Many locations look good but suffer from the no collision thing. And it's so difficult trying to get it right editing the walkpatch. :modding
 
I could focus my time first on making rectangles work too. In that case we can fix some of the buildings very soon.
 
Rectangles probably would help a lot. :onya
well it will be 4 sided polygons because the math for a rectangle and a 4side polygon is almost the same so why not make it a bit more general then in the first place :p.
Now to brush of my math to see if I can determine areas of triangles very fast :p.
 
Just DLed it. How about the windmill at Philipsburg? It is right in the middle of the waterfront.
 
I'm testing right now in this location:
Code:
DoQuestReloadToLocation("Hispaniola_jungle_08", "reload", "reload1" ,"_");
But I still walked right through. Adding some traces now....
 
@Pieter Boelen there seems to be a weird glitch when you do a quest reload it doesn't work instantly. Looking into it.
Walk outside the location and go back in and it works.
 
Here is a new version. This one also handles polygons with 4 points. I've set it up for baracks (the officer of the WIC on curacao). The other things someone else can set up.
It's very easy.
Just go to all 4 corners of building and do a trace to get the coords of the character.
Code:
float x,y,z,ay;
    GetCharacterPos(pchar, &x, &y, &z);
    trace("x "+x+" y "+y+" z "+z);

If you also have the coords of the building (which you can find in the location init file) just substract the x and z coords for each corner and set them as p0 till p3 in the template file.
Name the template file the same as the building and it will work. the system will calculate rotations etc.
 

Attachments

  • Levis_Fixes_colliders2.zip
    678.6 KB · Views: 123
@Levis: Here are some results from my tracing:
Code:
Build: Windmill here
Build: adding collider
AddCollider for Windmill
Trying....
Finding....
Loading....
Adding check 0
Looks like the game adds one single check and CollideCheck never does actually get called.

And you're right, it DOES work after leaving the location and coming back again.
No notable performance loss either. This is definitely the best BuildingSet collision I have ever seen; I'm impressed! :woot

Funny effect: If you set time compression to 20x, you CAN still run through the mill. :rofl
 
Back
Top