| 10-16-2004, 03:57 PM | #1 |
- - - - - - - - - MONSTER SPAWNING, ITEM DROPS, RANDOM CONVERSATIONS AND TAUNTS - - - - - - - - - In other words, a guide to creating an (open) RPG by a n00b for n00bs. Rao Dao Zao - "I am the Alpha and the Omega" I was prompted to think about this by somebody PMing me, and asking about random item drops. I told this person the way I would normally do it, with tonnes of IF statements but then, later on I realised that this method was horribly inefficient. Then I got to thinking about the whole open RPG thing, and this is what I came up with... Requirements: - Warcraft III and the Frozen Throne - Basic knowledge of the trigger editor - A +3 resistance to bad jokes/puns (ouch, I've started already) CHAPTER 1: Monster Spawning You might need to create new monsters when old ones die, then give them orders... But how? Well, with a couple of variables and some triggers, here we go... First of all, create your spawn region - call it "Monster Spawn 1". Place around this, oh, I don't know, some Murloc Tiderunners, for the neutral hostile, or your creep player. Now, aside from this region, create another region, where our creepy creeps will wander to - "Monster Spawn 1 Destination 1". And then create another region in the other direction, so they can go both ways - "Monster Spawn 1 Destination 2" (feel free to abbreviate, but keep it organised). Now, let us descend to that foul pit of fear and insane code... The trigger editor! Create a new trigger, call it "Monsters Setup". Event: map initialisation. Conditions: none. Oh, wait, we need some variables. One - an integer, call it "MonsterDestRandomizer" - this is the variable we use to choose where our beasts go. And then "MonsterSpawn1Dests" - a region array of size 2. Now, back to the setup. Actions: Set MonsterSpawn1Destinations[1] = Monster Spawn 1 Destination 1 <gen> Set MonsterSpawn1Destinations[2] = Monster Spawn 1 Destination 2 <gen> Easy. Our regions are all set for the rest of the triggers. You might want to also put something to start the existing creeps moving in here. Now, another trigger: Tiderunner Death Trigger: ![]() Actions![]() ![]() Wait 15.00 seconds [So that the player is not instantly set upon by new monsters]![]() ![]() Unit - Create 1 Murloc Tiderunner for Neutral Hostile at (Random point in Monster Spawn 1 <gen>) facing (Random angle) degrees![]() ![]() Set MonsterDestRandomiser = (Random integer number between 1 and 2)![]() ![]() Unit - Order (Last created unit) to Patrol To (Random point in MonsterSpawn1Destinations[MonsterDestRandomiser])And there you go. Now, to add more monster spawns, you'll need to create more triggers, one for each creep type in each region. Of course, you could double-up some creep types, but we'll leave that for another day. The number of creeps existing is directly related to the number you place at the beginning, so to make an area more difficult all you need to do is add more of the appropriate creep. CHAPTER 2: Random Item Drops This is a little simpler, and uses the same randomisation technique. Create another setup trigger (for simplicity at this stage, we can amalgamate them later) called "Items Setup". And create a new variable: "Items", an item-type array of roughly double the number of possible items. "Whut?!" I hear you cry, but it'll make sense in a minute. And create another randomise variable, "ItemsRandomiser". Now, in the setup trigger, we must define our item-types in the Items variable, but leave one blank between items, e.g: Trigger: ![]() Set Items[1] = Health Potion![]() Set items[3] = Mana PotionThis will mean that there is a good chance of no item at all dropping, which is good since we've only got six slots. Create a new trigger: "Item Dropper" - Trigger: CHAPTER 3: Random Conversations So, now we've got monsters, we've got items, but, random punters are mute! What a "living" world we've got, yeah. Let's get us another setup trigger, call it "Conversation Setup". Create a new variable, call it "PunterConversations" - a string array of size, let's go for four. And a new randomiser, "ConversationRandomiser", an integer as always. Now, more variable setting... Trigger: Actions![]() Set PunterConversations[1] = Good day, sire!![]() Set PunterConversations[2] = Lovely weather, eh?These random comments make the world a little tiny bit more interactive. Now, let's get down to business... A new trigger: "Converse with punter" Trigger: ![]() Conditions![]() ![]() (Distance between (Position of PlayerHero) and (Position of (Triggering unit))) Less than or equal to 200.00![]() (A "real comparison". "Distance between points" comes under "Math". This is here so that you have to be close by to get some words out of somebody. Can't have them shouting across mountain ranges and oceans, can we...?)So, add another condition: ((Triggering unit) belongs to an ally of Player 1 (Red)) Equal to True This should mean that only allied players speak... At this stage, we should be putting it all under an "And - all (conditions) are true" thing. But still, we can't have allied dogs or sheep speaking, can we, so we'll need to narrow it down a bit further: Trigger: CHAPTER 4: TAUNTS When we kill an enemy in game such as Unreal Tournament, we love it when our avatar gives us a hilarious taunt, along the lines of "Who's your daddy?!" and other crazy catchphrases. The same for Warcraft III, I'll have you know. I'm surprised Blizzard didn't include a random taunt system... Anyway, here's a good way of doing it: Create another setup trigger, you know the drill. We need a new randomiser, a string array of taunts and a Floating Text array, with the same size as your taunt string array. In the setup trigger, define all those messages we love to hear. And now add our taunt message trigger: Trigger: CHAPTER 5: To infinity and beyond... Well, there you go. That's enough kit to create a (mildly) interesting RPG world. And with less bad jokes than I can usually fit in... Anyway, it should provide hours of fun for all the family. If you find any bugs, or have any comments/suggestions, either post below or e-mail [email protected] Thank you, and good night. Rao Dao Zao, over and out. |
| 10-17-2004, 01:29 PM | #2 |
Brilliant? ^_^ |
| 02-10-2006, 09:22 PM | #3 |
Wow, thanks. That was a good tutorial. |
| 02-10-2006, 09:34 PM | #4 |
Good, but with LOTS of preplaced monsters, having different types, a trigger that respawns monsters in there exact location, and a one-for-all trigger helps alot. |
| 02-11-2006, 10:43 AM | #5 |
Urk! Who's been trawling for my old tuts...?! The Floating Text bit is out of date; instead of waiting and destroying all the texts, you should follow the creation of the floating text with a: set lifespan, set fadepoint (about one second less than lifespan) and a disable permenancy. And a set velocity if you want. All referencing "last created floating text." Then you can dump the variable holding the floating text objects and let them destroy themselves without confusion. |
| 05-20-2006, 08:18 AM | #6 |
... I am having trouble figuring this out... Set Items[1] = Health Potion Set items[3] = Mana Potion I can do the first part, set items[1] = But the second part it will not let me select a generic item. It forces me to select something already on the map. . . .. How do I make it choose a item... for say a health potion? |
| 05-29-2006, 09:04 AM | #7 |
Sure it's an Item-type array and not just an item array? |
| 07-14-2006, 06:20 AM | #8 |
The ItemRandomiser, how big array should it have? |
| 07-14-2006, 07:55 AM | #9 |
Nvm just found the error xD Forgot to put Map initialization on the first trigger |
