Raised This Month: $ Target: $400
 0% 

making a moon that has health


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SSJ2GOKU
Senior Member
Join Date: Oct 2005
Location: Belgium
Old 03-12-2006 , 15:49   making a moon that has health
Reply With Quote #1

how to make a moon spawn that has a health
so when you kill the moon by attacking it, you trigger another public function

is this possible ?

i already made this:

Code:
public create_moon(){     new moon     moon = create_entity("env_model")     new Float:moonorigin[3]     moonorigin[0]=0.0     moonorigin[1]=0.0     moonorigin[2]=2000.0     entity_set_origin(moon,moonorigin)     entity_set_string(moon, EV_SZ_targetname, "MOON")     entity_set_model(moon,"models/moon/moon.mdl")     set_rendering (moon, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 16) }

but now how to make it spawn in the middle of the map ?
and how to give it a health so you can kill it by shooting?
SSJ2GOKU is offline
Send a message via MSN to SSJ2GOKU
VEN
Veteran Member
Join Date: Jan 2005
Old 03-13-2006 , 04:15   Re: making a moon that has health
Reply With Quote #2

Quote:
so you can kill it by shooting?
Create "func_breakable" entity and set it's size and other properties but precache sounds first:
Code:
public plugin_precache() {     precache_sound("debris/bustglass1.wav")     precache_sound("debris/bustglass2.wav")     precache_sound("debris/bustglass3.wav")     precache_sound("debris/glass1.wav")     precache_sound("debris/glass2.wav")     precache_sound("debris/glass3.wav")     precache_sound("debris/glass4.wav") }

Quote:
how to make it spawn in the middle of the map ?
Probably you have to trace 3 pairs of lines outside map.

Quote:
how to make a moon spawn that has a health
Code:
entity_set_float(ent, EV_FL_takedamage, 1.0) entity_set_float(ent, EV_FL_health, Float:health)

Quote:
when you kill the moon by attacking it, you trigger another public function
Catch any emitted sound with fakemeta module and check if entity is valid and entity effects is EF_NODRAW and classname your moon classname.
VEN is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 03-13-2006 , 15:48  
Reply With Quote #3

You can't really find the "middle" of the map since maps can be anywhere within the boudns of the engine
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
SSJ2GOKU
Senior Member
Join Date: Oct 2005
Location: Belgium
Old 03-14-2006 , 03:16  
Reply With Quote #4

can anybody help me with capturing the part when the moon is destroyed ?
SSJ2GOKU is offline
Send a message via MSN to SSJ2GOKU
VEN
Veteran Member
Join Date: Jan 2005
Old 03-14-2006 , 03:40  
Reply With Quote #5

Code:
#include <amxmodx> #include <engine> #include <fakemeta> public plugin_init() {     register_forward(FM_EmitSound, "forward_emit_sound") } public forward_emit_sound(id) {     if (is_valid_ent(id) && (entity_get_int(id, EV_INT_effects) & EF_NODRAW)) {         // if entity classname is your moon classname then moon destroyed     } }

But do what i said in previous post, in other case that wouldn't work.
VEN is offline
SSJ2GOKU
Senior Member
Join Date: Oct 2005
Location: Belgium
Old 03-14-2006 , 10:11  
Reply With Quote #6

i'm gonna post it here then so you can check it out

btw how do you set a sound for a breakable ?

like when the moon is destroyed => emit_sound(moon_death.wav)
in place of those glass.wav's
SSJ2GOKU is offline
Send a message via MSN to SSJ2GOKU
VEN
Veteran Member
Join Date: Jan 2005
Old 03-14-2006 , 13:56  
Reply With Quote #7

It's possible to return FMRES_SUPERCEDE and then emit your sound with emit_sound.
Note: emitted sound must be precached.
VEN is offline
SSJ2GOKU
Senior Member
Join Date: Oct 2005
Location: Belgium
Old 03-14-2006 , 15:08  
Reply With Quote #8

can you tell me how to use the FMRES_SUPERCEDE
cause thats a totally unknown function to meh
SSJ2GOKU is offline
Send a message via MSN to SSJ2GOKU
VEN
Veteran Member
Join Date: Jan 2005
Old 03-14-2006 , 15:48  
Reply With Quote #9

From the last example:
Code:
#include <amxmodx> #include <engine> #include <fakemeta> public plugin_init() {     register_forward(FM_EmitSound, "forward_emit_sound")   } public forward_emit_sound(id) {     if (is_valid_ent(id) && (entity_get_int(id, EV_INT_effects) & EF_NODRAW)) {         // if entity classname is your moon classname then moon destroyed...             // emit your sound             return FMRES_SUPERCEDE     }     return FMRES_IGNORED }
VEN is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode