Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,791 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
separate missile from knowing if it's hit the player or the box? #280917
07/24/09 16:45
07/24/09 16:45
Joined: Nov 2008
Posts: 19
Sweden
Alof Offline OP
Newbie
Alof  Offline OP
Newbie

Joined: Nov 2008
Posts: 19
Sweden
Yoho! I'm in need of a tip,
I've got a simple game containing two airplanes, and a
power up box.
I've got the movement codes working and the function that makes
the players able to fire a missile, no problems there.
I use the "my.emask & my.event" assignments to the missiles action, this works great as long as the players shot eachother. But as soon as the missile hits the power up box (Which I want to blow up in that case) the game crash.
I use the;
"switch (event_type)"
and then the "case EVENT_ENTITY:" in the code, though I can't seem to separate the missile from knowing if it's hit the player or the box. Have tried with "if" statements inside the "case" function, but can't seem to get it to work.

Thanks in advance!


"If you say 'plz' because it's shorter than 'please', then I'll say 'no' because it's shorter than 'yes'.
Re: separate missile from knowing if it's hit the player or the box? [Re: Alof] #280919
07/24/09 16:55
07/24/09 16:55
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
Hi,

First of all, you're using Lite-C, not C-Script (you can't use switch/case in c-script) wink

I can't tell why it crashes without seeing more of your code, but to check whether the missile hits the player or the box, use a skill to determine that, e.g.:

player's skill1 = 1
box's skill1 = 2

then in the missile event, you can check (if event_entity) whether you.skill1 is 1 or 2 smile

Re: separate missile from knowing if it's hit the player or the box? [Re: Alof] #280920
07/24/09 16:58
07/24/09 16:58
Joined: Sep 2006
Posts: 99
BS, Germany
Storm_Mortis Offline
Junior Member
Storm_Mortis  Offline
Junior Member

Joined: Sep 2006
Posts: 99
BS, Germany
well, if could read your code i would be pretty sure to be able helb you.
but let me try to help without reading it^^

if im right, you try to let the missile know what it has hit.
try, to detonate the missile an collision and do nothing else.
and let the poverup check if its been hit by player or missile.
than you could let it dissaper or powerup the player...

if this dindnt help, post your code so sombody con read and help^^


it found a voice ... now it needs a body
Re: separate missile from knowing if it's hit the player or the box? [Re: Claus_N] #280930
07/24/09 17:38
07/24/09 17:38
Joined: Nov 2008
Posts: 19
Sweden
Alof Offline OP
Newbie
Alof  Offline OP
Newbie

Joined: Nov 2008
Posts: 19
Sweden
Originally Posted By: Claus_N
Hi,

First of all, you're using Lite-C, not C-Script (you can't use switch/case in c-script) wink


Hey there! Thanks for the quick reply!
Well, I've alsow tried "if(event_type == EVENT_ENTITY)" but I guess that's the best way to do this though, since you say I can't use switch/case ^^.

Originally Posted By: Claus_N
Hi,
I can't tell why it crashes without seeing more of your code, but to check whether the missile hits the player or the box, use a skill to determine that, e.g.:

player's skill1 = 1
box's skill1 = 2

then in the missile event, you can check (if event_entity) whether you.skill1 is 1 or 2


I'm currently at the wrong computer to be able to post the script - but will do it asap if the problem persists.

so basicly you mean it SHOULD be possible for the missile to check what it hit if I use something like this?:

if (event_entity)
{
if(your.skill1 == 1) {do something}
if(your.skill1 == 2) {Do something else}
}

I'm pretty sure that this is the code I am using at the moment, though maybe I wrote "if(EVENT_TYPE == event_entity)"
instead of "if(event_type)" is this vital? I don't get any errors during compile-process, so...

Anyway, I will test your tip, and if it's not working I'll post the code later! laugh

Thanks a lot for your help, and your time. smile *Thumbs up*


"If you say 'plz' because it's shorter than 'please', then I'll say 'no' because it's shorter than 'yes'.
Re: separate missile from knowing if it's hit the player or the box? [Re: Alof] #280931
07/24/09 17:45
07/24/09 17:45
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'll check back later then smile

If you write "if(event_type)" you are just checking whether event_type is not 0, and then you will get an empty-pointer error if you e.g. hit a level block instead (that would make event_type == event_block and the "you" entity would not exist then). smile


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

Gamestudio download | 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