Register
Email: Password:
Forum » Modding: paths / non-visual scripting / making a 'sentry'

Modding: paths / non-visual scripting / making a 'sentry'

jgprof 5 years ago
Hi,

I'm starting to look at the editor with the aim of making a mod. I've been messing around with it and I'm beginning to see how it's put together -- impressive! It was somewhat of an epiphany when I realised that all the character models are objects comprising a pile of pngs and some lovingly-crafted animation. I can see why it's taken so long to make!

When I feel that I understand well I'll contribute to the wiki, but in the meantime I have a few questions that can hopefully be answered by Ville or other experienced modders:

[list][*]First, what are 'paths' and what are they for? I assume that they're a way to make bots move around a map, but I can't find any reference to them in the scripting pages, nor do I understand why are all the path nodes connected to each other. I would expect there to be an action which says 'move along nodes 1,3,4,5' or something...[/*]

[*]Second, is it possible to script by typing instead? I noticed that in some game datafile somewhere (can't remember what it was, perhaps one of the things describing bots) actions are written out in text eg 'reduceHealthSweep(X, Y)', so there must be a parser somewhere in the engine. Although point-and-click is fine when I don't really know what I'm doing, I imagine that it would be much faster to just type once I've learned what the various conditions and actions do.[/*]

[*]Finally, I'm trying to make an automated 'sentry' and I'm not sure how to go about it. I'd like the player to be able to move it, and for it to automatically shoot enemies when they come in range. First I tried taking the 'trap' approach, firing a projectile when the player is on a polygon, but I can't see how to make it trigger on enemies or how to actually direct the projectile towards the enemy (I need to know the angle of the enemy relative to the projectile source and I can't see how to obtain this...). I also tried making a bot with a projectile weapon which can't move. This seems like a better solution but the player can't move the bot except by bumping it along. I wondered about making an invisible wall around the bot which the player could drag (thus moving the bot), but this seems non-ideal as when you mouse over the bot the game would still treat it as a bot and not as an object. How would more experienced modders approach this problem? Is it even possible with the current scripting system? Any thoughts would be appreciated...[/*]
[/list:u]
#
ville 5 years ago
Great to hear you're planning a mod! We'll help in any way we can, don't be afraid to ask.

1: The paths laid with the path tool in the editor is used for the AI in the automated pathfinding. It's not actually used for scripting the movement, it's just a network to facilitate moving inside labyrinths and such. You'll need to put these in if you want your bots to be able to move inside buildings and not get lost.

You can however make your bots patrol a path using the patrol script. It will go to any object you name. And there is a script to move to just the specified object. And a script to make the bot look at it. And so on. If you need a specific script action that isn't in the game already, I'm open to suggestions of new ones to add.

2: Not a bad idea. The scripting syntax was designed for point/click, but there's no reason why I shouldn't be able to add a textfield to the visual editor as well. Except that I'd need to make a multiline text box, which is a lot of work.
By the way, the next editor version comes with a quick search tool for script actions/conditions, it speeds up my script writing quite a bit.

3: You could make the non-moving bot, but by default the player can't move bots around. I could add such a feature of course, perhaps make it an option for a bot race. I don't think it would be a big issue, since it's just a flag. Come to think of it, I'll add it to my list, you might see it in the next version. For the moment the only way to make one would be to attach the bot to an object you can move. The cursor usually prefers bots to movable objects, so that might be a problem.
#
jgprof 5 years ago
Thanks for the prompt response!

I must have missed the patrol actions. They sound exactly like what I'm looking for, and now that I know what they do I'll experiment with paths too.

The quick search thing sounds great and is probably just as good as a textbox.

Regarding the sentry, the draggable flag sounds like a good idea. I can envisage a class of bot called 'machines' or something where the dialogue system is used for configuration of the machine. This could open the door for some interesting mods. I'm not yet familiar with all the script actions but I'll certainly let you know if it seems that there's something missing.
#
Endymion 5 years ago
"ville" said:
The cursor usually prefers bots to movable objects, so that might be a problem.
I think making nameless and invisible bots can prevent that but if not either teleporting/hiding the bot temporarily or making the bot very small might work.
#
ville 5 years ago
I took 20 minutes and implemented the feature. In the future you can make bots draggable by setting the flag "draggable=true". You might also want to set their movement speed to 0, or they will try to resist being moved. And you can still talk to them normally, it just interprets a mouse drag as trying to move it. I hope it'll be useful!
#
jgprof 5 years ago
Sounds great. I'll carry on with my bot-sentry in anticipation of this. Can't wait for the next version!
#
Forum » Modding: paths / non-visual scripting / making a 'sentry'

Post Reply


Your email:
Your name: