Server Totals
Mikona - (2)
Le'Or - (0)
Ferrell - (0)
Elysia - (0)
M'Chek - (0)
Deglos - (0)
Wilderness - (0)
Visimontium - (0)
Underdark - (0)
Total players: 2
Gallery
  • Ebony Order
    Album name: DM Events
    Uploaded by: Ronan
    Uploaded: Wed Aug 20, 2014 12:04 am

Links Menu

casting spells at objects

Moderators: Nighthawk4, Dungeon Masters

casting spells at objects

PostAuthor: Alphonse » Thu Jun 30, 2005 1:54 pm

Ok. I dont do much scripting so this is probably a very easy answer.

Iwant to set up a trigger that fires a spell, at itself.

What do i need to put in the arguements for the castspell()?
User avatar
Alphonse
Master Sage
 
Posts: 5306
Joined: Wed Nov 03, 2004 8:26 am
Location: GMT

PostAuthor: fremen » Thu Jun 30, 2005 10:29 pm

what kind of spell? If it's something like magic missle where do you want it to originate from?

I also think that if a trigger is going to cast it at itself you need to use: ActionCastSpellAtLocation().

fremen
Squire of Babble
 
Posts: 46
Joined: Fri Jul 02, 2004 6:53 pm

PostAuthor: Alphonse » Thu Jun 30, 2005 10:32 pm

fremen wrote:what kind of spell? If it's something like magic missle where do you want it to originate from?

I also think that if a trigger is going to cast it at itself you need to use: ActionCastSpellAtLocation().


that was the one i was planning to use. I was wondering about the parameters to use for that. What would i use for a fireball spell?
User avatar
Alphonse
Master Sage
 
Posts: 5306
Joined: Wed Nov 03, 2004 8:26 am
Location: GMT

PostAuthor: fremen » Thu Jun 30, 2005 10:45 pm

well if the target is the trigger itself using two waypoints would probably be easier to get the origin and the target of the spell set just right.

I'm at work so this probably won't work but it should be close...

Code: Select all
object oOriginWP = GetObjectByTag("ORIGIN_WP");
object oTargetWP = GetObjectByTag("TARGET_WP");
location lTargetLoc = GetLocation(oTargetWP);
AssignCommand(oOriginWP, ActionCastSpellAtLocation(SPELL_MAGIC_MISSILE, lTargetLoc, METAMAGIC_NONE, TRUE));


The only thing that I can think that would be a problem is that you may not be able to use a waypoint as the origin. I mean can you add an action to a waypoint or more specifically can it cast a spell? If not you can create an invisible creature instead of a waypoint.

fremen
Squire of Babble
 
Posts: 46
Joined: Fri Jul 02, 2004 6:53 pm

PostAuthor: fremen » Thu Jun 30, 2005 10:50 pm

oh and for fireball it would be
Code: Select all
AssignCommand(oOriginWP, ActionCastSpellAtLocation(SPELL_FIREBALL, lTargetLoc, METAMAGIC_NONE, TRUE));

fremen
Squire of Babble
 
Posts: 46
Joined: Fri Jul 02, 2004 6:53 pm

PostAuthor: Jonezie » Thu Jun 30, 2005 11:53 pm

Waypoints can't cast spells, so the previous script wouldn't work, no. If you wanted a fireball, the easiest thing to do would probably be using the projectile traps. Those are in the standard palette under triggers-> traps. Basically, when you trip the trap, the nearest object with the same tag as the trap casts the spell at the person who triggered it.

Otherwise, you could use a similar setup to what was suggested above, but with an invisible object placeable instead of a waypoint.
User avatar
Jonezie
Team Member; Retired with Honors
 
Posts: 3906
Joined: Wed Jun 09, 2004 7:05 am
Location: Melbourne (GMT +10)

PostAuthor: Mistcaller » Fri Jul 01, 2005 12:00 am

Also, if you want to set the DC of the spell, you have to modify the corresponding "save" (fort, will, ref) OF the placeable. Doesnt make much sense, but this is how it works. :)
User avatar
Mistcaller
Team Member; Retired with Honors
 
Posts: 5481
Joined: Sun Feb 09, 2003 3:42 pm
Location: Athens, Greece (GMT +2)

PostAuthor: Alphonse » Fri Jul 01, 2005 6:42 am

Jonezie wrote:Waypoints can't cast spells, so the previous script wouldn't work, no. If you wanted a fireball, the easiest thing to do would probably be using the projectile traps. Those are in the standard palette under triggers-> traps. Basically, when you trip the trap, the nearest object with the same tag as the trap casts the spell at the person who triggered it.

Otherwise, you could use a similar setup to what was suggested above, but with an invisible object placeable instead of a waypoint.


fireball was just an example. Its not the spell I'm actually going to be using :twisted:
User avatar
Alphonse
Master Sage
 
Posts: 5306
Joined: Wed Nov 03, 2004 8:26 am
Location: GMT

PostAuthor: Jonezie » Fri Jul 01, 2005 6:58 am

I don't think there's a projectile trap for hellball. You'd have to use the invisible object. :wink:
User avatar
Jonezie
Team Member; Retired with Honors
 
Posts: 3906
Joined: Wed Jun 09, 2004 7:05 am
Location: Melbourne (GMT +10)

PostAuthor: Alphonse » Fri Jul 01, 2005 7:01 am

Jonezie wrote:I don't think there's a projectile trap for hellball.



Shhhhh. Its supposed to be a surprise

*wanders off whistling nonchalontly*
User avatar
Alphonse
Master Sage
 
Posts: 5306
Joined: Wed Nov 03, 2004 8:26 am
Location: GMT

PostAuthor: Jonezie » Fri Jul 01, 2005 7:06 am

Err...healball? That's what I said, yeah...
User avatar
Jonezie
Team Member; Retired with Honors
 
Posts: 3906
Joined: Wed Jun 09, 2004 7:05 am
Location: Melbourne (GMT +10)

PostAuthor: Papainhell » Sun Jul 03, 2005 4:14 pm

Here ya go:
Code: Select all
void main()
{
//  Target of spell
object oTarget = GetEnteringObject();
location lTargetLoc = GetLocation(oTarget);
    if (!GetIsPC(oTarget)){
        //  Make an invisible object to cast the spell
        object oCaster = CreateObject(OBJECT_TYPE_PLACEABLE, "spellcaster", lTargetLoc);
            //  Casting of spell and removal of invisable object
            AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_EPIC_HELLBALL, lTargetLoc, METAMAGIC_ANY, TRUE, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
            AssignCommand(oCaster, ActionWait(6.0));
            AssignCommand(oCaster, ActionDoCommand(DestroyObject(oCaster)));
            }

}


Also you need to make an invisible object w/ a ResRef of: spellcaster and make sure change the objects Reflex save to something like 50 :twisted:


yep, spelled invisible wrong :wink:
Image
Playing as:
Master Odel Helmsplitter
Odel Helmsplitter- Hammer Fist Stylist, monk of The Order of The Dragon.
User avatar
Papainhell
Sage
 
Posts: 2141
Joined: Wed Oct 01, 2003 1:09 am
Location: Kodiak, Alaska (for now)
Timezone: Time?


Return to NWN Scripting

Who is online

Registered users: Bing [Bot], Google [Bot]