n0ob Posted March 10, 2010 Share Posted March 10, 2010 I am trying to spawn some creature wherever I aim and shoot my gun. My question is, is there some kind of spawn function or some other way through the script I can do this? I have gone through the function list and did not find anything suitable. Link to comment Share on other sites More sharing options...
pkleiss Posted March 10, 2010 Share Posted March 10, 2010 The spawn command is PlaceAtMe. But that needs a reference to work, so getting a gun to shoot creatures into existance would be a little trickey. You would possibly have to use some kind of invisible token projectile that would then run a script to spawn the creature, then remove itself. Link to comment Share on other sites More sharing options...
n0ob Posted March 11, 2010 Author Share Posted March 11, 2010 thanks for the quick reply. PlaceAtMe did work with triggers other then a gun. When you say make the projectile run a script how do I do that? I dont see any option to add a script to a projectile. I was trying the following script by adding it to a shotgun ref Target begin ScriptEffectStart set Target to player.GetCombatTarget Target.PlaceAtMe Crcentaur 1 end but it does not do anything. The Same script works with other activators and also if I change blocktype to OnActivate for a gun but then I cant equip the gun it just spawns the centaur every time I try to pick up the gun. After making several variation I have come to the conclusion that ScriptEffectStart is not running. What am I doing wrong here? Link to comment Share on other sites More sharing options...
pkleiss Posted March 11, 2010 Share Posted March 11, 2010 The GetCombatTarget function will only work if the player is aiming at an actor and the actor is withing the auto-aim distance. So that script would only work while aiming at an actor and pulling the trigger. Plus the script would have to be on an object effect placed on the weapon. I'm not sure if this will work, as I have never done anythning like this, but if I were attempting to do what you want, I'd go about it like this: 1) Create your custom weapon, and make it use a custom projectile.2) Use the projectile's explosion feature to add a custom invisible (no damage, no art/visuals - unless you want to see something) explosion that explodes on impact.3A) Use the explosion's enchantment feature to add an object effect script that places your creature at the explosion. (or)3B) Use the explosion's 'Placed Impact Object' to place a token armor (an unplayable piece of very small-scaled armor) and then add a script to the armor to place your creature and then remove the armor from the game. It sounds intersting, so I might just try this out myself. Link to comment Share on other sites More sharing options...
n0ob Posted March 11, 2010 Author Share Posted March 11, 2010 that was very helpful, how do I link my script to enchantment? Where should I put my effect script so that it shows up in the drop down menu when I want to add an effect to my enchantment?? edit: nvm I figured it out, dont know yet if it will work though Link to comment Share on other sites More sharing options...
pkleiss Posted March 11, 2010 Share Posted March 11, 2010 Hey, I've been working on this myself and I can tell you that I had to do method B. I could not get the effect script to target the explosion for the placeatme command. Instead it targeted all actors in the area of the explosion, and would spawn one creature per actor. Firing it a couple of times led to an army of ghouls very quickly. I used ghouls as my spawned creature. Plus if my explosion did not encompass any actors (dead or alive) it did not spawn anything. So I went with the placed impact object and placed a party hat. I then ran a script from the party hat that would place a ghoul at the hat then disable and markfordelete the hat. This worked except for a brief instant you can see the hat - if you fire the weapon at close range. You would have to create a new nif for the hat and adjust its scale in that nif to make the hat virtually invisible. Perhaps using a dead NPC as the placed impact object would be better as you could scale a dead NPC way down from the geck and still run a script on it. I used a scaled down version of the plasma grenade explosion so the ghouls appear inside of the blue ball that the explosion makes. I have to say, it looks pretty cool. You could just use the placed impact object to place your creature and skip the whole 'hat' thing. But once I got it working, I wanted to add some randomness to spawn a variety of creatures. If you only want your weapon to spawn the same creature everytime, then just choose the creature from the placed impact object on the exlposion page. Link to comment Share on other sites More sharing options...
n0ob Posted March 11, 2010 Author Share Posted March 11, 2010 I have been working at it all night, its 7 am now and I havent got any of the methods to work :( I dont know what I am doing wrong, I made an explosion, tried adding different place impact objects and added it to projectile and projectile to my weapon, for some reason the projectile does not do any damage at all no matter what value I put in, and nothing is spawned as well.would it be possible for you to post some screen shots of your setting maybe I ll get some idea from that? also I dont know how you are running a script from the placed object, in object edit window I dont see any place to attac a script :s Link to comment Share on other sites More sharing options...
pkleiss Posted March 11, 2010 Share Posted March 11, 2010 Here is a picture of the data pages for the Spawn Gun. You can follow the red arrows. The custom weapon uses a custom projectile.The projectile uses a custom explosion.The explosion uses a custom armor (the hat).The Hat uses a custom script. The 'Ref Self' line in the script is useless and just a left over from my earlier testing that I forgot to remove before posting the picture. EDIT: Oh ya, I almost forgot, notice how I unticked 'Playable' for the hat and did not give it a 'Name' this should prevent it from being accidental picked up before its disabled. Link to comment Share on other sites More sharing options...
n0ob Posted March 12, 2010 Author Share Posted March 12, 2010 so after hours more of working on it, my party hat by itself works correctly and morphs into a ghoul if I place it in the game through a console command. The problem I have now is that for some reason "placed impact Object" Never shows up in the game, I tried placing things other then party hat without scripts on them and also different kinds of explosions but no matter what I do explosion does not place the object in the game! any ideas? ps: pkleiss thanks for the screenshots Link to comment Share on other sites More sharing options...
pkleiss Posted March 12, 2010 Share Posted March 12, 2010 The only thing I can think of is that some how the chain of custom objects isn't right - as in your weapon is not using the right projectile or the projectile in not using the right explosion, etc... Perhaps you should make a screen shot similar to mine so I can look at what you did. I mean, if it works for me, it should work for you, right? The only caveat being if you have some mod that somehow conflicts with the use of a placed impact objects, but that does not sound likely to me. Link to comment Share on other sites More sharing options...
Recommended Posts