HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Many transmissions for many units?

01-10-2003, 04:47 AM#1
SilentSpyder
I know a bit a bout variables and stuff, but some of the more complex math stuff, like arrays and forumlas confuse me. Anyway, here is my problem. I have a town with many diffrent units (town folk). I want each unit to have a diffrent talk transmission when u "smart" click them.

Is there a way I can assign the diffrent transmission to all the townfolk, without having to do a trigger for unit. Especially since anyone of these units can be killed.

The way I'm gonna do it for now is have random transmission come out when u click on someone. What I don't like about that is people don't have to walk around town and talk, just keep clicking on the same guy.
01-10-2003, 12:20 PM#2
MrDoomMaster
It is literally impossible to create transmissions for your 'town folk' without using at least 1 trigger. To do this it requires many arrays. If you would still like me to figure this out for you, i'll need more information... give me as many details as you can spare about how the transmissions appear, how they go away... etc.

I'll await your reply
01-10-2003, 01:47 PM#3
Kerry
Hmm i havent thought much of this but what about you add all the townsfolk that can speak to a unit group and then when one villager talk, remove it from the group. That random transmission will be set to only trigger on townsfolk in that unit group.
01-10-2003, 04:13 PM#4
Aiursrage2k
Okay to do this you will indeed need to create some triggers. For this its quite easy to do, just tedious.

Create a string array, so footmen x has a string array, str01. When this unit footmen x is selected, condition unit is alive, action will say one of his random strings, str01[random(start,end)]. So each unit will have his own set of transmissions, his own String. Or if you dont like many many String arrays, you could use one string array with a very large array index.
01-11-2003, 04:52 AM#5
SilentSpyder
Ok here's a more detailed explanation

The map is multiplayer, 6 players to be exact. It takes place in a town, with a lot of villagers walking around. When one of the players "smart" clicks a villager, then a transmission will appear for that player.

The thing is that these villagers can be killed, after a minute or so, a new one will replace the dead one.

So how would I make a diffrent transmission for each villager? Or maybe around 20 diffrent transmissions in all, but always have the same transmission come out on the same villager, some repeats of course since there's more than 20 villagers.

Im going to try and read through some of the suggestions you gave me, and try and figure something out in the meanwhile.


BTW, I know I gotta do some triggers. I just don't wanna make around a hundred diffrent ones.
01-11-2003, 04:55 AM#6
Aiursrage2k
In this case, you will want to use variables for the unit instead of simply unit, when a unit dies, you spawn a new one, and set the last created unit to this unit.
01-11-2003, 04:56 AM#7
SilentSpyder
Quote:
Originally posted by Kerry
Hmm i havent thought much of this but what about you add all the townsfolk that can speak to a unit group and then when one villager talk, remove it from the group. That random transmission will be set to only trigger on townsfolk in that unit group.


But then, I'm guessing if you click on that unit, he won't talk anymore, cause he'll be out of the unit group.
01-11-2003, 02:32 PM#8
Guest
Pardon my ignorance, but what do u mean by: "smart click"?

Anyways, if u just check for the unit type and the location the unit is in, then it wont matter if any units died, etc... I suggest you use Aiursrage2k's idea too, itd make it much cooler and make ur world seem more life like.

Something like this:

Events:
Player - Player 1 (red) selects a unit

Conditions:
((Unit-type of (triggering unit)) Equal to Villager) and ((village <gen> contains (triggering unit)) equal to true)

Actions:
Cinematic - Send transmission ..... etc etc
01-11-2003, 03:06 PM#9
ChronOmega
by the way "smart" click means right click
to do this go

E: unit is ordered targeting a point/object im not sure

C:order= order "smart"

A: blahblah
01-11-2003, 05:09 PM#10
MrDoomMaster
To do this, you will need two triggers for EACH villager. So if you have 10 villagers, you'll need 20 triggers. Below i have shown you an example of what the two triggers would look like for each villager.

First off, you need to create a one-time initialization trigger to set your variable arrays. Below is an example of this:

Events:
Map Initialization

Conditions:
-null-

Actions:
------Set Unit Array------
Set Villager[1]=Peon 0001
Set Villager[2]=Peon 0002
(repeat this for the rest of the villagers)
------Set Villager 1 String Array------
Set Villager1Trans[1]="Hi!"
Set Villager1Trans[2]="The bad guys went this way."
(Add as many strings to this array that you want, these will be the randomized transmissions for the first villager)

Be sure to create one separate String Array for EACH villager you have. This is required if you want to give them randomized transmissions.


Secondly, begins the triggers to make the first villager do what you want. The following trigger is the trigger that will be used for when the villager dies:

Trigger: Villager 1 Death

Events:
Unit owned by Player X Dies

Conditions:
(Dying Unit) equal to Villager[1]

Actions:
Wait (however long you want to wait before the villager is reanimated)
Create 1 Peon at (position of(dying unit -OR- Villager[1])) facing default building facing degrees
Set Villager[1]=Last Created Unit


that was a simple trigger to detect revivals of the villagers after they die. Keep in mind, i didn't have my world editor open for this so im sorry if some functions aren't perfect... this is just so you may grasp an understanding of how to do this. Below is the trigger for Villager 1 that will be used to initialize his random transmissions when you give him orders (note, im not sure what you mean't by 'smart' click, so i've set this trigger to work with any given order):


Trigger: Villager 1 Transmission


Events:
Unit is given order targetting point
Unit is given order targetting object

Conditions:
(add as many as you require here)

Actions:
Cinematic - send transmission to (all players) from Villager[1] named (name here) : play (sound) and display Villager1Trans[random(min,max)]

This is basically it. I wish there was an easier way to do it but there isn't. I hope my method is appealing to you, for this is pretty much the most efficient way. Good luck!
01-12-2003, 01:08 AM#11
SilentSpyder
Sorry but what I want isn't random transmission per villager. I want each villager to have one transmisson. I could do it by making a trigger for each villager like you said, but that's too much. Basically I want to make a whole mess of transmsissions, and have a trigger that automatically assigns one transmission to one villager, then another onto the next, and next, till each villager has it's own transmission.

Anyway, I think I'm a step closer, by doing something like what was mentioned in this post, about unit groups. I'm still working on it.
01-12-2003, 01:25 AM#12
Guest
Basically it seems like you'll just need to make 1 trigger for each villager. It seems tedious, but you'd need to make all the strings anyway.
01-12-2003, 02:35 AM#13
Guest
You could try using arrays and unit groups and not have too many triggers.

(Villager1 - Villager20 refers to the initially placed units on the map)
VillagerPlayer is the player that owns the villagers


Villagers is a unit array
VillagersGroup is a unit group

TransmissionSpeaker is a String Array
TransmissionMessage is a String Array
TransmissionSound is a Sound Array
TransmissionDuration is an Integer Array

tempIntegerVar is an integer variable
---------
Trigger: Setup villagers talking
Event: During Map Initialization
Conditions: None
Actions:
Set villagers[1] = Villager1
Set villagers[2] = Villager2
...
Set villagers[20] = Villager20
for integer each integer b 1 to 20 add villagers[Integer B] to VillagersGroup

Set TransmissionSpeaker[1] = "Bob"
...
Set TransmissionSpeaker[20] = "Joe"

Set TransmissionMessage[1] = "And then the orcs ate my pigs!"
...
Set TransmissionMessage[20] = "Three elves and a dwarf walk into a tavern..."

Set TransmissionSound[1] = Foo.wav
...
Set TransmissionSound[20] = Bar.wav

Set TransmissionDuration[1] = 10
...
Set TransmissionDuration[20] = 30
-------
Trigger: Determine Triggering Unit
Event: None
Conditions: None
Actions:
For integer b 1 to 20 if triggering unit is equal to villagers[integer b] then set tempIntegerVar = integer b else do nothing
---------
Trigger: A Unit Speaks
Event: Player1 selects a unit
Player2 selects a unit
...
Conditions:
Triggering unit is in VillagersGroup
Actions:
Run Determine Triggering Unit ignoring conditions
Send Transmission to All Players from villagers[tempIntegerVar] named TransmissionSpeaker[tempIntegerVar] with message TransmissionMessage[tempIntegerVar] playing sound TransmissionSound[tempIntegerVar] for TransmissionDuration[tempIntegerVar] and don't wait
---------
Trigger: A Speaking Unit Dies
Event: A unit owned by VillagerPlayer dies
Conditions: Triggering unit is in VillagersGroup
Actions:
Run Determine Triggering Unit ignoring conditions
Remove Triggering Unit from VillagersGroup
Create 1 Villager at Whatever region
Set Villagers[tempIntegerVar] = Last Created Unit
Add Villagers[tempIntegerVar] to VillagersGroup
01-12-2003, 02:56 AM#14
MrDoomMaster
First of all, sorry for misunderstanding. Now im fully clear on what you want. There is a need for only a few minor changes to the first and third triggers of my post. I'll list them below.

If you remember correctly, the first trigger i listed in my previous post required that it be started on Map Initialization and that it set various arrays. The only thing that changes is that you only need ONE string array instead of one per villager. The trigger structure will be as follows:

Events:
Map Initialization

Conditions:
-null-

Actions:
------Set Unit Array------
Set Villager[1]=Peon 0001
Set Villager[2]=Peon 0002
(repeat this for the rest of the villagers)
------Set Villager 1 String Array------
Set VillagerTrans[1]="My name is Peon 1"
Set VillagerTrans[2]="My name is Peon 2"
(This time each index will represent the unit that the string applies to. So continue adding strings to this array until you have enough for every villager.)

Next i'll show you a fixed version of the third trigger that will better suit your needs:


Trigger: Villager 1 Transmission

Events:
Unit is given order targetting point
Unit is given order targetting object

Conditions:
Unit Comparison - Ordered unit equal to Villager[1]

Actions:
Cinematic - send transmission to (all players) from Villager[1] named (name here) : play (sound) and display VillagerTrans[1]


Now that i think about it, there is a complicated exception to the '2 triggers per villager' rule i made. It involves only using one trigger with several if/then/else functions to display every villager's transmission. The contents are as follows:

Events:
Unit is given order targetting point
Unit is given order targetting object

Conditions:
-NONE!-

Actions:
if (unit comparison - Ordered unit equal to Villager[1]) then do (Cinematic - send transmission to (all players) from Villager[1] named (name here) : play (sound) and display VillagerTrans[1]) else do (nothing)

(you must repeat this function for EACH villager)

I got into thinking more deeply into this issue and found out that StarScrap was indeed correct. I was absolutely wrong and would like to appologize about saying that 2 triggers for each villager was required. Using 1 trigger to set your variable arrays, 1 trigger to assign villager transmissions, and 1 trigger PER villager to revive them after being killed is all you need. I am absolutely sure that the easiest way to revive your villagers is to give them each a trigger to do so. There are far too many functions needed to revive the villagers and sticking all of those functions for each villager in ONE trigger can be absolutely messy. I hope that NOW you may have found a suitable solution to this issue.