Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
4 registered members (fogman, Grant, AndrewAMD, juanex), 989 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
colleting objects and increase the score board #212345
06/21/08 17:25
06/21/08 17:25
Joined: Jun 2008
Posts: 2
TX,USA
rainydays Offline OP
Guest
rainydays  Offline OP
Guest

Joined: Jun 2008
Posts: 2
TX,USA
HI.....
I m a new user of lite-c and i m going to implement RTS game . i have a problem with collecting objects. it's like, in AOE they collect the resources of food and gold etc. i am not able to figure out what events or flags should i use. when my player touch that object the object should be removed and score board should be updated.

Re: colleting objects and increase the score board [Re: rainydays] #212349
06/21/08 17:59
06/21/08 17:59
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Code:
var resources[3] = { 0, 0, 0 };

#define lifetime skill1  // helper skill
#define id skill2  // type of the resource
#define amount skill3  // amount of the resource

#define wood 0
#define stone 1
#define ore 2

function resource_event()
{
  resources[my.id] += my.amount;
  my.lifetime = 0;
}

action resource_act
{
  my.emask |= (ENABLE_ENTITY | ENABLE_IMPACT);
  my.event = resource_event;

  my.lifetime = 1;
  while(my.lifetime) { wait(1); }

  wait(1);
  ent_remove(me);
}


Now you only need to set the skills of the different resource entities either in WED or through script when creating them.
You could also have one action per resource type.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1