A Community discussion forum for Halo Custom Edition, Halo 2 Vista, Portal and Halo Machinima

Home  Search Register  Login Member ListRecent Posts
  
 
»Forums Index »Halo Custom Edition (Bungie/Gearbox) »Halo CE Technical / Map Design »Difficulty check & weapons spawning script, Syntax Errors.

Author Topic: Difficulty check & weapons spawning script, Syntax Errors. (3 messages, Page 1 of 1)
Moderators: Dennis

xXThePlague1Xx
Joined: Sep 2, 2011


Posted: Sep 29, 2011 05:40 PM    Msg. 1 of 3       
Ok I'm trying to create a script for a single player map that checks the difficulty, and if its set to hard or impossible to spawn certain weapons and vehicles.

But it keeps giving me syntax errors. I've spent 2 days now trying to fix it, using the scripting bible and zteams campaign scripts as references (plus google). To no avail this is really starting to annoy me, so any help will be greatly appreciated.

Thanks in advance.

Here's what I've got :

(script startup spawn_weapons
(if (= (game_difficulty_get )normal )(wake spawn_destroy))
(if (= (game_difficulty_get )hard )(wake spawn_anew))
(if (= (game_difficulty_get )impossible )(wake spawn_anew))
)

(script dormant spawn_destroy
(object_destroy 6_sht_1)
(object_destroy 6_sht_2)
(object_destroy 6_sht_3)
)

(script dormant spawn_anew
(object_create_anew 6_sht_1)
(object_create_anew 6_sht_2)
(object_create_anew 6_sht_3)
)


And this Is the error that sapien gives me :

09.29.11 15:46:50 [Spawn_Weapons line 2] this is not a valid script name.: spawn_destroy))
09.29.11 15:46:50 recompiling scripts after scenarios were merged.
09.29.11 15:46:50 [Spawn_Weapons line 1] this left parenthesis is unmatched.: (script startup spawn_weapons

now i have tried many different things but i cant figure it out, its probably really simple but IDK.
Please bear in mind I have no experience with halo scripting.


rerout343
Joined: Aug 7, 2010

Targeted and Firing


Posted: Sep 29, 2011 07:25 PM    Msg. 2 of 3       
As weird as this will sound, you need to change the order of your scripts.

You have:

(script startup spawn_weapons
(if (= (game_difficulty_get )normal )(wake spawn_destroy))
(if (= (game_difficulty_get )hard )(wake spawn_anew))
(if (= (game_difficulty_get )impossible )(wake spawn_anew))
)

(script dormant spawn_destroy
(object_destroy 6_sht_1)
(object_destroy 6_sht_2)
(object_destroy 6_sht_3)
)

(script dormant spawn_anew
(object_create_anew 6_sht_1)
(object_create_anew 6_sht_2)
(object_create_anew 6_sht_3)
)

You need:

(script dormant spawn_destroy
(object_destroy 6_sht_1)
(object_destroy 6_sht_2)
(object_destroy 6_sht_3)
)

(script dormant spawn_anew
(object_create_anew 6_sht_1)
(object_create_anew 6_sht_2)
(object_create_anew 6_sht_3)
)

(script startup spawn_weapons
(if (= (game_difficulty_get )normal )(wake spawn_destroy))
(if (= (game_difficulty_get )hard )(wake spawn_anew))
(if (= (game_difficulty_get )impossible )(wake spawn_anew))
)

The reason for this is because you need to have your scripts typed out before you reference them in another one. You run into the same issues with globals.


xXThePlague1Xx
Joined: Sep 2, 2011


Posted: Sep 29, 2011 10:18 PM    Msg. 3 of 3       
Thanks Ill go try that.

That actually doesn't sound weird at all, that would make sense and I never would have thought of it.

Thanks for teaching me something new. :)

 

 
Previous Older Thread    Next newer Thread







Time: Thu January 19, 2023 1:40 AM 141 ms.
A Halo Maps Website