AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   making a moon that has health (https://forums.alliedmods.net/showthread.php?t=25365)

SSJ2GOKU 03-12-2006 15:49

making a moon that has health
 
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?

VEN 03-13-2006 04:15

Re: making a moon that has health
 
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.

Zenith77 03-13-2006 15:48

You can't really find the "middle" of the map since maps can be anywhere within the boudns of the engine

SSJ2GOKU 03-14-2006 03:16

can anybody help me with capturing the part when the moon is destroyed ?

VEN 03-14-2006 03:40

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.

SSJ2GOKU 03-14-2006 10:11

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

VEN 03-14-2006 13:56

It's possible to return FMRES_SUPERCEDE and then emit your sound with emit_sound.
Note: emitted sound must be precached.

SSJ2GOKU 03-14-2006 15:08

can you tell me how to use the FMRES_SUPERCEDE
cause thats a totally unknown function to meh

VEN 03-14-2006 15:48

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 }


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

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