Jump to content

Need help with script in object placed by explosion


theclawhorn

Recommended Posts

EDIT: I have since learned that projectiles must be created by using the FireWeapon command. I have switched to using that after creating a custom weapon, but the projectiles still seem to not be created.

EDIT 2: It turns out the custom Misc. Object I created was to blame. I fixed the issue by duplicating an already existing item and using that as the Placed Impact Object. I'm not sure WHY it worked though. Read on for further details.


I'm having issues with a simple script and placed object I have created. First, I created a miscellaneous item and set it as the Placed Impact Object of an explosion. I then created a custom projectile to be used in the script. I then created a script inside the miscellaneous item. Here is the script:

scn TestProjectileScript

int counter

Begin GameMode

if counter > 4
	FireWeapon WeapTestProjectile
	Disable
	MarkForDelete
endif

set counter to counter + 1

End

As you can see, the script is rather basic. I'm simply attempting to place 10 of these custom projectiles after 4 frames of the object's creation. I am now using the FireWeapon command on the custom weapon I created which is set to fire 10 projectiles. Even though the projectiles are set to have tracers 100% of the time I can't seem to spot them. I know I haven't messed with the rotation of the projectiles but even if I throw the explosive into the air I am unable to spot the projectiles anywhere. I get the feeling they aren't even being created. All help is appreciated.

Edited by Deathfang
Link to comment
Share on other sites

I tried changing the FireWeapon WeapTestProjectile line to Player.FireWeapon WeapPlasmaRifle and a projectile was not fired from the player. As I suspected the script isn't even executing. Does anyone know why this is? The misc. item with this script set for its script property is the Placed Impact Object of the grenade explosion.

Edited by Deathfang
Link to comment
Share on other sites

Deathfang - Hello!

 

"As I suspected the script isn't even executing. Does anyone know why this is?"

 

I think your MarkForDelete is removing the object before it can fire anything.

 

I tested with a modified frag grenade explosion which placed a modified Big Pot as it's Placed Impact Object when a frag grenade is thrown.

 

That Big Pot was set to fire a missile with an attached script that used FireWeapon WeapMissileLauncher & the disable & MarkforDelete so as to tidy itself away.

 

I set the script up so that it fires & has a timer to prevent MarkforDelete kicking in before the projectile has a chance to fire.

 

Here's what I used:

 

 

scn TestProjectileScript

int counter
short timer ;To store the delay before marked for deletion

Begin GameMode

if counter == 10
FireWeapon WeapMissileLauncher ;when counter reaches ten fire whatever weapon that has your needed projectile
set counter to 11 ;Stop this line running again by setting above ten
return
elseif counter < 10
set counter to counter + 1 ;If not yet reached 10 add 1 until it does
return
elseif counter == 11 ;If it has fired it will be set to eleven so disable and set to twelve so that the mark for delete can kick in
disable
set counter to 12
return
endif

if getdisabled == 1 ;If the Placed Impact Object has fired and is ready to be deleted it will have been disabled
if counter == 12 ;And counter will be set to 12
set counter to 13 ;So set to thirteen to stop this part running
set timer to 25 ;Set the delay so that the projectiles have finished firing can be any number you need
return
endif
endif

if timer == 0 ;Once the timer reaches zero it's safe to call mark for delete
set timer to -1

;playsound NPCSuperMutantBehemothAttack01 ;This line is not needed it's only to test that mark for delete is being reached
markfordelete
else
set timer to timer - 1 ;If not zero yet then deduct one until it is

endif


End

 

 

The annotations are just there to explain what I've done.

 

As mentioned the line:

 

;playsound NPCSuperMutantBehemothAttack01

 

Was used to let me know that the mark for deletion phase was kicking in, remove the semi colon to hear the noise at this point.

It's a handy trick to use when you think parts of your script is not working.

 

Remove the line entirely from completed script.

 

There's probably slicker ways to script this & anyone that's a script wizard is welcome to come in with anything smoother then mine. :D

 

It worked for me & I think it's what you're after.

 

You can easily substitute the timings to suit your projectiles needs.

 

Hope this helps!

 

Prensa

 

EDIT: trimmed down an annotation in the script because, as posted on the board, a line was split in two & interfered with the workings when copied

Edited by prensa
Link to comment
Share on other sites

Thanks for the reply. The thing is I even tried taking the disable and mark for delete out of the script and it still didn't work. Even with or without a timer before executing the FireWeapon command nothing happens. I think the script is literally just not executing and I have no idea why.

EDIT: I decided to see if the Misc. Object I created was to blame. It turns out it was, but I'm not sure why. I tried just duplicating the already existing object "BigPot" as you did and set that as the Placed Impact Object with the same script I wrote applied. It worked! But why in the **** wasn't mine working? Do Misc. Objects HAVE to have a model to be placed? An icon? Weight? If that is the case I think that's extremely stupid as all I want is a dummy object to serve as a marker.

Edited by Deathfang
Link to comment
Share on other sites

Deathfang - Hello!

 

The example script I posted works for me, it fires a missile from the placed object (I used a modified Big Pot).

 

Is that not what you were after?

 

Does my version of the script work for you?

 

Try it with a Big Pot placed & the missile projectile at first, as it is written, then swap in your custom weapon/projectile for the missile to see if the problem is with your custom weapon/projectile.

 

Hope this helps!

 

Prensa

Link to comment
Share on other sites

Read the EDIT part in my above post. :smile:

EDIT: I decided to see if the Misc. Object I created was to blame. It turns out it was, but I'm not sure why. I tried just duplicating the already existing object "BigPot" as you did and set that as the Placed Impact Object with the same script I wrote applied. It worked! But why in the **** wasn't mine working? Do Misc. Objects HAVE to have a model to be placed? An icon? Weight? If that is the case I think that's extremely stupid as all I want is a dummy object to serve as a marker.

 

Edited by Deathfang
Link to comment
Share on other sites

Deathfang - Hello!

 

Glad you got it working. :)

 

"Do Misc. Objects HAVE to have a model to be placed?"

 

I'd assume they at least need a model to be placed, especially in the case of wanting it to fire as without a projectile node it will fire from the center of the model.

 

That was probably the problem.

 

You can always find a less obtrusive object, or perhaps make it very small so it can't be noticed for the few seconds it must be in existence.

 

Prensa

Link to comment
Share on other sites

Deathfang - Hello!

 

Glad you got it working. :smile:

 

"Do Misc. Objects HAVE to have a model to be placed?"

 

I'd assume they at least need a model to be placed, especially in the case of wanting it to fire as without a projectile node it will fire from the center of the model.

 

That was probably the problem.

 

You can always find a less obtrusive object, or perhaps make it very small so it can't be noticed for the few seconds it must be in existence.

 

Prensa

Alright, thanks so much for the help. When the weapon fires multiple projectiles (10) or I use the FireWeapon command multiple times there's terrible lag so I am afraid that my mod idea may not work unless the bad performance is solely due to something on my end.

Edited by Deathfang
Link to comment
Share on other sites

Then something must be wrong with either the script or the model.

 

For example... in EVE for Fallout3, I made a very famous weapon called the "Shredder Grenade"

http://static-3.nexusmods.com/15/mods/120/images/8340-3-1257497419.jpg

 

This thing fires 12 lasers in a big spread, every second, for 10 seconds whilst bouncing around (very very deadly in a hallway...)

 

Now, I used my own custom script in that, (though similar to what you've discussed above).
But, you do have permission to use any of EVE FO3's assets in your mod such as that script, or the Null placed object.

(Shredder grenades blast 120 projectiles in a short amount of time and has never gotten a report of lag) .

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...