need some help with functions


(walter1989) #1

im having some trouble with functions

this is the situation:

 1-- i have a func_rotating 
 2-- near this func_rotating are some func_explosives (they are close enough so the rotating object will hit them when rotating)
 3-- a func_button that targets a target_script_trigger, this target_script_trigger calls for the script block of the func_rotating and gives the instruction to start rotating ( setrotation 0 1000 0) 
 4-- the func_rotating has a "dmg" key with a value of "20"

so:

i wanted the rotating object to hit the func_explosives ( that are just some destroyable, shootable objects) and then trigger them, so crush them

BUT the rotating object goes right through the func_explosives, it doesnt do any damage however i have set the dmg to 20

does anyone know what i should do to make it work? thanks


(Ifurita) #2
  1. Replace the func_explosive with a script_mover (#1)
  2. Replace the func_rotating with a script_mover (#2)
  3. Add a target_effect near script_mover #1
  4. Add a wait function to script_mover #2 after which you alertentity the target_effect and setstate script_mover #1 invisible

Take a look at the main gate on Reactor for the target_effect

http://www.worldwidegaming.org/developer/source_maps/reactor_final_source.zip


(walter1989) #3

thanks alot i will try it out tomorrow


(walter1989) #4

thanks a lot :clap: :clap:

i managed to let it work, but i didnt do exactly what you said

this is what i did :

– i didnt use a target_effect but i simply let the func_explosive trigger just after the start of the rotation

also i didnt change the func_rotating and func_explosive into a script_mover cause i didnt know at all why that should be done

but anyway it works now so

thanks man :clap: :clap: :clap:


(walter1989) #5

im having an other problem now

situation :

i want to set globalaccum 0 to 1 if the func_explosive is death, so the script wont try to alert it anymore if you would use the button a second time

so this is what i put in the script

[scriptname of func_explosive ]
{
death
{
globalaccum 0 set 1
}
}

then i said in the scriptblock that sets the func_rotating to start rotate and that alerts the func_explosive to skip the part of alerting, and only do the rotating if globalaccum 0 is set to 1

but it didnt work

then after some time of searching why, i discovered that the value of globalaccum 0 isnt changing to 1 if the func_explosive is death

why could that be? thanks


(Ifurita) #6

why don’t you post your entire script?


(walter1989) #7

here you go

tst1
{
trigger start_func_rot
{
trigger func_rot start_rotation
}
}

func_expl1
{
death
{
globalaccum 0 set 1
}
}

func_expl2
{
death
{
globalaccum 1 set 1
}
}

func_expl3
{
death
{
globalaccum 2 set 1
}
}

func_expl4
{
death
{
globalaccum 3 set 1
}
}

func_expl5
{
death
{
globalaccum 4 set 1
}
}

func_expl6
{
death
{
globalaccum 5 set 1
}
}

func_expl7
{
death
{
globalaccum 6 set 1
}
}

func_expl8
{
death
{
globalaccum 7 set 1
}
}

func_expl9
{
death
{
globalaccum 8 set 1
}
}

func_expl10
{
death
{
globalaccum 9 set 1
}
}

func_rot
{
trigger start_rotation
{
setrotation 0 1000 0
wait 500
globalaccum 0 trigger_if_equal 0 func_rot crush1
globalaccum 1 trigger_if_equal 0 func_rot crush2
globalaccum 2 trigger_if_equal 0 func_rot crush3
globalaccum 3 trigger_if_equal 0 func_rot crush4
globalaccum 4 trigger_if_equal 0 func_rot crush5
globalaccum 5 trigger_if_equal 0 func_rot crush6
globalaccum 6 trigger_if_equal 0 func_rot crush7
globalaccum 7 trigger_if_equal 0 func_rot crush8
globalaccum 8 trigger_if_equal 0 func_rot crush9
globalaccum 9 trigger_if_equal 0 func_rot crush10
wait 10000
stoprotation
}

trigger crush1
{

  alertentity func_expl1

}

trigger crush2
{

  alertentity func_expl2

}

trigger crush3
{

  alertentity func_expl3

}

trigger crush4
{

  alertentity func_expl4

}

trigger crush5
{

  alertentity func_expl5

}

trigger crush6
{

  alertentity func_expl6

}

trigger crush7
{

  alertentity func_expl7

}

trigger crush8
{

  alertentity func_expl8

}

trigger crush9
{

  alertentity func_expl9

}

trigger crush10
{

  alertentity func_expl10

}

}

its not my entire script but only the part that has to do with the func_rot and func_expl

i really wouldnt know whats wrong


(Ifurita) #8

try adding:

spawn
{
wait 200
}

to each of your func_explosives


(DWM|Commando) #9

EDIT:NVM


(walter1989) #10

didnt work

still same thing, if i shoot any of the func_explosives before i press the button
the game does trigger all the “crush#” blocks (however the globalaccums of the shot ones should be 1 so it shouldnt trigger them)

any other ideas?


(walter1989) #11

dont bother helping me out anymore

i couldnt solve the problem so i chaged something to the map

i put the func_explosive behind bullet proof glass so you wont be able to schoot it and the game wont have any problems with that anymore

thanks anyway :clap:


(Ifurita) #12

I still think you’d be better off with script_movers. I think they will be a lot more flexible.


(walter1989) #13

but if i change the func_explosives into script_movers you wont be able to shoot them
isnt it?


(Ifurita) #14

you can shoot script movers if you give them a health value. My shooter course, Tactical, is done with script movers

http://www.worldwidegaming.org/developer/source_maps/tactical_final_source.zip <— source file


(walter1989) #15

ok thanks for that
i’ll try to make it work