Damaging Indestructable Scene Objects

正在查看此主题的用户

I've been puzzling and puzzling and now my puzzler is sore. I need a scene prop to take damage and not die. Well, I don't need it to really take damage, but I need the damage done to be passed to the second parameter of the ti_on_scene_prop_hit. Making the prop indestructible makes it so the damage isn't sent to the parameter, it seems. I tried replacing the prop with another prop of the same kind upon destruction like so:
插入代码块:
(ti_on_scene_prop_destroy,
 [
   (replace_scene_props,"spr_annealing_metal","spr_annealing_metal")
  ]),
That didn't work.

I could calculate the damage manually. I can't get the damage of the weapon being used, but there are only a handful of weapons that will be striking this prop, so I could test to see which weapon is being used and set the damage accordingly. I'd like to use that as a last resort, in the hopes that a better solution may be presented. I'm of the opinion that, if the need should arise, I should only need to update a weapon's damage only where it's defined.
 
What you could do is set up a global var for the object that can be destroyed.  "$g_des_prop" or what ever.  When you enter the scene, set it to = 100, or what ever.
Then when the prop is hit, subtract what you want from it.  In the same code, add a check to see if the global variable is less than 0.  If it is, then replace the prop.
 
so rather than calculate the damage, you would use the amount of hits?

That could actually be a clever way to do it and it won't be obvious to the player. Shoot the door with more men (balistas, whatever), it will go down faster, with less it will take longer.
 
but what about adding this in "module_scene.props.py" > in every scene you want to have destructable things??

can this also work?
 
MartinF 说:
timedanze 说:
and in which module file you puted this code?  :oops:

you would be using triggers in the mission_templates file

Actually, I think this would be (like how hokieBT did it) in the triggers for the scene_prop itself.  I would have to go look.  SHC has it in the right place, he just needs to use the right trigger and do the calculations I stated above.  If you wanted a bit of randomness to it, you could make each hit do a range of damage (say 5-15).

The reseting of the variable would be done most likely on the call to enter the scene (the code block that calls the mission template should have a line above the call to assign the variable to it's starting level).

I may be doing the same with some of my seiges.  I'm hoping to have a variety of ways to assualt a castle, depending on what level the castle is build up to.
 
jik 说:
MartinF 说:
timedanze 说:
and in which module file you puted this code?  :oops:

you would be using triggers in the mission_templates file

Actually, I think this would be (like how hokieBT did it) in the triggers for the scene_prop itself.  I would have to go look.  SHC has it in the right place, he just needs to use the right trigger and do the calculations I stated above.  If you wanted a bit of randomness to it, you could make each hit do a range of damage (say 5-15).

The reseting of the variable would be done most likely on the call to enter the scene (the code block that calls the mission template should have a line above the call to assign the variable to it's starting level).

I may be doing the same with some of my seiges.  I'm hoping to have a variety of ways to assualt a castle, depending on what level the castle is build up to.


what do you mean: "depending on what level the castle is build up to."

...levels??? or do you speak in case of modding scenes for "custom settlements" ??
 
If you've seen some of the threads I've posted (search for kit) I have already put together and posted a kit that will allow you to add (unused) villages within a specific range of your town.  It's still a work in progress on my Bloodlines mod.

That aside, I am working on a castle upgrade system, meaning you start with just a keep, and work your way up to a castle town with a moat, guard house, etc.  None of that is done yet, but the plans are in the works.  Down side to this is that most of the castle scenes will look similar (I am not going to create 4-5 castle scenes for each of my castles!).  I may just copy the scenes and make slight differences, but I'll have to see how much time it takes to make the first castles.  Same goes with my villages.  The scenes will change as you upgrade them, so again, each town may look identical, once fully upgraded.  Once I get going, if I can find a scene editor that wants to help, then I'll see how it goes.  Right now this is a solo project and I'm still learning the ropes.
 
this sound really amazing JIK!

also, there is still no mod available, who have your named features!!
I am really looking forward to it!
many luck and all the best wishes!
 
...annother thing...

how can you adwise AI to destroy the gate?? I think the AI is scripted to run to ladder.. or siege tower...
 
That's a good question.  I have no idea.  Check out HokieBT's thread.  I'll post the question there and see if he responds.  He's done this in his mod, I have yet to try it.
 
the AI in SWC doesn't use the destroyable doors atm, it's just for players to use.

You'd have to write a new AI that checks if the keep has a destroyable door and then attacks that instead of running up the ladders.

As with most things, it's possible but will have to be tested quite a lot to make sure it actually works. You'd have to change the move orders for unit types, so say make the archers stand back and return fire while the infantry move forward to whack at the doors. But to make it really realistic, you'd also have to add some sort of battering ram, as people knocking a door down with swords doesn't really make the current siege system any better...

So it would be a slightly involved process, all in all.

I think for most people, the most important thing is that they can use it themselves in sieges. Once all that works properly, you can worry about the AI. One thing you'll have to do is change the current AI mesh, removing the AI limiter that's there (if it is) and adding new grids to the AI mesh so your troops will actually follow you through the door once it's broken and you'll have to do that manually for each scene you want to use this feature in.
 
No, that's the point. If there's no AI mesh, your troops won't follow you since the game is telling them they can't walk through the door
 
jik 说:
What you could do is set up a global var for the object that can be destroyed.  "$g_des_prop" or what ever.  When you enter the scene, set it to = 100, or what ever.
Then when the prop is hit, subtract what you want from it.  In the same code, add a check to see if the global variable is less than 0.  If it is, then replace the prop.
This is a good idea that will solve two problems at once. Many thanks, jik.
 
SHC,

When you get it going, lut us know.  I too will most likely need something like this my mod down the road.  I have to admit, all I gave was theories and ideas.  I have not put them into practice yet.  The logic seems right, but you never know... :smile:

 
You could use the current siege tower set up to move a battering ram to the wall, the AI uses it pretty well. I don't know how you would calculate success, maybe have each soldier at the ram counted and apply that much damage to the door, with an interval check until the door is down. This would require AI to move more infantry up to the ram as the ones using it are struck down.

mfberg
 
Oh it would be cool that the ram does like 10 damage, but its the only way to damage the doors, that's how you could prolong the destruction of the gate so you don't have to add too many doors, and make about 5 doors, makes it more realistic :smile:
Plus what mfberg said :smile:
 
后退
顶部 底部