Gamestudio Links
Zorro Links
Newest Posts
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, monarch), 1,432 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Event_type == EVENT_IMPACT #281972
07/29/09 17:51
07/29/09 17:51
Joined: Jul 2009
Posts: 36
S
SomebodyNew Offline OP
Newbie
SomebodyNew  Offline OP
Newbie
S

Joined: Jul 2009
Posts: 36
Hey there,
I wrote a script that lets the player shoot a ball at a wall. Now each time the wall is hit I subtract some hitpoints (skill 1) from the wall. When the Wall's skill 1 reaches zero ent_remove is used to remove it.
In the script I wrote an event that would be called from the Wall once it is hit (my.event... my.skill1 -= 10; etc...).

Since the level has grown and grown it seems smarter to let the ball/missile/bullet/whatever "carry" its own event that would simply decrease one's health via your.skill1 -= 10;.
Unfortunately I get all kinds of errors when using the "your" prefix.

Aum54 give a good introduction to events.
The manual places only one restriction - you can't use wait.
I've been looking for this in Aum - they only have games where the "enemy" reduces its own health and maybe distinguishes between the different weapons it is hit with.

So here's the question: in general is it possible to let the projectile "carry" the event and then simply change all variables/skills using the "your" prefix?

Thanks for taking the time,
a newbie

Re: Event_type == EVENT_IMPACT [Re: SomebodyNew] #281975
07/29/09 18:08
07/29/09 18:08
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
If I understand what you want, you want a Bullet that removes when it hits anything?

If yes, use:

function remove()
{
ptr_remove(me);
}

function bullet()
{
my.emask |= ENABLE_IMPACT;
my.event = remove;
while(1)
{
c_move(me, vector(13 * time_step, 0,0), nullvector, ACTIVATE_SHOOT);
wait(1);
}

Re: Event_type == EVENT_IMPACT [Re: Rei_Ayanami] #281980
07/29/09 18:41
07/29/09 18:41
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
I suppose your walls are entities then? You can use EVENT_ENTITY then, and remember to check whether the "you/your" pointer is valid, like this:

if(event_type == EVENT_ENTITY && you != NULL)
{
you.skill1 -= 5; // Decrease healthpoints
}

Edit: if the error(s) you are getting are 'empty pointer'-errors, this might be worth reading:
http://www.nighthawk.dk/v5/index.asp?PageID=ShowArticle&ID=5
It's c-script syntax though, but might still be worth reading smile

Last edited by Claus_N; 07/29/09 18:43.

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