console "player->" in a script?

Post » Sun May 05, 2013 1:50 am

This is a pretty simple question, and I suspect there's a simple answer to it, but say for instance I wanted to write a script that would have the same effect as opening the console and entering "player->setspeed 100" (that was just an example), what would I write? I wanted to make a simple startscript mod for a tweak I always use in every play-through but I never actually made it because I never knew how to do this.
User avatar
joeK
 
Posts: 3370
Joined: Tue Jul 10, 2007 10:22 am

Post » Sun May 05, 2013 6:58 am

The command you want is Mod____, value

Player->ModSpeed, 100

If I remember correctly this will add 100 points, not set it at 100.
User avatar
Riky Carrasco
 
Posts: 3429
Joined: Tue Nov 06, 2007 12:17 am

Post » Sun May 05, 2013 2:20 pm

So "player->" will work in a script? I also don't want to add/remove points, but set them, that being said will "set" still work?

EDIT: Ok I'm going to stop asking questions and just go test this instead of asking.
User avatar
Joanne Crump
 
Posts: 3457
Joined: Sat Jul 22, 2006 9:44 am

Post » Sun May 05, 2013 4:12 am

I just meant that if you have 33 Speed, it will become 133 not 100.
User avatar
Patrick Gordon
 
Posts: 3366
Joined: Thu May 31, 2007 5:38 am

Post » Sun May 05, 2013 1:22 am

Yes, if you put the command "player->...." in a script, when the script runs the command will work, just like if you tiped it in the console.
User avatar
carrie roche
 
Posts: 3527
Joined: Mon Jul 17, 2006 7:18 pm

Post » Sun May 05, 2013 3:21 pm

Ok so I made a startscript plugin but when I tested it it didn't do anything.
Here's what was in the script:
Begin hits_statsplayer->setattackbonus 100player->setdefendbonus -100End
I'm not sure if the script didn't start or just didn't work?
User avatar
Kat Stewart
 
Posts: 3355
Joined: Sun Feb 04, 2007 12:30 am

Post » Sun May 05, 2013 10:48 am

1. How did you intend to measure the effect that SetAttackBonus did or did not have?
2. Set commands do not accept negative valies.
3. To monitor whether a script starts at all, add a MessageBox "Debug: Hits_stats started" command to it. You can delete it later.
4. Add StopScript hits_stats to the script. Otherwise it will keep running constantly, overriding any fortify/drain effects you may experience during playing.
User avatar
Alexx Peace
 
Posts: 3432
Joined: Thu Jul 20, 2006 5:55 pm

Post » Sun May 05, 2013 6:44 am

There are scripts that run when the game starts and scripts that need a condition to run (like 'If ...'), which type of script was your one?
(Usually most of the scripts have a condition to run).
User avatar
Jerry Cox
 
Posts: 3409
Joined: Wed Oct 10, 2007 1:21 pm

Post » Sun May 05, 2013 7:56 am

The former. There's no conditional defined in SWG's script. But, if it wasn't set as a startscript, it won't run until called.
User avatar
Chantelle Walker
 
Posts: 3385
Joined: Mon Oct 16, 2006 5:56 am

Post » Sun May 05, 2013 2:32 am

I loaded up the game and entered "player->getattackbonus" and "player->getdefendbonus". They were unchanged.

Eh, guess I'll just have to do with a value of zero. Setting it to -100 does work if I enter it into the console though, it even shows up as -100 if I type "player->getdefendbonus".

Thanks, I'll try this.

Good to know.

I'll make some changes then test and post my results.
User avatar
Annick Charron
 
Posts: 3367
Joined: Fri Dec 29, 2006 3:03 pm

Post » Sun May 05, 2013 6:35 am

Ok so I made some modifications to the script, but I'm having some problems. Even though the script is a startscript, it never runs, and even if I start it with the console, the notifier never shows up and my stats don't change.

Here is the script:
Begin hits_statsMessageBox "Debug: Hits_stats started"player->setattackbonus 100player->setdefendbonus 0StopScript hits_statsEnd
I'm pretty sure I've made some horrible stupid mistake because I'm terrible at scripting and totally don't know what I'm doing, so feel free to scold me until I learn my lesson.
User avatar
Greg Cavaliere
 
Posts: 3514
Joined: Thu Nov 01, 2007 6:31 am

Post » Sun May 05, 2013 4:55 am

You probably need to introduce a small delay before stopping the script as it is trying to stop on the same frame it starts. And for what it is worth, defendbonus being at a negative value does seem to ensure you will get hit, as at 0 you can and will dodge. Sanctuary modifies this value in-game, making it harder to be hit.

Begin hits_statsshort doOnceshort framecounterif doOnce == 0MessageBox "Debug: Hits_stats started"player->setattackbonus 100player->setdefendbonus 0set doOnce to 1endifset framecounter to ( framecounter + 1 )if framecounter < 2returnelseStopScript hits_statsendifEnd
User avatar
Rachel Cafferty
 
Posts: 3442
Joined: Thu Jun 22, 2006 1:48 am

Post » Sun May 05, 2013 7:12 am


*scratches head* This is the first time I have seen this said. I have never had a problem stopping a script in the same frame it starts. Many scripts do exactly that when called...they do their thing one time then stop.
User avatar
Nice one
 
Posts: 3473
Joined: Thu Jun 21, 2007 5:30 am

Post » Sun May 05, 2013 1:34 am


I was honestly just kinda guessing at that, basing it on some oddities with detecting spell effects (they aren't always detected if the spell duration is too short). In theory, it should work without the delay, but it was said to not be working, and I couldn't see any other reason why, so... Many scripts do work just fine in one frame, but this is Morrowind and things don't always work.

@SWG: Did this work, by the way? I've been wondering.
User avatar
Cartoon
 
Posts: 3350
Joined: Mon Jun 25, 2007 4:31 pm


Return to III - Morrowind