
Xoronatus
Joined: Dec 6, 2010
Taking a break
|
Posted: Oct 17, 2011 03:36 AM
Msg. 1 of 8
Ok, so let me get this straight.
So I can take any statement like
(ai_place enc_1)
and turn it into a if-then statement like: if_ai_place enc_1_true object_create box
Which would say that if I placed this AI encounter, create this box.
Can you just script like that with almost any true\false statement?
|
|
|

TM_updates
Joined: Aug 31, 2011
Superior to you, Superior Musclez near Brussels
|
Posted: Oct 17, 2011 07:38 AM
Msg. 2 of 8
You would have to do it like this:
After you know you have used (ai_place enc_1), if you want to check if you have spawned this encounter before making a box:
(if (> (ai_living_count enc_1) 0) (object_create box) <else do this> )
Note that you needn't fill in the else part, it is optional. Oh and ai_place simply spawns your encounter, it does not return a boolean (true/false) statement.
You should try to use hs_doc alongside you whenever you do scripting, and look at existing scripts to check how they accomplish things you need to do.
|
|
|

OrangeJuice
Joined: Jan 29, 2009
Documentation and debug.txt
|
Posted: Oct 17, 2011 04:55 PM
Msg. 3 of 8
Alllllllllllrighy then!
Here's the syntax: if condition then (else)
condition can be (= ("AI is dead?") "true") Since = looks weird I'll explain it: = condition_a condition_b (It is set up to return a value such as "Is condition_a equal to condition_b?" (true/false), also, you can use >, or < as well) And (else) is optional.
You replace condition with your condition, and replace then with your command
So yeah, it would end up as what TM_updates just said.
Edited by OrangeJuice on Oct 17, 2011 at 04:59 PM
|
|
|

Xoronatus
Joined: Dec 6, 2010
Taking a break
|
Posted: Oct 17, 2011 07:31 PM
Msg. 4 of 8
So it's like this?
(if ai_living_count wave1) 0) 15) (object_create box) )
I've got my "condition" and my "then."
|
|
|

Muscl3r
Joined: May 22, 2010
dont pray 4 easy lives...pray to be STRONGER MEN
|
Posted: Oct 17, 2011 09:19 PM
Msg. 5 of 8
If your trying to make th script: if wave1 has been placed, create box, then you need to change the living count to the number of enemies in the encounter.
|
|
|

TM_updates
Joined: Aug 31, 2011
Superior to you, Superior Musclez near Brussels
|
Posted: Oct 18, 2011 10:15 AM
Msg. 6 of 8
Quote: --- Original message by: Xoronatus So it's like this?
(if ai_living_count wave1) 0) 15) (object_create box) )
I've got my "condition" and my "then." No, you do not have a condition. I literaly told you exactly what to do in my previous reply. Using the <, >, = operators compares stuff...hence a condition is attained.
|
|
|

Xoronatus
Joined: Dec 6, 2010
Taking a break
|
Posted: Oct 19, 2011 03:28 AM
Msg. 7 of 8
Quote: --- Original message by: TM_updates (if (> (ai_living_count enc_1) 0) (object_create box)
Alright. Edited by Xoronatus on Oct 19, 2011 at 03:29 AM
|
|
|

Muscl3r
Joined: May 22, 2010
dont pray 4 easy lives...pray to be STRONGER MEN
|
Posted: Oct 23, 2011 03:40 PM
Msg. 8 of 8
Just remember what I posted about changing the 0 to the number of units in the encounter
|
|
|