- Joined
- Aug 1, 2010
- Messages
- 1,746
Hey everyone!
I'm making a really simple "Village chatter" system for RPGs that basically does the following:
When you select a friendly unit of a designated type, they face your hero, say one of their generic "Hello there!" speeches both with a sound file and floating text, then face wherever they were facing before. The responses are randomized.
Now, before you say it, I know there are tons of leaks here. However, I don't know the right commands to null all of my different variables to avoid said leaks. All tutorials say that I need to use custom scripts, but then only give scripts for one of two types of variables.
I currently use two real variables, one integer, and two arrays of sound and string variables. My first question would be, what are all the custom scripts required to null them so they don't leak.
My second question is about the section where I set all the sound and string variable arrays, should I put them into a separate trigger that only runs once on initialization or is it okay to set them each time the trigger runs, and would they leak without nulling, even though the values stay the same?
And my third question is, I've selected the player-controlled hero just by specifying unit, and I'm 99% sure that is the wrong way to go (since he might die/revive/get replaced by rpg triggers and whatnot). Is that okay or should I put him in his own variable?
My final question is, would such a simple system be useful if I posted it in the spells section and would it get approved if I fixed all the leaks and other bugs there might be?
Thanks for your time!
Sincerely, a complete GUI noob.
I'm making a really simple "Village chatter" system for RPGs that basically does the following:
When you select a friendly unit of a designated type, they face your hero, say one of their generic "Hello there!" speeches both with a sound file and floating text, then face wherever they were facing before. The responses are randomized.
-
Villager Male
-
Events
-
Player - Player 1 (Red) Selects a unit
-
-
Conditions
-
(Unit-type of (Triggering unit)) Equal to Villager (Male)
-
(Owner of (Triggering unit)) Equal to Player 5 (Yellow)
-
-
Actions
-
Set Distance = (Distance between (Position of Admiral Proudmoore 0007 <gen>) and (Position of (Triggering unit)))
-
If (Distance Greater than or equal to 500.00) then do (Skip remaining actions) else do (Do nothing)
-
Trigger - Turn off (This trigger)
-
Set RNG = (Random integer number between 1 and 3)
-
Set VillagerMale_Sound[1] = VillagerM1 <gen>
-
Set VillagerMale_Sound[2] = VillagerM2 <gen>
-
Set VillagerMale_Sound[3] = VillagerM3 <gen>
-
Set VillagerMale_String[1] = Greetings, friend.
-
Set VillagerMale_String[2] = Welcome to our village.
-
Set VillagerMale_String[3] = Hello there!
-
Animation - Lock (Triggering unit)'s Head to face Admiral Proudmoore 0007 <gen>, offset by (0.00, 0.00, 90.00)
-
Set Facing = (Facing of (Triggering unit))
-
Unit - Make (Triggering unit) face Admiral Proudmoore 0007 <gen> over 0.50 seconds
-
Sound - Play VillagerMale_Sound[RNG] at 100.00% volume, attached to (Triggering unit)
-
Floating Text - Create floating text that reads VillagerMale_String[RNG] above (Triggering unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
-
Floating Text - Change (Last created floating text): Disable permanence
-
Floating Text - Set the velocity of (Last created floating text) to 25.00 towards 90.00 degrees
-
Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
-
Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds
-
Wait 1.00 seconds
-
Unit - Make (Triggering unit) face Facing over 0.00 seconds
-
Animation - Reset (Triggering unit)'s body-part facing
-
Floating Text - Destroy (Last created floating text)
-
Wait 0.50 seconds
-
Trigger - Turn on (This trigger)
-
-
I currently use two real variables, one integer, and two arrays of sound and string variables. My first question would be, what are all the custom scripts required to null them so they don't leak.
My second question is about the section where I set all the sound and string variable arrays, should I put them into a separate trigger that only runs once on initialization or is it okay to set them each time the trigger runs, and would they leak without nulling, even though the values stay the same?
And my third question is, I've selected the player-controlled hero just by specifying unit, and I'm 99% sure that is the wrong way to go (since he might die/revive/get replaced by rpg triggers and whatnot). Is that okay or should I put him in his own variable?
My final question is, would such a simple system be useful if I posted it in the spells section and would it get approved if I fixed all the leaks and other bugs there might be?
Thanks for your time!
Sincerely, a complete GUI noob.