HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Question on unit and unit group moving

07-26-2004, 08:46 PM#1
DisabledJew
Ok, I have a trigger that when the random number is reached it moves the party to battle (It's a turn based battle system)

So I have 3 different regions, each for the placement of each unit, so when Variable Steps is reached - It should transport each unit in my party to their specific regions, which would be easy, but it has interchangable party members, of course there is only 1 unit heading the party which is my main character.

So I figured it had something to do with unit and unit group variables.

Make a variable for each unit, when you choose to change party, I remove the variable of the unit removed from the unit group and add the unit that was added to the party. I guess this is fairly easy too.

the problem I have is how do I make it so each unit in the party is transported to seperate regions on the battle field, or is there a better way to do this?

Heres the triggers:

Talk1
Events
Unit - A unit enters WildMonsterzone1 <gen>
Conditions
Actions
Trigger - Turn on Region1Battle <gen>

Region1Battle
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
Set Steps = (Steps + 1)
If (Steps Equal to (Random integer number between 12 and 26)) then do (Unit - Move (Triggering unit) instantly to (Center of Party1 <gen>), facing 90.00 degrees) else do (Do nothing)

Party1 <gen> is the first region for the party in the battlefield, there is also party2 and party3.

If anyone knows how I might do this, please help. Rep points up for grab :D
07-26-2004, 09:18 PM#2
Anitarf
First of all, you can't move the triggering unit, because there is no triggering unit. Now, if you have your party stored in a unit variable array, the move trigger would look something like this:
Code:
If - Then - Else multiple functions
  If -conditions:
    (Steps Equal to (Random integer number between 12 and 26))
  Then - Actions:
    Unit - Move (HeroesInParty[1]) instantly to (Center of Party1 <gen>), facing 90.00 degrees
    Unit - Move (HeroesInParty[2]) instantly to (Center of Party2 <gen>), facing 90.00 degrees
    Unit - Move (HeroesInParty[3]) instantly to (Center of Party3 <gen>), facing 90.00 degrees
  Else - actions:
    Do nothing

An the way this is set up, you only have a 64.566% chance to be taken to the battle place, ever. Then, the Steps variable goes above 26 and you can never have an encounter again. To fix this, you need to do the following:

Code:
Talk1
Events
  Unit - A unit enters WildMonsterzone1 <gen>
Conditions
Actions
  Set Steps = 1
  Set StepsRequired = Random integer number between 12 and 26
  Trigger - Turn on Region1Battle <gen>
Code:
If - Then - Else multiple functions
  If -conditions:
    (Steps Equal to StepsRequired)
  Then - Actions:
    .....
07-26-2004, 10:02 PM#3
DisabledJew
Quote:
Originally Posted by Anitarf
First of all, you can't move the triggering unit, because there is no triggering unit. Now, if you have your party stored in a unit variable array, the move trigger would look something like this:
Code:
If - Then - Else multiple functions
  If -conditions:
    (Steps Equal to (Random integer number between 12 and 26))
  Then - Actions:
    Unit - Move (HeroesInParty[1]) instantly to (Center of Party1 <gen>), facing 90.00 degrees
    Unit - Move (HeroesInParty[2]) instantly to (Center of Party2 <gen>), facing 90.00 degrees
    Unit - Move (HeroesInParty[3]) instantly to (Center of Party3 <gen>), facing 90.00 degrees
  Else - actions:
    Do nothing


An the way this is set up, you only have a 64.566% chance to be taken to the battle place, ever. Then, the Steps variable goes above 26 and you can never have an encounter again. To fix this, you need to do the following:

Code:
Talk1
Events
  Unit - A unit enters WildMonsterzone1 <gen>
Conditions
Actions
  Set Steps = 1
  Set StepsRequired = Random integer number between 12 and 26
  Trigger - Turn on Region1Battle <gen>
Code:
If - Then - Else multiple functions
  If -conditions:
    (Steps Equal to StepsRequired)
  Then - Actions:
    .....


Ahhhh I see, I didn't set a reset trigger for steps to put it back to 0, if after every battle I set the value of steps back to 0 would it work? or do I have to create a steps required, I would just use stepsrequired but I'm worried about the fact that it would be the same number every time since it does it once, so I prefer just a reset.

Ok, I'm kinda getting your code, but if you could explain the variables you use, what type they are, value, and all that stuff cause I don't quite understand it fully.
Thanks for the feedback though it should help.

EDIT: Ok, I just read a little more in detail oinstead of just skimming :D, and when I said triggering unit I just put that because I didn't know what to use.

You store my party in a unit variable array, so I'd create a Unit variable called HeroinParty1 and make it an array, and create 2 and 3 also, when I add a character to my party, do I change the character I'm adding to Heroinparty2 and remove the already existing hero in slot 2.

If you could give me a quick trigger set for how to do this, I would be most pleased ^_^ I have a rough idea on how, but just in case. I'll give you four names for characters so you can be more in detail

Ordin - Main character, Cannot be removed from party (meaning don't worry about the in and out of party triggers)
Baelnorn
Konoha
Nehima

If you can make the triggers using those names or commenting using them, it would be extremely helpful.

Thanks
07-27-2004, 06:18 AM#4
Anitarf
An array is a variable that stores multiple values. That means you need only one variable for your unit group (and not HeroinParty1, HeroinParty2...), just HeroinParty[].

Then, at map initialization, you would set Ordin to the variable in the first spot (HeroinParty[1]). I don't know how you mean to make the adding/switching of other heroes, so I can't give you exact triggers, but basicaly you just check which unit is being replaced and set the part of the array where that unit is in (either HeroinParty[2], or [3], because you can't swap the main character) to the new unit (you don't need to "remove" the previous unit from the variable, because the new one will just override it if you save it in the same place).


You need the random number in a variable! If you don't have it, then the game picks a new random number each time it checks the steps, so each time, you have a 13/14 chance to not have an encounter; the chance that you don't have an encounter untill the Steps goes above 26 is approximately 35.433531%.
But don't worry, that doesn't mean you will have the same time untill an encounter every time; whenever reseting steps after combat, pick a new random StepsRequired too and you're set.
07-27-2004, 08:46 PM#5
DisabledJew
Yes thanks, figured it all out and it's working. I got it before you reply, but thanks for the first steps which got me there, thanks a bunch. Already gave you rep point.