| 07-09-2005, 05:32 PM | #1 |
I've been away from the WC3 scene for so long now that I've forgotten alot and well, I'm not sure on how to do this the best way so here goes; I'm making a "Set up camp" ability that will make the player sleep until he's regained his HP. When the ability is cast, a campfire and a tent is spawned by his side to represent, well, camp. They are removed if he's attacked. The above works. What I can't do is make the player actually fall asleep. My dummycaster doesn't do a thing (And he's visable). I'm not about to use Lord Vexorians spellcaster system just for this, so what's the next best thing? Thx beforehand, Dead-Inside |
| 07-09-2005, 05:49 PM | #2 |
null |
| 07-09-2005, 05:49 PM | #3 |
Well, if you want to just use a dummy, please post the trigger your using to cause the dummy to cast sleep. Otherwise you could make a trigger to create the effect you want. |
| 07-09-2005, 07:18 PM | #4 |
Yea I know, I just figured it was easier to cast sleep, which does what I want (Create the sleep effect, heal, wake up when healed). Oh, btw, I'm also not sure how to detect when the hero wakes up? Code:
Going to sleep
Events
Unit - A unit owned by Player 1 (Red) Begins casting an ability
Unit - A unit owned by Player 2 (Blue) Begins casting an ability
Unit - A unit owned by Player 3 (Teal) Begins casting an ability
Unit - A unit owned by Player 4 (Purple) Begins casting an ability
Unit - A unit owned by Player 5 (Yellow) Begins casting an ability
Unit - A unit owned by Player 6 (Orange) Begins casting an ability
Unit - A unit owned by Player 7 (Green) Begins casting an ability
Unit - A unit owned by Player 8 (Pink) Begins casting an ability
Unit - A unit owned by Player 9 (Gray) Begins casting an ability
Unit - A unit owned by Player 10 (Light Blue) Begins casting an ability
Unit - A unit owned by Player 11 (Dark Green) Begins casting an ability
Unit - A unit owned by Player 12 (Brown) Begins casting an ability
Conditions
Sleeping[(Player number of (Owner of (Casting unit)))] Equal to False
(Ability being cast) Equal to Set up camp
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in (Units in (Region centered at (Position of (Casting unit)) with size (700.00, 700.00)) matching (((Owner of (Matching unit)) is an enemy of (Owner of (Casting unit))) Equal to True))) Equal to 0
Then - Actions
Set Sleeping[(Player number of (Owner of (Casting unit)))] = True
Game - Display to (All players) the text: Step One worked
Unit - Create 1 The Tent you Sleep In for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by (10.00, 10.00)) facing Default building facing degrees
Set Tents[(Player number of (Owner of (Casting unit)))] = (Last created unit)
Unit - Create 1 The Tent you Sleep In for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by (-20.00, 5.00)) facing Default building facing degrees
Set Tents[((Player number of (Owner of (Casting unit))) + 12)] = (Last created unit)
Game - Display to (All players) the text: Stuff shoulda been ...
Unit - Create 1 TheSleepmaster for Neutral Hostile at ((Position of (Casting unit)) offset by (5.00, 5.00)) facing Default building facing degrees
Set Tents[((Player number of (Owner of (Casting unit))) + 24)] = (Last created unit)
Wait 0.50 game-time seconds
Unit - Order Tents[((Player number of (Owner of (Casting unit))) + 24)] to Undead Dreadlord - Sleep (Casting unit)
Game - Display to (All players) the text: Player should now b...
Wait 2.00 game-time seconds
Unit - Kill Tents[((Player number of (Owner of (Casting unit))) + 24)]
Trigger - Run Checking <gen> (checking conditions)
Else - Actions
Game - Display to (Player group((Owner of (Casting unit)))) the text: It's not safe to se...The triger that's being run (Called checking); Code:
Checking
Events
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Sleeping[Integer] Equal to True
Then - Actions
Trigger - Turn on Waking up if Attacked 1 <gen>
Else - Actions
Trigger - Turn off Waking up if Attacked 1 <gen>
Set Integer = (Integer + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Sleeping[Integer] Equal to True
Then - Actions
Trigger - Turn on Waking up if Attacked 2 <gen>
Else - Actions
Trigger - Turn off Waking up if Attacked 2 <gen>
Set Integer = (Integer + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Sleeping[Integer] Equal to True
Then - Actions
Trigger - Turn on Waking up if Attacked 3 <gen>
Else - Actions
Trigger - Turn off Waking up if Attacked 3 <gen>
Set Integer = (Integer + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Sleeping[Integer] Equal to True
Then - Actions
Trigger - Turn on Waking up if Attacked 4 <gen>
Else - Actions
Trigger - Turn off Waking up if Attacked 4 <gen>
Set Integer = (Integer + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Sleeping[Integer] Equal to True
Then - Actions
Trigger - Turn on Waking up if Attacked 5 <gen>
Else - Actions
Trigger - Turn off Waking up if Attacked 5 <gen>
Set Integer = (Integer + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Sleeping[Integer] Equal to True
Then - Actions
Trigger - Turn on Waking up if Attacked 6 <gen>
Else - Actions
Trigger - Turn off Waking up if Attacked 6 <gen>
Set Integer = (Integer + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Sleeping[Integer] Equal to True
Then - Actions
Trigger - Turn on Waking up if Attacked 7 <gen>
Else - Actions
Trigger - Turn off Waking up if Attacked 7 <gen>
Set Integer = (Integer + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Sleeping[Integer] Equal to True
Then - Actions
Trigger - Turn on Waking up if Attacked 8 <gen>
Else - Actions
Trigger - Turn off Waking up if Attacked 8 <gen>
Set Integer = (Integer + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Sleeping[Integer] Equal to True
Then - Actions
Trigger - Turn on Waking up if Attacked 9 <gen>
Else - Actions
Trigger - Turn off Waking up if Attacked 9 <gen>
Set Integer = (Integer + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Sleeping[Integer] Equal to True
Then - Actions
Trigger - Turn on Waking up if Attacked 10 <gen>
Else - Actions
Trigger - Turn off Waking up if Attacked 10 <gen>
Set Integer = (Integer + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Sleeping[Integer] Equal to True
Then - Actions
Trigger - Turn on Waking up if Attacked 11 <gen>
Else - Actions
Trigger - Turn off Waking up if Attacked 11 <gen>
Set Integer = (Integer + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Sleeping[Integer] Equal to True
Then - Actions
Trigger - Turn on Waking up if Attacked 12 <gen>
Else - Actions
Trigger - Turn off Waking up if Attacked 12 <gen>
Set Integer = 1The triggers they refer to are just for seperate players being attacked and removing tents when they are. I mean, otherwise they'd remain. Oh, I just come across an idea, I could just time the tent/campfire, no matter how long the hero sleeps. Just making sure that the hero doesn't wake up BEFORE they disapear. They got locust so they're not really affecting the game, if you're wondering. |
| 07-09-2005, 08:46 PM | #5 | |
Quote:
Tisk tisk, no waits. Instead at the beginning of the trigger set the casting unit to a variable, then refer to it for the rest of the trigger instead of casting unit. |
| 07-10-2005, 01:41 AM | #6 |
That has nothing to do with the problem. Edit: What ability is the best one to base a button-without-a-target ability on? |
| 07-10-2005, 02:24 AM | #7 |
I use stomp, it all depends on what you're trying to accomplish with it. |
| 07-10-2005, 03:55 AM | #8 |
you can make an ability based on regular sleep ability that requires targeting. then when you activate another ability (the one without target) you give the unit the sleep ability and MAKE the unit target itself with this sleep ability. now your unit will be sleeping. another thing you can do is pause the unit and add sleep special effect to his overhead and give like 10 hp every 2 seconds using wait action. this way is simpler, but |
| 07-10-2005, 10:17 AM | #9 |
make sure the dummy caster has enough initial mana to cast the spell,or change the mana cost of the sleep spell to nought. Also, channel is a good abilit to use, just change the orderstring, the viewable box under options and target to no target |
| 07-10-2005, 10:43 AM | #10 | |
Quote:
Anyway, for starters, you can use a single generic unit event rather than 12 player-owned unit events. Also, use "starts the effect of an ability" rather than "begins casting an ability", it's less bug prone. Cast event responses and waits don't mix. Either use triggering unit instead of casting unit, or don't use waits. You can effectively kill the dummy caster by giving it an expiration timer, instead of waiting and killing it. If you're going to leak memory, at least don't do it too much. Instead of checking for enemy units in "region centered at position of casting unit" (which leaks you a location, a unit group and a rect), check for "units in range of position of casting unit" instead (it "only" leaks a location and a unit group). As for the second trigger, it's unnecesarily long. You could just store all the different triggers in a trigger variable array and use a loop, instead of copying all the stuff. An even better solution would be, though, to not have a seperate trigger for each player, but just a single trigger which is always on and loops through all players and if their Sleeping variable is true then it does the "waking up when attacked". doing it this way effectively makes the Checking trigger obsolete. As far as the non-functioning dummy caster goes, all I can say is, double check that it has the mana, double check that it has the spell, double check that the spell doesn't have any techtree requirements (sleep probably doesn't, but this can be a problem when using spells like inner fire or bloodlust), double check that the spell has enough range (but you create the dummy caster at the position of the hero anyway). And detecting when the hero wakes up? Well, unless it's attacked (you already have a trigger checking for that), the only way for him to unsleep is for the sleep duration to end. Just use a wait action or a timer for that. alternatively, you could make the sleep last forever, but remove it whith triggers when the player reaches full health and mana (which won't be a problem to detect, because you'll probably be regenerating the mana and hp with triggers anyway). |
| 07-10-2005, 03:54 PM | #11 |
Right fuck dummycasting then, I'll just fake it 200%. You wouldn't mind telling me how to set it up to check without leaking? We all hate leaking. |
| 07-10-2005, 10:41 PM | #12 |
just set all handles you are going to use into variables, and then after your IF then use: custom script: call RemoveLocation("your point global") custom script: call DestroyGroup("your unit group global") |
| 07-10-2005, 10:42 PM | #13 |
just set all handles you are going to use into variables, and then when you are done with the variables use: custom script: call RemoveLocation("your point global") custom script: call DestroyGroup("your unit group global") edit: ehum... double post? wtf? :S edit2: double post removed. |
| 07-11-2005, 12:15 PM | #14 |
Right, thanks mate. |
