Jump to content

Increase Decrease Flag Programatically


rvotri

Recommended Posts

Hello! 

How do i via File in "Do script file" change a Game Flag's value? 


I have a simple script that counts Kills for both sides, Players and AI... But my script dies on it, it only shows the totals but it don't interact with game itslef... I tryed to imput totals to a Flag but every time a kills happens a scritping error is thrown...

I tryed the following:
 

local Temp = Event.initiator; 
    if Event.id == 5  
         then if Temp 
                     then _ = Temp:getCoalition(); 
						 if _ == 1 then Blue=Blue+1
						 trigger.action.setUserFlag('10000', flag_value + 1)
					     end 
						 if _ == 2 then Red=Red+1 
						 trigger.action.setUserFlag('10001', flag_value + 1)
						 end
					 return	
		end 
	end

And i get the error in attached image.

 

I'm not sure if this is the correct approach... So i'm open to new ideas!

Thanks in advance!

no.png

Who cares...

Link to comment
Share on other sites

Ow! My mistake... Solved it.... I was using part of script of different files, so i forgot to change:

trigger.action.setUserFlag('10000', flag_value + 1)

to

 

trigger.action.setUserFlag('10000', Blue)

 

trigger.action.setUserFlag('10000', Red)

 

Its working now, i'll let the post here for other users.

Thanks

Who cares...

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...