Page 2 of 2

Re: Trigger Damage Problem

Posted: April 24th, 2013, 10:52 am
by ekat
thank you very much! :)
Works fine.. <3

Just a few questions for this script..
Is it possible to get hit indicator?
Is it possible to get a red crosshair?
Is it possible to take away the deagle after level 3 if the person dont have it before?
Are there more changes in radiant then the conncects between trigger and brushmodels?

Re: Trigger Damage Problem

Posted: April 24th, 2013, 10:34 pm
by Drofder2004
ekat wrote:thank you very much! :)
Works fine.. <3

Just a few questions for this script..
Is it possible to get hit indicator?
Is it possible to get a red crosshair?
Is it possible to take away the deagle after level 3 if the person dont have it before?
Are there more changes in radiant then the conncects between trigger and brushmodels?
[Note: Line numbers may not be correct as I was changing script while updating this post]

Hit Indicators:
This is stock code, but include it in your mod, because I think CJ mod disables it.

Code: Select all

 
// Place the following line as the first thing inside "main()"
precacheShader("damage_feedback");
 
// Put the following call after "//set up player" - line 144 in my script.
user thread hitmarker();
 
// Put the following lines inside "target_think" after the if statement - line 230
user playlocalsound("MP_hit_alert");
user.hud_damagefeedback.alpha = 1;
user.hud_damagefeedback fadeOverTime(1);
user.hud_damagefeedback.alpha = 0;
 
// Put this function at bottom of script
hitmarker()
{
        if(!isDefined(self.hud_damagefeedback))
        {
                self.hud_damagefeedback = newClientHudElem(self);
                self.hud_damagefeedback.horzAlign = "center";
                self.hud_damagefeedback.vertAlign = "middle";
                self.hud_damagefeedback.x = -12;
                self.hud_damagefeedback.y = -12;
                self.hud_damagefeedback.archived = true;
                self.hud_damagefeedback setShader("damage_feedback", 24, 48);
                self.hud_damagefeedback.alpha = 0;
        }
}
Remove DesertEagle

Code: Select all

// Add the following after "// Set up player loadout" - line 159
user.lastWeapon = user getCurrentWeapon();
 
// Add this to FIRST if statement - Line 196
// This will remove the weapon on every eventuality fail/pass
user takeWeapon("deserteagle_mp");
user switchToWeapon(user.lastWeapon);
Crosshair colour more than likely needs a graphical edit, I do not know - someone else may be able to help on that.
And the changes are simple adding a common targetname and linking each target brush to their respective trigger using the "target" key.

Re: Trigger Damage Problem

Posted: April 25th, 2013, 5:12 pm
by ekat
That works great! :)
Just one last thing..
What did i have to change to make the trigger_damage to an array?
I want to make better targets but therfor i need 7 trigger for each target..
http://s14.directupload.net/images/130425/w9cs3xpj.jpg
I already created them but because its getEnt i cant start it..^^
Thank you very much for all your amazing help! :)

Re: Trigger Damage Problem

Posted: April 25th, 2013, 8:54 pm
by Drofder2004
Select all the brushes you want, right-click 2D window and select "script<brushmodel".
If you deselect the model, you can now press "SHIFT+ALT", then click any of the individual brushes. This will select all the brushes that make the brushmodel.
Now simply press "n" and add you targetname.

When done in this way, all the individual brushes will be treated as a single entity in game.

Re: Trigger Damage Problem

Posted: April 25th, 2013, 10:58 pm
by ekat
ok but i cant connect the brushmodel to the trigger..
And how to make the same shit with all the triggers?
Because i need 7 brushmodels and 7 trigger for each target.. o.O

Re: Trigger Damage Problem

Posted: April 25th, 2013, 11:40 pm
by Rezil
You can connect any entity to any other entity, select the trigger, then select your brushmodel and press W. They should now be connected.
You'll have to use the clipping tool('X' key on your keyboard) to make your trigger look like that. Create the trigger using 1 brush, then clip it properly. Personally I had a lot of trouble trying to make the trigger work when I made it out of multiple brushes.

Re: Trigger Damage Problem

Posted: April 26th, 2013, 2:25 am
by ekat
Rezil wrote:You can connect any entity to any other entity, select the trigger, then select your brushmodel and press W. They should now be connected.
ye i know that thanks! :P
Rezil wrote:You'll have to use the clipping tool('X' key on your keyboard) to make your trigger look like that. Create the trigger using 1 brush, then clip it properly.
Thats how i make the screen! :D
Rezil wrote:Personally I had a lot of trouble trying to make the trigger work when I made it out of multiple brushes.
So its not possible and i have to use a square trigger? :(

Re: Trigger Damage Problem

Posted: April 26th, 2013, 9:55 pm
by Drofder2004
It is perfectly possible and incredibly easy to do.

Create your shape.
Select all the parts.
"Script<Brushmodel"
(Give it targetname + target)

Create the same shape and give it trigger texture.
Select all the parts.
"Trigger<Trigger_damage"
(Give it targetname)

You cannot "link" the brushmodel to the trigger by having all the parts selected, you should only have one section of trigger selected - or even easier, just type "key:target value:targetname_of_trigger" and they will link together.

I have attached a map with a very slightly modified version of your script.
mp_test.zip

Re: Trigger Damage Problem

Posted: April 27th, 2013, 3:28 am
by ekat
Drofder2004 wrote:It is perfectly possible and incredibly easy to do.
Drofder you are my hero.. :)
Thank you very much! :P
Now everything is working and looks good.. :D
Video:
Drofder2004 wrote:I have attached a map with a very slightly modified version of your script.
What exactly is modified in this version of my map/script? :P

