- Joined
- Apr 23, 2010
- Messages
- 11
Hello!
I'm new to this site but I was thinking I would make a tutorial of the system I'm currently working on for Role Playing Games (RPG's).
It's probably one of the few more complicated ones.
The only problem is the attack function. It doesn't work because of the movement. Though, I'm sure a skilled triggerer could bypass that limitation with a little work and effort.
First of all I'm going through the cameras. Then the movement and the last thing will be additions (sounds).
Cameras
Variables needed:
Angle - Real
Animation Speed (For Animations) - Real
Speed (For movement speed of the unit.) - Real
Unit [Or any other name] - Unit
The "Angle" variable is for the angle of the camera.
"Animation Speed" is for the speed of the animation the unit is performing.
"Speed" is of course for the movement speed of the target unit.
"Unit" is of course for the unit of the aim.
This first Trigger called "Initialization" is for the initialization of the camera at the start of the game. It's quite simple really.
Next part is the "Camera" Trigger.
Variables:
Location [Array; Size 3] - Point Array
Heigth - Real
The "Location" Variable is for the location of the unit in aim.
The "Heigth" Variable is for use in a custom script (I'll get to that later.)
I'm not sure if the heigth trigger is needed now because I'm not the best in custom scripts but I'd suggest making it now.
Here come the trigger. Two Custom Script actions are used in this trigger:
This part is used to set the heigth of the camera. The other actions are found in the "Camera" sections in "Actions".
P.S The Camera Settings such as Angle Of Attack and Distance To Target can be changed to whatever you desire. I use Second Person camera though.
Movement
Now these first parts have been easy but now come the tricky parts. Time for the movement.
Variables needed:
UpTrue - Boolean
DownTrue - Boolean
LeftTrue - Boolean
RightTrue - Boolean
Now we create the exact same thing with all the arrow keys (Boolean Variables we've just created.)
When we're done with that we'll create the animation triggers.
I'll fill in all the animation triggers just for the cause:
Example:
Because it is difficult to match the time scale perfectly. The problem here is that if you stand and keep pushing the hotkey or using a spell manually you will kill anything within seconds. That is not good. That's why this is hard to match with the time scale.
Now comes the last step (almost except for additions such as sounds.); Moving and Turning.
The first one is like this:
Angle is the angle the unit is directing towards.
Next piece:
Next Piece:
AnimationSpeed is needed to determine the speed of the animation which in this case is Index 6.
That's forward movement.
In this next part we'll be moving to the left. What's good about this system is that it will allow you to move in any angle from 0-360 Degrees by ones. Most system go 90 degrees from each step. This one does not. It goes manually in any angle!
Anyway here is left moving:
Right moving is almost the same:
For right nor left we will never be using any animations besides the Index 1 (Stand) animation. When moving forward we will be using Index 6 Animation, (Run) and for Down arrow key we'll be using the animation Index 1 (Stand).
I haven't made a trigger for death animation yet but I will soon.
Back to these ones. As we move forward we will not just do it in the UpTrue Trigger. We will make it in a separate trigger. The thing with these ones and the reason I'm going back to this subject is that they will be Initially Off at Map Initialization, and later activated once we press up or down key. I haven't covered down key yet but I will get to that soon.
Anyway when we activate the animation triggers we go into the: UpPress trigger:
Sounds
A really nice effect to add for a more reality kind of a feeling is to add movement sounds. I would use the Hero Movement Sounds 1 and 3 but 2,4, and the step <gen> works aswell.
Thank You
About the attack-problems:
The problems with this function is the only real issue with the system. If anyone is interested in taking a look at my trigger for it then here it is. Sadly it doesn't work and it uses a spell for attack. I was thinking that maybe someone better than me at this kind of triggers would have use for it.
/Rasmus
I'm new to this site but I was thinking I would make a tutorial of the system I'm currently working on for Role Playing Games (RPG's).
It's probably one of the few more complicated ones.
The only problem is the attack function. It doesn't work because of the movement. Though, I'm sure a skilled triggerer could bypass that limitation with a little work and effort.
First of all I'm going through the cameras. Then the movement and the last thing will be additions (sounds).
Cameras
Variables needed:
Angle - Real
Animation Speed (For Animations) - Real
Speed (For movement speed of the unit.) - Real
Unit [Or any other name] - Unit
The "Angle" variable is for the angle of the camera.
"Animation Speed" is for the speed of the animation the unit is performing.
"Speed" is of course for the movement speed of the target unit.
"Unit" is of course for the unit of the aim.
This first Trigger called "Initialization" is for the initialization of the camera at the start of the game. It's quite simple really.
-
Initialization
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Set Angle = 0.00
-
Set AnimationSpeed = 0.00
-
Set Speed = 0.00
-
Set Unit = Your selected unit.
-
-
Next part is the "Camera" Trigger.
Variables:
Location [Array; Size 3] - Point Array
Heigth - Real
The "Location" Variable is for the location of the unit in aim.
The "Heigth" Variable is for use in a custom script (I'll get to that later.)
I'm not sure if the heigth trigger is needed now because I'm not the best in custom scripts but I'd suggest making it now.
Here come the trigger. Two Custom Script actions are used in this trigger:
-
Camera
-
Events
-
Time - Every 0.01 seconds of game time
-
-
Conditions
-
CameraSwitch Equal to False
-
-
Actions
-
Set Location[3] = (Position of Unit)
-
Custom script: set udg_Height=GetLocationZ(udg_Location[3])
-
Camera - Lock camera target for Player 1 (Red) to Footman 0001 <gen>, offset by (0.00, 0.00) using Default rotation
-
Camera - Set Player 1 (Red)'s camera Distance to target to 170.00 over 0.10 seconds
-
Camera - Set Player 1 (Red)'s camera Angle of attack to 345.00 over 0.01 seconds
-
Camera - Set Player 1 (Red)'s camera Field of view to 1000.00 over 0.01 seconds
-
Camera - Set Player 1 (Red)'s camera Height Offset to (Height + 100.00) over 0.10 seconds
-
Camera - Set Player 1 (Red)'s camera Rotation to (Facing of Footman 0001 <gen>) over 0.10 seconds
-
Custom script: call RemoveLocation(udg_Location[3])
-
-
-
Custom script: set udg_Height=GetLocationZ(udg_Location[3])
Distance: This is the distance to the target you want to have a camera attached to. Lower numbers: Smaller Distance.
Angle of Attack: This is the upwards or downwards angle of the camera. If you move the camera to lesser angles then it will go closer to the ground and if you want to move it further up, type a higher number. The highest amount functioning would obviously be 360* as with any other angle.
Height: This is the height of the camera, further up or lower to the ground. This one must be executed based on where the camera shall be positioned as to in the units field of view, higher than the units field of view or lower than the units field of view.
Field Of View: This is a zoom function. If you want to see units closer or further away then this is the setting to change.
Rotation: This changes the angle your camera is constantly redirected to while using the custom camera values. (Facing of Footman 0001) for an example will change the rotation value to the facing of the unit which sight you want to recreate.
This part is used to set the heigth of the camera. The other actions are found in the "Camera" sections in "Actions".
P.S The Camera Settings such as Angle Of Attack and Distance To Target can be changed to whatever you desire. I use Second Person camera though.
Movement
Now these first parts have been easy but now come the tricky parts. Time for the movement.
Variables needed:
UpTrue - Boolean
DownTrue - Boolean
LeftTrue - Boolean
RightTrue - Boolean
-
Up Press
-
Events
-
Player - Owner of unit:(Unit) Presses the Up Arrow key
-
-
Conditions
-
Actions
-
Set UpTrue = True
-
-
-
Up Release
-
Events
-
Player - Owner of unit:(Unit) Releases the Up Arrow key
-
-
Conditions
-
Actions
-
Set UpTrue = False
-
-
Now we create the exact same thing with all the arrow keys (Boolean Variables we've just created.)
When we're done with that we'll create the animation triggers.
-
AnimationRun
-
Events
-
Time - Every 0.50 seconds of game time
-
-
Conditions
-
Actions
-
Custom script: call SetUnitAnimationByIndex(udg_Unit, 6)
-
Custom script: call SetUnitTimeScale(udg_Unit, udg_AnimationSpeed)
-
-
-
AnimationRun
-
Actions
-
Custom script: call SetUnitAnimationByIndex(udg_Unit, 6)
-
-
-
AnimationRun
-
Actions
-
Custom script: call SetUnitTimeScale(udg_Unit, udg_AnimationSpeed)
-
-
I'll fill in all the animation triggers just for the cause:
-
AnimationStand
-
AnimationStand
-
Events
-
Time - Every 1 Seconds of Game Time
-
Conditions
-
-
Actions
-
Custom script: call SetUnitAnimationByIndex(udg_Unit, 1)
-
Custom script: call SetUnitTimeScale(udg_Unit, udg_AnimationSpeed)
-
-
Example:
-
AnimationStand
-
Events
-
Time - Every 10000000.00 seconds of game time
-
Time - AnimationStandTimer expires
-
-
Conditions
-
Actions
-
Custom script: call SetUnitAnimationByIndex(udg_Unit, 1)
-
Custom script: call SetUnitTimeScale(udg_Unit, udg_AnimationSpeed)
-
-
-
AnimationAttack
-
Events
-
Time - Every 3.00 seconds of game time
-
-
Conditions
-
Actions
-
Custom script: call SetUnitAnimationByIndex(udg_Unit, 5)
-
Custom script: call SetUnitTimeScale(udg_Unit, udg_AnimationSpeed)
-
Trigger - Turn off AnimationRun <gen>
-
Trigger - Turn off AnimationStand <gen>
-
-
Because it is difficult to match the time scale perfectly. The problem here is that if you stand and keep pushing the hotkey or using a spell manually you will kill anything within seconds. That is not good. That's why this is hard to match with the time scale.
Now comes the last step (almost except for additions such as sounds.); Moving and Turning.
The first one is like this:
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
UpTrue Equal to True
-
-
Then - Actions
-
Set Location[2] = ((Position of Unit) offset by Speed towards Angle degrees)
-
Unit - Move Unit instantly to Location[2]
-
Custom script: call RemoveLocation(udg_Location[2])
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Speed Less than 1.00
-
-
Then - Actions
-
Set Speed = (Speed + 0.02)
-
Set AnimationSpeed = (Speed + 0.02)
-
-
Else - Actions
-
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
UpTrue Equal to True
-
-
Then - Actions
-
Set Location[2] = ((Position of Unit) offset by Speed towards Angle degrees)
-
-
Angle is the angle the unit is directing towards.
Next piece:
-
Unit - Move Unit instantly to Location[2]
-
Custom script: call RemoveLocation(udg_Location[2])
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Next Piece:
-
If - Conditions
-
Speed Less than 1.00
-
Then - Actions
-
Set Speed = (Speed + 0.02)
-
Set AnimationSpeed = (Speed + 0.02)
-
-
Else - Actions
-
AnimationSpeed is needed to determine the speed of the animation which in this case is Index 6.
That's forward movement.
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
UpTrue Equal to False
-
-
Then - Actions
-
Set Location[2] = ((Position of Unit) offset by Speed towards Angle degrees)
-
Unit - Move Unit instantly to Location[2]
-
Custom script: call RemoveLocation(udg_Location[2])
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Speed Greater than 0.00
-
-
Then - Actions
-
Set Speed = (Speed - 0.02)
-
Set AnimationSpeed = (AnimationSpeed - 0.01)
-
-
Else - Actions
-
-
-
Else - Actions
-
In this next part we'll be moving to the left. What's good about this system is that it will allow you to move in any angle from 0-360 Degrees by ones. Most system go 90 degrees from each step. This one does not. It goes manually in any angle!
Anyway here is left moving:
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
LeftTrue Equal to True
-
-
Then - Actions
-
Set Angle = (Angle + 1.00)
-
Unit - Make Unit face Angle over 0.10 seconds
-
-
Else - Actions
-
Right moving is almost the same:
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
RightTrue Equal to True
-
-
Then - Actions
-
Set Angle = (Angle - 1.00)
-
Unit - Make Unit face Angle over 0.10 seconds
-
-
Else - Actions
-
For right nor left we will never be using any animations besides the Index 1 (Stand) animation. When moving forward we will be using Index 6 Animation, (Run) and for Down arrow key we'll be using the animation Index 1 (Stand).
I haven't made a trigger for death animation yet but I will soon.
-
AnimationRun
-
Events
-
Time - Every 0.50 seconds of game time
-
-
Conditions
-
Actions
-
Custom script: call SetUnitAnimationByIndex(udg_Unit, 6)
-
Custom script: call SetUnitTimeScale(udg_Unit, udg_AnimationSpeed)
-
-
Back to these ones. As we move forward we will not just do it in the UpTrue Trigger. We will make it in a separate trigger. The thing with these ones and the reason I'm going back to this subject is that they will be Initially Off at Map Initialization, and later activated once we press up or down key. I haven't covered down key yet but I will get to that soon.
Anyway when we activate the animation triggers we go into the: UpPress trigger:
-
Up Press
-
Events
-
Player - Owner us unit <Unit> Presses the Up Arrow key
-
-
Conditions
-
Actions
-
Set UpTrue = True
-
Trigger - Turn on AnimationRun <gen>
-
Trigger - Turn off AnimationStand <gen>
-
-
-
Down Press
-
Events
-
Player - Owner of unit <Unit> Presses the Down Arrow key
-
-
Conditions
-
Actions
-
Set DownTrue = True
-
Trigger - Turn off AnimationRun <gen>
-
Trigger - Turn on AnimationStand <gen>
-
-
Sounds
A really nice effect to add for a more reality kind of a feeling is to add movement sounds. I would use the Hero Movement Sounds 1 and 3 but 2,4, and the step <gen> works aswell.
-
StepSound
-
Events
-
Time - Every 2.00 seconds of game time
-
Time - SoundInstantTimer expires
-
-
Conditions
-
SoundOkay Equal to True
-
-
Actions
-
Sound - Play Step001[1] at 100.00% volume, attached to <Unit>
-
Wait 0.50 seconds
-
Sound - Play Step001[3] at 100.00% volume, attached to <Unit>
-
Wait 0.50 seconds
-
Sound - Play Step001[3] at 100.00% volume, attached to <Unit>
-
Wait 0.50 seconds
-
Sound - Play Step001[1] at 100.00% volume, attached to <Unit>
-
Wait 0.50 seconds
-
-
-
Up Press
-
Events
-
Player - Player 1 (Red) Presses the Up Arrow key
-
-
Conditions
-
Actions
-
Set UpTrue = True
-
Set SoundOkay = True
-
Trigger - Turn on AnimationRun <gen>
-
Trigger - Turn off AnimationStand <gen>
-
Trigger - Turn on StepSound <gen>
-
Countdown Timer - Start SoundInstantTimer as a One-shot timer that will expire in 0.01 seconds
-
-
Thank You
About the attack-problems:
The problems with this function is the only real issue with the system. If anyone is interested in taking a look at my trigger for it then here it is. Sadly it doesn't work and it uses a spell for attack. I was thinking that maybe someone better than me at this kind of triggers would have use for it.
-
Attack
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Ability being cast) Equal to Attack (Neutral Hostile)
-
(Owner of (Triggering unit)) Equal to Player001[(Player number of (Owner of (Triggering unit)))]
-
-
Then - Actions
-
Set Creep001[(Player number of (Owner of (Casting unit)))] = (Target unit of ability being cast)
-
Selection - Select Creep001[(Player number of (Owner of (Casting unit)))] for Player001[(Player number of (Owner of (Casting unit)))]
-
Unit Group - Pick every unit in (Units currently selected by (Owner of (Casting unit))) and do (Actions)
-
Loop - Actions
-
Custom script: call SetUnitAnimationByIndex(udg_Unit, 5)
-
Custom script: call SetUnitTimeScale(udg_Unit, udg_AnimationSpeed)
-
Sound - Play MetalHeavySliceFlesh1 <gen> at 100.00% volume, attached to (Target unit of ability being cast)
-
Unit - Cause (Casting unit) to damage Creep001[(Player number of (Owner of (Casting unit)))], dealing 12.00 damage of attack type Normal and damage type Normal
-
Wait 0.20 seconds
-
Unit - Wake up Creep001[(Player number of (Owner of (Casting unit)))]
-
-
-
-
Else - Actions
-
-
-
/Rasmus
Attachments
Last edited: