Some new script additions

Content and general development discussion, including quest scripts and server code. TMW Classic is a project comprising the Legacy tmwAthena server & the designated improved engine server based on evolHercules.


Forum rules

This forum houses many years of development, tracing back to some of the earliest posts that exist on the board.

Its current use is for the continued development of the server and game it has always served: TMW Classic.

Post Reply
nmaligec
Warrior
Warrior
Posts: 253
Joined: 08 Apr 2010, 01:55

Some new script additions

Post by nmaligec »

I added a few new script commands to get better control of mobs. Here is the git patch for the server src, as well as a simple test script to demo the new commands (and make sure they don't crash anything). I would really like to be able to use these in boss scripts, so I hope they get included in the mainline.

The test script will spawn a new npc right next to Ian (the rules guy) in Tulimshar. Talk to Vash to start a fight with a 'specially trained' maggot, whose difficulty increases with each battle (up to 9 battles). The default maggot mob from mob_db.txt is used and no additional graphics or resources are needed besides this script file (don't forget to add it to an _import.txt). Can you beat all 9 levels of maggoty goodness???

If the patch is approved and if there is interest, I can expand this test script into a proper quest.

As a side note, this script would be great for balancing since it can let you change mob stats quickly without restarts or fiddling with db stuff. A very thorough version of this script, that also sets level and equipment, can help find appropriate mob stats/difficulty for different level ranges. It would also help determine appropriate equipment for each level.
Attachments
New script commands.zip
maggot_trainer.txt
new_mob_script_commands.patch
(7.39 KiB) Downloaded 98 times
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: 25 Aug 2005, 16:08
Location: Germany

Re: Some new script additions

Post by Crush »

I am not involved in tmwAthena development, so I can not really say much about that patch, but I think the functions get- and setmonsterstate should be get- and setmonsterstat.
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
User avatar
o11c
Grand Knight
Grand Knight
Posts: 2262
Joined: 20 Feb 2011, 21:09
Location: ^ ^

Re: Some new script additions

Post by o11c »

Well, I'm not opposed to the concept, but I'd rather not see any more changes to the tmwAthena code for now, since I'm

Also, this just *happens* to be one of the things that is scheduled to be taken apart and put together unrecognizably.

That being said, I can still comment on the implementation:
  • Don't use 'class' as an identifier, since it's a keyword in C++ (in which my branch is now written).
  • Check the result of map_id2bl before converting all the arguments.
  • The indentations is really messed up. Use 4 spaces, no tabs.
  • Use the enum values in your case statements.
I also have to reject "update being name" because of its problems. Though, it would be possible to fix it my changing clif_mob_appear ... but that's one of the functions to which I have made significant changes already.

But my overall verdict is still "wait until I'm done with my project."
Former programmer for the TMWA server.
nmaligec
Warrior
Warrior
Posts: 253
Joined: 08 Apr 2010, 01:55

Re: Some new script additions

Post by nmaligec »

The suggestions from Crush and 011c are very applicable. The only unavoidable issue is that the variable class was already defined as part of the mob_data struct in map.h, so there is nothing I can do about that...

I am just wondering if anyone actually tried out the test script to see the potential of the new commands. At the very least try the demo and then make a judgment, don't just read the patch diff and make a decision based on that.

The main reason why I wanted to do this was to get a specific mob's x and y coords. I also found it very helpful to change their combat stats. One of the nifty things I uncovered while testing this is that getting the mob's target can actually be VERY useful, and that the mob's block list ID is enough to use as an argument to the misceffect command to place an effect on that specific mob (it can probably be used in a few other being specific commands as well).

I would use these extensively in the reaper boss fight to make it more interesting and to improve the design/efficiency.
User avatar
o11c
Grand Knight
Grand Knight
Posts: 2262
Joined: 20 Feb 2011, 21:09
Location: ^ ^

Re: Some new script additions

Post by o11c »

I've given this some more thought, and I think this would be proof against forgetting it:

Please prepare a patch against my git branch: http://gitorious.org/~o11c/tmw-eathena/ ... a-comments
based upon the following principles, as well as earlier feedback:
The "set them all at once" function is rejected.
The ability to set the mob's name is rejected for now (I'm still planning major renovations to the implementation of beings).
Setting monster's x and y duplicates the functionality of move_monster ... in fact, I'm not really happy with fact the cases that are not md->stats.
I suggest giving the new getx() and gety() an optional parameter, the ID of (any) block.
Don't include md->size or md->def_ele, or the nonfunctional md->target_id
That leaves "current hp" and "mode". Mode should be a separate function, but I believe it is not appropriate at this time.
"current hp" would definitely be useful.
You must provide appropriate constants in the server-data db/const.txt

Note that maps are no long char *, but a new type:

Code: Select all

fixed_string<16> map;
map.copy_from(conv_str(...));

For movemonster, put in the comments "walk" instead of "move"
Also provide appropriate constants.

Other than that, variables shall be declared and initialized at the same time.

BlockList has become a superclass.
Use static_cast<new_type *>(expr)

Finally, comments that provide documentation are /** body */ or /// body.

Make sure it compiles! (requires GCC 4.6 for now, although I may port it to 4.5 of 4.4 if I find portability more important than useful features.)

Note the consequence: this will only be available once I'm done with my changes, which is still quite a while away. And it won't be put on the main server until it has been tested thoroughly.
I still recommend, however, putting them in db/const.txt, so they are not forgotten when the time comes to convert that file. Though it would be a good idea to leave them commented out.
Former programmer for the TMWA server.
Post Reply