Re: Trigger Damage Problem

Posted: April 27th, 2013, 2:03 pm
by Drofder2004
ekat wrote:
Drofder2004 wrote:I have attached a map with a very slightly modified version of your script.
What exactly is modified in this version of my map/script? :P
Very little.
Mostly adjustments were made to ignore parts of your script (secrets) but the main change was "randomint(target.size)" - this allows for more than 4 triggers and obviously my targets rotated instead of moved.

Glad you got it working, however there is so much more you can do to improve this - but that is obviously up to you :)

Re: Trigger Damage Problem

Posted: April 27th, 2013, 3:01 pm
by ekat
Drofder2004 wrote:Mostly adjustments were made to ignore parts of your script (secrets)
Thats bad, i need the parts with secrets, book and more..^^
U need the book to use the secret and if u finish all 3 level u get secret +1 for the final secret.. :D
Drofder2004 wrote:but the main change was "randomint(target.size)" - this allows for more than 4 triggers
That sound great! :D
Drofder2004 wrote:and obviously my targets rotated instead of moved.
I was thinking of let them fall down and stand up! :D
Drofder2004 wrote:Glad you got it working, however there is so much more you can do to improve this
Any Ideas? :D

Re: Trigger Damage Problem

Posted: April 27th, 2013, 3:37 pm
by Drofder2004
You can do various types of target and easily adapt it into the code with very little change.

One easy way of doing this:
For each different style of target, add a KEY:VALUE of "script_noteworthy" and a value of your choosing.
So, if you had a moving target:
Key: script_noteworthy
Value: moving_target

Now, in your code:

Code: Select all

switch(targets[currentTarget].script_noteworthy)
{
        case "right":
                targets[currentTarget] rotateyaw(90, 0.2);
                wait (2 / (user.target_level + 0.3));
                targets[currentTarget] rotateyaw(-90,0.1);
                break;
        case "left":
                targets[currentTarget] rotateyaw(-90, 0.2);
                wait (2 / (user.target_level + 0.3));
                targets[currentTarget] rotateyaw(90,0.1);
                break;
        case "down":
                targets[currentTarget] rotateroll(90, 0.2);
                wait (2 / (user.target_level + 0.3));
                targets[currentTarget] rotateroll(-90,0.1);
                break;
}
wait 1;
The example above uses 3 targets, 2 of the targets pop out from the walls and the third is standard.
You just add your own case and how it reacts. So different wait times, different actions (combine movement maybe?)

--

Generally, mapping could also be improved - such as lighting, textures of target, fx, etc

Re: Trigger Damage Problem

Posted: April 27th, 2013, 4:21 pm
by ekat
KillerSam wrote:Civilian targets that look almost the same - but it's GG if you shoot one :P
I love this idea! :D
KillerSam wrote:You could also make it so that you need to get a certain point score with a scoring system
Good idead too! Will look into it! :P

Drofder2004 wrote:You can do various types of target and easily adapt it into the code with very little change.

One easy way of doing this:
For each different style of target, add a KEY:VALUE of "script_noteworthy" and a value of your choosing.
So, if you had a moving target:
Key: script_noteworthy
Value: moving_target

Now, in your code:

Code: Select all

switch(targets[currentTarget].script_noteworthy)
{
        case "right":
                targets[currentTarget] rotateyaw(90, 0.2);
                wait (2 / (user.target_level + 0.3));
                targets[currentTarget] rotateyaw(-90,0.1);
                break;
        case "left":
                targets[currentTarget] rotateyaw(-90, 0.2);
                wait (2 / (user.target_level + 0.3));
                targets[currentTarget] rotateyaw(90,0.1);
                break;
        case "down":
                targets[currentTarget] rotateroll(90, 0.2);
                wait (2 / (user.target_level + 0.3));
                targets[currentTarget] rotateroll(-90,0.1);
                break;
}
wait 1;
The example above uses 3 targets, 2 of the targets pop out from the walls and the third is standard.
You just add your own case and how it reacts. So different wait times, different actions (combine movement maybe?)
I will maybe play a bit arround with the targets but i dont want to make it to hard because its just a little piece of a big secret+bonus for my jump map... :D
Thats why there is "user.secret4=true;" and "user.secrets++;" in this script..^^
Drofder2004 wrote:Generally, mapping could also be improved - such as lighting, textures of target, fx, etc
I think the textures of my targets (see video) are cool.. :D
But thats just my opinion..^^
ofc i will look into good textures, lights and more on my jumpmap! :)
But at the moment, thank you all for your great help! :)
You are my heroes! :P