Scar error help -1 reply

Please wait...

Tau're

>.

50 XP

6th April 2008

0 Uploads

184 Posts

0 Threads

#1 10 years ago

its not so much as an error, its just not working... in my map, the map will set it self up depending on which race you are, and for some reson whenever i have an 'if' action it wont run it the function, so i despawn all the things in my map to begin with, if your eldar it will respawn all eldar things, if your chaos, it will respawn all chaos things etc.... and it worked perfectly untill i placed it under an IF command function eldar() EGroup_ReSpawnMarker("Eldar_websail", "Eldar_websail_mkr") end this worked so it respawned the eldar websail where i wanted it to be function eldar() if Player_HasBuildingType( g_Player1, "eldar_hq" ) then EGroup_ReSpawnMarker("Eldar_websail", "Eldar_websail_mkr") end end but when i did that, it didnt... if anyone can help it wud be appreciated, o and it doesnt come up as a scar error, it just didnt do anything




fuggles

Slightly cooler than a n00b

50 XP

14th July 2008

0 Uploads

35 Posts

0 Threads

#2 10 years ago

Post your whole code and I'll have a look. BTW, why not use player race, rather than searching for buildings?




Tau're

>.

50 XP

6th April 2008

0 Uploads

184 Posts

0 Threads

#3 10 years ago

Heres my full code and i did search for player race originally but wen it did come up it said it was a nil value, ------------------------------------------------- --[[ IMPORTS ]] ------------------------------------------------- import("ScarUtil.scar") import("WXPScarUtil.scar") import("WCUtil.scar") ----------------------------------------------- ------------------------------------------------- --[[ON GAME SETUP]] ------------------------------------------------- function OnGameSetup() if Annihilate~=nil then if Scar_InitExists(Annihilate) then print("OnGameSetup => killing annihilate wincondition") Scar_RemoveInit(Annihilate) end end end g_Player1 = World_GetPlayerAt(1) g_Player2 = World_GetPlayerAt(1) g_Player3 = World_GetPlayerAt(2) g_Player4 = World_GetPlayerAt(2) ----------------------------------------------------------------------- --Set up the teams ----------------------------------------------------------------------- g_Player2 = Setup_Player (1,"Ally", "space_marine_race",0) Misc_PlayerTeamColor(g_Player2,"default_4") g_Player3 = Setup_Player (2,"enemy", "space_marine_race",2) Misc_PlayerTeamColor(g_Player3,"default_4") g_Player4 = Setup_Player (3,"enemy", "space_marine_race",2) Misc_PlayerTeamColor(g_Player4,"default_4") -- Variables are;- (player slot number, Team name(Text string), team ) ------------------------------------------------- --[[ ON INITIALIZATION ]] ------------------------------------------------- function OnInit() FOW_RevealMarker( "Reveal_1", -1 ) FOW_RevealMarker( "Reveal_2", -1 ) FOW_RevealMarker( "Reveal_3", -1 ) Player_DestroyAll( g_Player2, true, true, true ) Player_DestroyAll( g_Player3, true, true, true ) Player_DestroyAll( g_Player4, true, true, true ) Rule_AddOneShot( Races, 0 ) EGroup_DeSpawn( "Eldar_websail" ) EGroup_DeSpawn( "Ork_bomber" ) EGroup_DeSpawn( "Necron_entrance" ) EGroup_DeSpawn( "Ork_wall1" ) EGroup_DeSpawn( "Ork_wall2" ) EGroup_DeSpawn( "Chaos_rock1" ) EGroup_DeSpawn( "Chaos_rock2" ) EGroup_DeSpawn( "Tau_commtower" ) EGroup_DeSpawn( "Chaos_tower" ) SGroup_DeSpawn( "Guard_thunderhawk" ) SGroup_DeSpawn( "Marine_thunderhawk" ) Util_StartNIS(EVENTS.NIS_Level1) end -- register init function Scar_AddInit( OnInit ) --------------------------------------------------------------------------- ------------------------------[[Races]]------------------------------------ --------------------------------------------------------------------------- function Races() if Player_GetRaceName(g_Player1) == "chaos_marine_race" then EGroup_ReSpawnMarker("Chaos_tower", "Chaos_tower_mkr") end end I wanted it to set up the Player name aswell so if you were Eldar it would come up as Eldar defence force and chaos it wud come up as World Eaters legion etc but for some reson whenever i did an IF command it wud just ignor that function and carry on, Oh and this is based over a Skirmish map so thats why i had to de-activate the Annihlate command and destroy all traces of the other players, i have all the scenery for each race alredy on the map and just got it to despawn so i can simply respawn it (i thought this was easier)




fuggles

Slightly cooler than a n00b

50 XP

14th July 2008

0 Uploads

35 Posts

0 Threads

#4 10 years ago

Why are you defining 4 people using 2 world locations?




Tau're

>.

50 XP

6th April 2008

0 Uploads

184 Posts

0 Threads

#5 10 years ago

Im still new to scar coding, and ive always put g_Player1 = World_GetPlayerAt(1) g_Player2 = World_GetPlayerAt(1) g_Player3 = World_GetPlayerAt(2) g_Player4 = World_GetPlayerAt(2) down depending on how many players, should i not do this? is this wot is making my scar not work the way i want it to?