HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Sleeping Gas

11-01-2003, 07:59 PM#1
YellowSubmarine
Okay, I'm making a trigger-based spell called sleeping gas. It's based off of Silence. The intent is that it's cast on an area, and units within the area fall asleep. The AoE increases by 25 per level, and the max units affected by 1.5 per level. The triggers are built in such a way that a random unit is selected, put to sleep, and a variable is deducted; the process is repeated until the variable is exhausted, having hit the max number of units. Right now I'm just having trouble getting even one unit to sleep. What's wrong with this code?

Learning Trigger:
E: A unit learns a skill
C: Learned skill equal to Neutral Dark Ranger - Silence
A: Set SleepingGasLearn = SleepingLearn + 1

Point Trigger:
E: A unit is issued an order targeting a point
C: Issued order equal to Neutral Dark Ranger - Silence
A: Set SleepingGasPoint = Target point of issued order

Function Trigger:
E: Unit - A unit Begins casting an ability
C: (Ability being cast) Equal to Sleeping Gas (Ranger)
A: Actions
Unit Group - Pick every unit in (Units within ((SleepingGas x 25.00) + 150.00) of SleepingGasPoint) and do (Actions)
Loop - Actions
Set SleepingGasMax = ((SleepingGasLearn x 1.50) + 0.50)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
SleepingGasMax Greater than or equal to 1.00
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
SleepingGasLearn Less than 4.00
SleepingGasLearn Greater than or equal to 1.00
Then - Actions
Unit Group - Pick every unit in (Units within ((SleepingGasLearn x 25.00) + 150.00) of SleepingGasPoint) and do (Unit Group - Add (Picked unit) to SleepingGasUnitGroup)
Set SleepingGasSleeper = (Random unit from SleepingGasUnitGroup)
Unit - Add Smoke Sleep (Level 1) to SleepingGasSleeper
Unit - Order SleepingGasSleeper to Undead Dreadlord - Sleep SleepingGasSleeper
Else - Actions
Do nothing
Else - Actions
Do nothing

Function trigger edited with Copy As Text.
11-01-2003, 08:22 PM#2
drezman
because u set if for silence, if its not the exact spell it wont work
11-01-2003, 08:38 PM#3
Vexorian
You better use the Copy As text feature and then that [#] button.

I can see you copied the trigger in a wrong way since SleepingLearn seems to be both an integer and a point variable?
11-01-2003, 09:01 PM#4
YellowSubmarine
I didn't know that existed. How handy!
11-01-2003, 09:16 PM#5
Tiki
use the cloud ability as the spell..

and everyone caught in the aoe cast sleep on them.
11-01-2003, 09:46 PM#6
YellowSubmarine
...what?

First of all, Cloud is channeling, something I don't want, and there's no reason to use it above Cloud. And how is using a different spell going to fix my code?
11-02-2003, 09:59 AM#7
ObsidianTitan
You can clean that up alot, you dont need the variables sleepinggasssleeper or sleepinggassunit group. Have it so it picks all units in the range and if condition works out cast on picked unit.

Something that may be your problem is there is no initial value of sleepinggas, or you didnt give it to us.
11-02-2003, 03:58 PM#8
YellowSubmarine
Well, the point was to convert the picked units into a unit group so from there I could make it select a random unit from the picked units and then have that random unit put itself to sleep with the spell. If I simply used picked unit for both learn and cast, it would put all the units to sleep, and I wouldn't be able to incorporate a max number of affected units.
11-03-2003, 01:43 AM#9
ObsidianTitan
That might be true, but i think doing it my way affects it in the same way.

Did you check that you have an initial value for sleeping gas?
I seriously think this might be your problem.
Make a check to make sure, just make a text message tell you what the value is to make sure.
11-03-2003, 01:55 AM#10
SpectreReturns
Quote:
Originally posted by Pascal314
Unless you are actually replacing the Dark Ranger's Silence, you will have to convert this trigger to text; then you will have to replace the four digit silence code with your custom spell's four digit code.

To find your custom spell's four digit code, you must check "view raw data" in the "view" options at the object editor window, while you are in the abilities tab.

Another note: make sure SleepingLearn is initially 0.


Accually no you dont. It works, as long as hes using the silence tag in his spell.
11-03-2003, 03:37 AM#11
YellowSubmarine
SpectreReturns is correct. I've done so on other trigger based spells which worked.

SleepingGas and SleepingGasLearn are the same variable. The code is weird and the code I manually typed used a different name for it. Its initial value is 0.
11-03-2003, 04:11 AM#12
Grater
I have a hunch it's something to do with the hidden caster unit being unable to cast sleep fast enough, you either need to add a small wait between casts (and set the casters cast point/backswing to 0) or create a new hidden caster for every unit.
Code:
Unit Group - Pick every unit in (Units within 512.00 of (Position of (Triggering unit)) matching (True Equal to True)) and do (Actions)
    Loop - Actions
        Unit - Create 1 Flying Sheep for Player 1 (Red) at (Position of (Picked unit)) facing Default building facing degrees
        Unit - Hide (Last created unit)
        Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
        Unit - Order (Last created unit) to Undead Dreadlord - Sleep (Picked unit)
Thats how I do it (ignore most the specifics, like obviously your hidden caster wont be a flying sheep)
11-03-2003, 04:15 AM#13
YellowSubmarine
The thing is, there's no hidden caster at all-- the unit itself learns the skill and puts itself to sleep and unlearns the skill. And I've not actually taught it to loop casting yet, but only have made this trigger to accomodate the self-sleep of one unit.
11-03-2003, 04:26 AM#14
ObsidianTitan
Did you make sure to change the targets allowed by sleep?
11-03-2003, 04:40 AM#15
Grater
Quote:
Originally posted by YellowSubmarine
The thing is, there's no hidden caster at all-- the unit itself learns the skill and puts itself to sleep and unlearns the skill. And I've not actually taught it to loop casting yet, but only have made this trigger to accomodate the self-sleep of one unit.


Ahhh thanks for explaining that. As long as the targets allowed include "self" and the mana cost is 0 that SHOULD work. However it's a screwy way to do it, and if you remove the sleep ability before it's cast it wont work. That means leaving it for atleast 0.5 seconds, maybe more, because many units cast animation takes that long.

I short I reccomend using hidden casters. (it'll also look less weird and prevent the target player quickly giving their units an order that causes the sleep cast to cancel...