Jump to content
Sign in to follow this  
Shabadu

Ofp rts

Recommended Posts

I'm having difficulty creating a global variablr, lets call it creds.

What I want to do is build an object in a specific area and if it's in the right place it'll slowly add to "creds" which I want displayed permanently on-screen.

I can't figure out a method of handling the variable and have no idea how to display it.

I'm at uni and we are learning C++, I've done some versions of BASIC so I'm not illiterate in this respect and I have all the comrefs I can lay my hands on.

Share this post


Link to post
Share on other sites
Guest BratZ

creds = 0

? _buildingplaced : creds = creds +1

after you have changed the variable on any computer in a multiplayer game use:

publicvariable cred

So that all computers get the changed number

hint format["Credits:%1 ", creds]

(run this on every computer if you want all to see when it has changed)

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (BratZ @ Oct. 16 2002,19:02)</td></tr><tr><td id="QUOTE">creds = 0

? _buildingplaced : creds = creds +1

after you have changed the variable on any computer in a multiplayer game use:

publicvariable cred

So that all computers get the changed number

hint format["Credits:%1 ", creds]

(run this on every computer if you want all to see when it has changed)<span id='postcolor'>

I see. _buildingplaced a command or do I need to make an addaction to do this?

Share this post


Link to post
Share on other sites
Guest BratZ

I used _buildingplaced in place of whatever variable you were using to verify the building pacing operation is done.Heres some snippets of and old RTS mission I made back in 1.20 or so so be careful of new/old commands.A script I used to place the HQ's:

? (not alive usachq) : goto "rebuildusahq"

? usahqplaced == 1 : usa1 sidechat "HQ Already Placed!" && exit

? (usagold<499):goto "notenoughcash"

? usabarracksplaced == 1 && (usaengineer distance usabarracks) < 30 : goto "inuse"

? usaadvbarracksplaced == 1 && (usaengineer distance usaadvbarracks) < 20 : goto "inuse"

? usaairpadplaced == 1 && (usaengineer distance usaairpad) < 30 : goto "inuse"

? usavehyardplaced == 1 && (usaengineer distance usavehyard) < 40 : goto "inuse"

? usatankyardplaced == 1 && (usaengineer distance usatankyard) < 40 : goto "inuse"

exit

#placeusahq

~1

?(usaengineer distance ironmine)< 500: usa1 sidechat "HQ Can't Be Within 500m of IronMine!" ;exit

?(usaengineer distance ironmine1)< 500: usa1 sidechat "HQ Can't Be Within 500m of IronMine!" ;exit

?(usaengineer distance ironmine2)< 500: usa1 sidechat "HQ Can't Be Within 500m of IronMine!" ;exit

?(usaengineer distance ironmine3)< 500: usa1 sidechat "HQ Can't Be Within 500m of IronMine!" ;exit

?(usaengineer distance ironmine4)< 500: usa1 sidechat "HQ Can't Be Within 500m of IronMine!" ;exit

?(usaengineer distance goldmine)< 500: usa1 sidechat "HQ Can't Be Within 500m of GoldMine!" ;exit

?(usaengineer distance goldmine1)< 500: usa1 sidechat "HQ Can't Be Within 500m of GoldMine!" ;exit

?(usaengineer distance goldmine2)< 500: usa1 sidechat "HQ Can't Be Within 500m of GoldMine!" ;exit

?(usaengineer distance goldmine3)< 500: usa1 sidechat "HQ Can't Be Within 500m of GoldMine!" ;exit

?(usaengineer distance goldmine4)< 500: usa1 sidechat "HQ Can't Be Within 500m of GoldMine!" ;exit

usachq setdir(0)

usaoptions setdir (270)

usaflag1 setdir (180)

usahqbm setdir (270)

_cpos = getpos usahq1

_hdx = _cPos select 0

_hdy = _cPos select 1

_hdz = _cPos select 2

usachq setpos [_hdx-15,_hdy,_hdz]

_cpos = getpos usaengineer

_hdx = _cPos select 0

_hdy = _cPos select 1

_hdz = _cPos select 2

usahqbm setpos [_hdx,_hdy+10,_hdz]

usaflag1 setpos [_hdx+7,_hdy-4,_hdz]

usaoptions setpos [_hdx-8,_hdy-8,_hdz]

usahqbm inflame true

? usahqplaced == 1 : exit

usasgold = usagold - 500

publicvariable "usasgold"

usa1 sidechat "HQ Placed and Ready For Use , 500 Gold Spent!"

usaflag1 setdammage 0

usachq setdammage 0

usaoptions setdammage 0

usahqbm setdammage 0

usahqplaced = usahqplaced + 1

publicvariable "usahqplaced"

usabstrength = usabstrength + 1

publicvariable "usabstrength"

;? usahqplaced ==1 && usahq1actions > 3: usahq1 removeaction 4;usahq1actions = usahq1actions -1

exit

#rebuildusahq

usahqplaced = 0

publicvariable "usahqplaced"

usachq setdammage 0

goto "placeusahq"

exit

#notenoughcash

usa1 sidechat "You need 500 Gold!"

exit

#inuse

usa1 sidechat "Some Of Your Base Is Still In Use For NEW PlaceMent !"

~2

usa1 sidechat "You Must Follow Distance Restrictions or Disable The Buildings !"

exit

Share this post


Link to post
Share on other sites
Guest BratZ

Sorry its long and old,I would do things different today.

Share this post


Link to post
Share on other sites

Thanks mate this might just help put the pieces together. smile.gifsmile.gifsmile.gif

Share this post


Link to post
Share on other sites

Do you want the teams as a whole to earn money, or do you want individual players to earn money at a different rate?

There's a lot of different ways to go about it.

Insofar as a permanently displayed credit amount, there isn't a great way to do it, since using titleltext will take up the middle/bottom portion of the screen, and using Hint will cause the "BLING BLING!" noise for those who have music turned on.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×