Scar counters -1 reply

  • 1
  • 2

Please wait...

Maxxta

Tyranid Earth Invasion

50 XP

9th April 2009

0 Uploads

29 Posts

0 Threads

#1 9 years ago

Hey im making a map with scar, and i really need to know how to make a counter that counts how many single units each player has killed, so like Player1 : **** however many units. My map is gona be so the more units you kill the better units you unlock and so on. any help would be appreciated




nemitis

ONE MAN ARMY

50 XP

14th September 2008

0 Uploads

181 Posts

0 Threads

#2 9 years ago

The Eres Badlands mission has exactly this. You can open its SCAR file and get it from there. Open Corsix and select 'Load Single SGA Archive' and open the Data file in the DXP2 folder in the game direcory. It's in Data/Scenarios/SP/cl_eres_badlands.scar, Line 239 is where it starts most likely.




Maxxta

Tyranid Earth Invasion

50 XP

9th April 2009

0 Uploads

29 Posts

0 Threads

#3 9 years ago

yea thats what i did, i got the counter and got it to show up and everything but i cant figure out how to make it so when it reaches however many kills you unlock something

function Player1_Horrorunlock()

if Stats_PlayerUnitsKilled( g_Player1 ) == 5 then

EventCue_DoEvent ("recruit_commander", "/event_cue_notifications/cheats!", "Player 1 Reached 5 kills","Horrors Unlocked")

end end

thats what ive got




Redeemed74

Got Redemption?

50 XP

6th November 2008

0 Uploads

335 Posts

0 Threads

#4 9 years ago

Hi Maxxta, glad to see you are still mapping! I made a map a while back based on an idea like this but never got around to finishing it. I uploaded a beta version of it here for you to see what is going on and you could copy from it:

http://www.snapdrive.net/files/573283/Green_Tide-10000_Orks.zip

It uses EZScar 20. The scenario itself is supposed to appear as a single unstoppable wave of orks that only ends when 10,000 of them have fallen! They get progressively stronger, and here are the lines of code that control it:

CreateRule({"Compare",{"NumDeaths","player2"},">",600},{ "JumpToWave", 3,limit=1}) CreateRule({"Compare",{"NumDeaths","player2"},">",1200},{"JumpToWave",4,limit=1}) CreateRule({"Compare",{"NumDeaths","player2"},">",3000},{ "JumpToWave", 5,limit=1}) CreateRule({"Compare",{"NumDeaths","player2"},">",5000},{ "JumpToWave", 6,limit=1}) CreateRule({"Compare",{"NumDeaths","player2"},">",6800},{"JumpToWave",7,limit=1}) CreateRule({"Compare",{"NumDeaths","player2"},">",8400},{ "JumpToWave", 8,limit=1}) CreateRule({"Compare",{"NumDeaths","player2"},">",10000},{{ "Destroy","player2","attackzone"},{ "EndGame"}})

I can't remember off hand what wasn't working very well in this scenario, but I think it is the computer AI went kind of crazy with the destructable sewer-pipe statues I tried to make. The castle wall worked a lot better. Anyway, that isn't too important since the number of kills and increasing difficulty did seem to work well, and that might be what you need. If you could use some more input, TYoungLS who made ezscar might be able to help you some more with this, I will let him know. Keep the maps coming! :)




Maxxta

Tyranid Earth Invasion

50 XP

9th April 2009

0 Uploads

29 Posts

0 Threads

#5 9 years ago

cool thanks redeemed, i got my scar counter working and everything, but mine is multiplayer map, i couldnt get the AI to work so i used the if Cpu_IsEnabled(g_Player1) == true then

Cpu_Enable(g_Player1, false )

code to get rid of the AI so i could move the right units onto the platforms so they would multiply them and give me some fight so i can play it 1 player or if there isnt a enough players that joined the game it would fill in for them. it worked perfectly for 1 player but then when i used it on online with my friend it came up wiht a sync error at his end it said something along the lines of checksum:(100as821da) or something like that. Im guessing its because of the if Cpu_IsEnabled(g_Player1) == true then

Cpu_Enable(g_Player1, false ) because it worked perfectly before that. can you think of anyway i can fix this? because unless my map becomes a real big hit online you will need an AI player or something to fill in for the missing players. Is there anyway i can add EzScar into this so it will fix it? oh and if i didnt mension this in any of my earlier posts My map is a 4 player map. Each player has a counter that counts their kills and when they reach a certain amount of kills they unlock a new unit. they move their selected unit onto their platform and it mulitplys them into the main battlefield area so its a very big battle scene (altho the units only come out in singles) to kill a player you need to kill the generators surrounding their multiplying machine. Any help would be appreciated




dark40k

SCAR is fun!

50 XP

14th January 2009

0 Uploads

13 Posts

0 Threads

#6 9 years ago

Cpu_IsEnabled() is quiet tricky to use in multiplayer. The reason is that each AI player is hosted only by a single machine. The other computers do not know if a player is Human or AI. The result is that you get a different result when calling Cpu_IsEnabled depending if you call it on the computer holding the AI or on the others.

If your purpose is only to call Cpu_Enable(g_Player1, false ) then do it on every computer (I mean there's no need to test if the computer is hosting the AI).

Also, if you use SCAR to send orders to units then you need to do it on every computer (do not test if the computer is holding the AI or not), otherwise you will get a SyncError.

Hope this helps.




Maxxta

Tyranid Earth Invasion

50 XP

9th April 2009

0 Uploads

29 Posts

0 Threads

#7 9 years ago

ok so to not make it error i have to call the cpu_enable function at the same time on all machines, but shouldnt it do this anyway if were all using the same scar? oh and i do need to test for it because its a multiplayer map i just wanted a simple kind of AI so if you dont get 4 players online then an AI player can fill in for them. its a 4 player ffa map. here is what ive done so far http://www.mediafire.com/?myjnza2ewy2 it wont work online because of the sync error but it works single player if you want to check it out




dark40k

SCAR is fun!

50 XP

14th January 2009

0 Uploads

13 Posts

0 Threads

#8 9 years ago

I gave a quick look to the code. You should remove all the tests like "if Cpu_IsEnabled(...) == true then" in your cpuunlock rules. Rules need to run on all computers the same way. This is probably why you get the sync error.

However, the major problem is to find out which players are computers and which one are not. Cpu_IsEnabled() is useless as it provides wrong answers on all computers (states player as human) except on the one hosting the AI.

A solution may be to disable all computers on start. If I remember right, command does nothing if player is human. Then check if the builder makes any move in the first 30 seconds. If it doesn't then it means the player is a disabled computer.

Hope this helps.




Maxxta

Tyranid Earth Invasion

50 XP

9th April 2009

0 Uploads

29 Posts

0 Threads

#9 9 years ago

Yea I tried doing that before but the commands still moved the units even if your a player and it is hard when your trying to build an army and it's trying to send your men in every 40 seconds so what should I do? Should I just abandon the thought of having AI on this map or should I keep looking for a solution?




dark40k

SCAR is fun!

50 XP

14th January 2009

0 Uploads

13 Posts

0 Threads

#10 9 years ago

Here is a possibility that should work although I have not tried it: - send disable cpu to all players on start - check every second if constructor has moved for all players. If a move is detected then state the player as human. - after 30s, you can start your code on all players that have not been detected as human.

The point is that, when using SCAR in multiplayer, you need to send orders to units on every computers simultaneously. (It is because SCAR orders are not sent over LAN).




  • 1
  • 2