wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Tutorials > Trigger (GUI)/ AI editor Tutorials
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 10-16-2004, 03:57 PM   #1
Rao Dao Zao
www.raodaozao.net
 
Rao Dao Zao's Avatar


MDL & Resource Moderator
 
Join Date: Aug 2003
Posts: 2,511

Submissions (27)

Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)

Approved Map: When the Freedom Slips Away

Send a message via MSN to Rao Dao Zao
Default Monster Spawning, Random Item Drops, Random Chat (with villagers) and Taunts

- - - - - - - - -
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:
Collapse Event
Unit - A unit owned by Neutral Hostile Dies
Collapse Conditions
(Unit-type of (Dying unit)) Equal to Murloc Tiderunner
Collapse 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])
Basically, this trigger waits then creates a new creature of the same type that died, thus this new monster will also fire the trigger. It then sends the beast to one of the two destination regions, a random point in there for added realism.

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 Potion
Et cetera...
This 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:
Collapse Events
Unit - A unit owned by Neutral Hostile Dies
Conditions
Collapse Actions
Set ItemsRandomiser = (Random integer number between 1 and [Max Index of Items array])
Item - Create Items[ItemsRandomiser] at (Position of (Dying unit))
Easy. Choose a random number, and "drop" the right item. No bother, and in only two triggers! Bargain!

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?
Et cetera...
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:
Collapse Events
Player - Player 1 (Red) Selects a unit
Collapse 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...?)
Collapse Actions
Set ConversationRandomiser = (Random integer number between 1 and 4)
Game - Display to (Player group((Owner of PlayerHero))) for 5.00 seconds the text: PunterConversations[ConversationRandomiser]
And there you go. Take your hero close to a unit, select and get some talk... But wait a sec! We'll get this if we select *any* unit...
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:
Or - Any (Conditions) are true
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to Villager (Male 2)
(Unit-type of (Triggering unit)) Equal to Villager (Male)
So only male villagers will actually speak. At this point, I start to add lots of IF statements, so different types of commoner get different conversation messages, but that's not so difficult to do...

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:
Collapse Events
Unit - A unit Dies
Collapse Actions
Set TauntRandomiser = (Random integer number between 1 and 10)
Floating Text - Create floating text that reads Tauntz[TauntRandomiser] above PlayerHero...
Set TauntzFloating[TauntRandomiser] = (Last created floating text)
Wait 4.00 seconds
Collapse For each (Integer A) from 1 to 10, do (Actions)
Collapse Loop - Actions
Floating Text - Destroy TauntzFloating[(Integer A)]
Because it's floating text this time, we need to destroy the text after a few seconds. The "For each (Integer A)" loop is there so that no taunts get left behind if the randomise variable is changed for a quick second kill. Floating text will eventually disappear, but not for ages. If you're running on a low resolution, you might want to step up the text size a little so you can actually read it. Sometimes, some do slip through, but they are few and far between, so don't worry too much.

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 theroberdozer@hotmail.com

Thank you, and good night.
Rao Dao Zao, over and out.
__________________
Rao Dao Zao is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 10-17-2004, 01:29 PM   #2
Med. MapGuy
User
 
Med. MapGuy's Avatar
 
Join Date: Dec 2003
Posts: 138

Submissions (2)

Med. MapGuy is on a distinguished road (16)

Default

Brilliant? ^_^
Med. MapGuy is offline   Reply With Quote
Old 02-10-2006, 09:22 PM   #3
Alhariel
User
 
Join Date: Jan 2005
Posts: 52

Alhariel has little to show at this moment (4)

Default

Wow, thanks. That was a good tutorial.
Alhariel is offline   Reply With Quote
Old 02-10-2006, 09:34 PM   #4
Murder1833
User
 
Murder1833's Avatar
 
Join Date: Dec 2005
Posts: 152

Murder1833 has little to show at this moment (7)

Send a message via AIM to Murder1833 Send a message via MSN to Murder1833
Default

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.
Murder1833 is offline   Reply With Quote
Old 02-11-2006, 10:43 AM   #5
Rao Dao Zao
www.raodaozao.net
 
Rao Dao Zao's Avatar


MDL & Resource Moderator
 
Join Date: Aug 2003
Posts: 2,511

Submissions (27)

Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)

Approved Map: When the Freedom Slips Away

Send a message via MSN to Rao Dao Zao
Default

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.
__________________
Rao Dao Zao is offline   Reply With Quote
Old 05-20-2006, 08:18 AM   #6
Xandramas
User
 
Xandramas's Avatar
 
Join Date: Aug 2004
Posts: 59

Xandramas is on a distinguished road (10)

Default

... 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?
Xandramas is offline   Reply With Quote
Old 05-29-2006, 09:04 AM   #7
Rao Dao Zao
www.raodaozao.net
 
Rao Dao Zao's Avatar


MDL & Resource Moderator
 
Join Date: Aug 2003
Posts: 2,511

Submissions (27)

Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)Rao Dao Zao has a brilliant future (822)

Approved Map: When the Freedom Slips Away

Send a message via MSN to Rao Dao Zao
Default

Sure it's an Item-type array and not just an item array?
__________________
Rao Dao Zao is offline   Reply With Quote
Old 07-14-2006, 06:20 AM   #8
Fallenzeca
User
 
Join Date: Jul 2006
Posts: 32

Fallenzeca has little to show at this moment (0)

Default o.O

The ItemRandomiser, how big array should it have?
Fallenzeca is offline   Reply With Quote
Old 07-14-2006, 07:55 AM   #9
Fallenzeca
User
 
Join Date: Jul 2006
Posts: 32

Fallenzeca has little to show at this moment (0)

Default

Nvm just found the error xD Forgot to put Map initialization on the first trigger
Fallenzeca is offline   Reply With Quote
Old 05-09-2007, 02:29 PM   #10
Pinzu
User
 
Pinzu's Avatar
 
Join Date: Apr 2007
Posts: 180

Pinzu is on a distinguished road (21)

Default

so this is how he told you to do..?

Trigger:
Error
Collapse Actions
Floating Text - Create floating text that reads Pinzu at (Position of Peasant 0000 <gen>) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Set f = (Last created floating text)
Wait 4.00 seconds
Floating Text - Destroy (Last created floating text)


What if you create two floating text within 4 seconds?

Yes, only one get removed.

so this is how you should do...

Trigger:
Collapse Test
Collapse Events
Player - Player 1 (Red) types a chat message containing -test as An
//you can change the event to what ever you like.
Collapse exact match
Collapse Actions
Collapse
Floating Text - Create floating text that reads Pinzu at (Position of Peasant 0000 <gen>) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
// Remeber to set a point so it don't leak.
Set f = (Last created floating text)
Floating Text - Change f: Disable permanence
Floating Text - Change the lifespan of f to 4.00 seconds


Now it will be removed after 4 seconds and you can create as many floating texts with this trigger and all will be removed.

No Problem...
Pinzu is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 12:55 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services